Preloader
Auf dieser Website werden Daten wie z.B. Cookies gespeichert, um wichtige Funktionen der Website, einschließlich Analysen, Marketingfunktionen und Personalisierung zu ermöglichen. Sie können Ihre Einstellungen jederzeit ändern oder die Standardeinstellungen akzeptieren.
Cookie Hinweise
Datenschutzregelung
22.10.2020

Magento

Startkonfiguration für Magento 2

Optimal Development Environment

Overview

A typical software development flow is as follows:

Local dev machine > QA/integration server > Preview server (optional) > Production server

Whether you are writing a new Magento 2 extension or contributing to the code base, the first step for any developer is setting up a development environment. This article will guide you in setting up and optimizing your local development machine. Local development machine

Your local development machine is where you develop and deploy your code to test it against a running Magento application. Its configuration should be as close to a production server as possible.

In your development machine, make sure you are running the Magento application in developer mode. You can enable this mode with the command bin/magento deploy:mode:set developer. Installation

The following is a list of the different ways you can install Magento 2 locally:

Manual installation
If you are developing on a local machine that meets the system requirements, you can follow the same steps as installing Magento on a production server.

Virtual Machine (VM) installation
Installing Magento 2 in a virtual environment allows you to run Magento 2 without the need to install a local LAMP stack.

VM tool
You can use a VM tool, such as VirtualBox, together with a virtual environment tool, such as Vagrant or Docker, to create reusable and shareable instances of Magento for development.

“magento developer box”
A search for “magento developer box” in GitHub provides a list of unofficial virtual machines configured for Magento development.

Optimal Configuration

The following is a list of optimizations you can make on your local development machine

  • Magento recommends installing and using the latest supported version of PHP 7 to increase performance.
  • Replace your MySQL database with Percona.
  • Make sure you install and enable PHP OPcache.
  • Xdebug is off by default. Enable this feature only when you need it because it requires a lot of memory and degrades performance. The xdebug.max_nesting_level configuration needs to be set to 200 or greater for Magento. You can increase the memory available to PHP to get an increase in performance with Xdebug on.
  • If you need sample data, you can install it using composer or by cloning repositories.
  • To speed up frontend development, turn off merging of CSS and JavaScript.
  • Make sure caching is turned on (this is the default behavior). Generally, only page cache and block cache should be turned off for development and turned back on when testing.
  • Opcache timestamp validation should always be on for development. Development is impossible with opcache on and revalidation off because any PHP modification would require a cache reset.

Magento-Befehle

Bitte diese Befehle in der Konsole im Root Verseichnis ausführen!

Achtung
Bitte immer in der Konsole mit dem "Rechteinhaber" der Dateien verbinden, sonst kommt es zu unerwünschten Nebeneffekten! 

Aktuelle Version anzeigen

Zeigt die aktuell installierte Version an.

php bin/magento --version

Cache leeren

Den Magento Cache sollte man nach deploys oder Änderungen am Content leeren!

php -f ./bin/magento cache:clean
php -f ./bin/magento cache:flush

Content deployen

Neue oder eigene Module aktivien und Code generieren

php -f ./bin/magento setup:upgrade
php -f ./bin/magento setup:di:compile
php -f ./bin/magento setup:static-content:deploy -f
php -f ./bin/magento setup:static-content:deploy -f de_DE

Logs aktivieren / deaktivieren

Cache leeren! 

Debug-Log

php bin/magento setup:config:set --enable-debug-logging=true/false
php bin/magento cache:flush

System-Log

php bin/magento setup:config:set --enable-syslog-logging=true/false
php bin/magento cache:flush

Magento-Update

Magento 2 Update via Composer

Das System in den Wartungsmodus versetzen.

php bin/magento maintenance:enable

Das "x" steht für die zu installierende Version. Statt der Community Edition kann man hier auch die Enterprise Version installieren.

composer require magento/product-community-edition 2.x.x --no-update
//oder
composer require magento/product-enterprise-edition=2.x.x --no-update

Führt das eigentliche Update durch.

composer update
rm -rf var/di var/generation
php bin/magento cache:flush
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento indexer:reindex
php bin/magento maintenance:disable

Extension-Install

Install an extension

We recommend working in a development branch when adding an extension to your implementation. If you do not have a branch, see the Get started creating branches topic. When installing an extension, the extension name (_) is automatically inserted in the app/etc/config.php file. There is no need to edit the file directly. 

To install an extension:

  • On your local workstation, change to the Cloud project root directory.
  • Create or checkout a development branch. See branching.
  • Using the Composer name and version, add the extension to the require section of the composer.json file.
  • composer require : --no-update

For example:

composer require pixlee/magento2:1.0.1 --no-update

Update the project dependencies.

composer update

Add, commit, and push code changes. 

git add -A
git commit -m "Install <extension-name>"
git push origin <branch-name>

When installing an extension, you must include the composer.lock file when you push code changes to the remote environment. The composer install command reads the composer.lock file to enable the defined dependencies in the remote environment. 

After the build and deploy finishes, use a SSH to log in to the remote environment and verify the extension installed. 

bin/magento module:status <extension-name>

An extension name uses the format: <VendorName>_<ComponentName>

Sample response:

Module is enabled
If you encounter deployment errors, see extension deployment failure.

Manage extensions

When you add an extension using Composer, the deployment process automatically enables the extension. If you already have the extension installed, you can enable or disable the extension using the CLI. When managing extensions, use the format: _. Never enable or disable an extension while logged in to the remote environments.

To enable or disable an extension:

  1. On your local workstation, change to the Cloud project root directory.
  2. Enable or disable a module. The module command updates the config.php file with the requested status of the module.
    1. Enable a module.
    2. $bin/magento module:enable <module-name>
    3. Disable a module.
    4. $bin/magento module:disable <module-name>
  3. If you enabled a module, use ece-tools to refresh the configuration.
    1. $./vendor/bin/ece-tools module:refresh
  4. Verify the status of a module.
    1. $bin/magento module:status <module-name>
  5. Add, commit, and push code changes.
    1. $git add -A
    2. $git commit -m "Disable <extension-name>"
    3. $git push origin <branch-names>

Magento-Lagerverwaltung

Lagerverwaltungsaktionen

https://www.aheadworks.com/blog/magento-2-stock-inventory-tutorial/

Die Di.xml Datei und Klassen Extention

https://devdocs.magento.com/guides/v2.3/extension-dev-guide/build/di-xml-file.html