Fresh magento2 project setup. Head into application
folder in your host/root through term.
composer create-project --repository=https://repo.magento.com/ magento/project-community-edition ./
php bin/magento setup:install \
--base-url=http://magento2.test \
--db-host=db:3306 \
--db-name=database \
--db-user=user \
--db-password=password \
--admin-firstname=admin \
--admin-lastname=admin \
[email protected] \
--admin-user=admin \
--admin-password=admin123 \
--language=en_US \
--currency=USD \
--timezone=Europe/Copenhagen \
--use-rewrites=1 \
--elasticsearch-host=elastic-search \
--elasticsearch-port=9200
Admin url is being generated once installation is done.
php bin/magento mo:di Magento_TwoFactorAuth
php bin/magento setup:di:compile
php bin/magento deploy:mode:set developer
php bin/magento setup:config:set developer
Set the proper permission for the whole Magento 2 installation directory by using below command
find . -type d -exec chmod 755 {} \; && find . -type f -exec chmod 755 {} \;
Info: In some cases, you can not use 770 or 660 permissions (Fast-CGI systems, for example). Instead, you can use 755 and 644 respectively.
chmod 777 -R var
chmod 777 -R generated
chmod 777 -R app/etc
rm -rf var/cache/* var/page_cache/* var/generation/*
After that run php bin/magento setup:di:compile
enable display_errors
from file app/bootstrap.php
around line 11 remove #
To start containers use docker-sync-stack start
— this will start docker-sync process as well as the server
COMMAND | START SYNC | CLEAN SYNC | STOP SYNC | LIST SYNCS |
---|---|---|---|---|
docker-sync |
start |
clean |
stop |
list |
COMMAND | DOCKER START | DOCKER DOWN | DIG INTO CONTAINER |
---|---|---|---|
docker-compose |
up -d |
down |
docker exec -it [CONTAINER-ID] bash |
Remove ALL containers, networks not used by at least one container, dangling images, dangling build cache etc
docker-compose up -d --build --force-recreate
docker volume rm $(docker volume ls -q)
docker system prune -a
docker system prune --volumes
Head into nginx/php-fpm container and type:
chmod 755 application/
In application folder
chown -R www-data:www-data .
Guide from magento.stackexchange.com
Run below command unless alias is different.
php bin/magento
Command | Info |
---|---|
admin:user:create |
Creates an administrator |
Command | Info |
---|---|
app:config:import |
Import data from shared configuration files to appropriate data storage |
Command | Info |
---|---|
i18n:collect-phrases |
Discovers phrases in the codebase |
i18n:pack |
Saves language package |
Command | Info |
---|---|
info:adminuri |
Displays the Magento Admin URI |
info:backups:list |
Prints list of available backup files |
info:currency:list |
Displays the list of available currencies |
info:dependencies:show-framework |
Shows number of dependencies on Magento framework |
info:dependencies:show-modules |
Shows number of dependencies between modules |
info:dependencies:show-modules-circular |
Shows number of circular dependencies between modules |
info:language:list |
Displays the list of available language locales |
info:timezone:list |
Displays the list of available timezones |
Command | Info |
---|---|
maintenance:allow-ips |
Sets maintenance mode exempt IPs |
maintenance:disable |
Disables maintenance mode |
maintenance:enable |
Enables maintenance mode |
maintenance:status |
Displays maintenance mode status |
Command | Info |
---|---|
module:config:status |
Checks the modules configuration in the 'app/etc/config.php' file and reports if they are up to date or not |
module:disable |
Disables specified modules |
module:enable |
Enables specified modules |
module:status |
Displays status of modules |
module:uninstall |
Uninstalls modules installed by composer |
Command | Info |
---|---|
sampledata:deploy |
Deploy sample data modules for composer-based Magento installations |
sampledata:remove |
Remove all sample data packages from composer.json |
Command | Info |
---|---|
setup:backup |
Takes backup of Magento Application code base, media and database |
setup:config:set |
Creates or modifies the deployment configuration |
setup:db-data:upgrade |
Installs and upgrades data in the DB |
setup:db-schema:upgrade |
Installs and upgrades the DB schema |
setup:db:status |
Checks if DB schema or data requires upgrade |
setup:di:compile |
Generates DI configuration and all missing classes that can be auto-generated |
setup:install |
Installs the Magento application |
setup:performance:generate-fixtures |
Generates fixtures |
setup:rollback |
Rolls back Magento Application codebase, media and database |
setup:static-content:deploy |
Deploys static view files |
setup:store-config:set |
Installs the store configuration. Deprecated since 2.2.0. Use config:set instead |
setup:uninstall |
Uninstalls the Magento application |
setup:upgrade |
Upgrades the Magento application, DB data, and schema |