Author: Phil Birnie, info[at]7thstreetweb.com
This repo helps stand up a development environment for new or existing Magento 2.3 implementations on Ubuntu version Bionic Beaver.
vagrant up
Unfortunately, Magento’s Composer package requires credentials; In /vagrant/conf/composer
, please copy auth.json.template
to auth.json
with your Magento Marketplace public and private key. This is not the same as your login and password
Walk through the setup script.
Important! Do NOT use localhost. See: https://magento.stackexchange.com/questions/194828/magento-2-new-customer-account-form-not-working/211392#211392
Get a ☕... This is going to be a while.
The dev environment in Magento 2 can be slow. Here are some recommendations, many of which were pulled directly from the Magento documentation.
- Disable only FPC and Block Cache. Leave all others on. Turn all caches on for front-end development or testing
- Enable only the extensions that you need. Many of the analytics extensions are completely unnecessary.
- Opcache is enabled -- this appears to make a substantial difference.
- Under
Stores -> Configuration -> Advanced -> Developer
, bundle and concatenate JS/CSS when feasible. The excessive number of requests in Docker slows the site down substantially. (Obviously this is not feasible when doing FE work) - Synced folders are disabled for performance reasons; if you wish to enable them, see instructions in Vagrant file. This also means that you will want to initially rsync after you get everything set up. Simply run this command from within the project root.
scp -P 2222 -r [email protected]:/var/www/magento .
(You may need to add your key to the vagrant box) For subsequent updates, (if not using your IDE, use rsync)
Deploying to production:
bin/magento maintenance:enable
- Enable Maintenance Modebin/magento setup:upgrade
- Run setup Script (and clear cache)bin/magento setup:di:compile
- Compile codebin/magento setup:static-content:deploy
- Compile Static Content (CSS, JS, Assets)bin/magento maintenance:disable
- Disable Maintenance Mode
Or... in a single line (for MageMojo, hence the php70
):
php70 bin/magento maintenance:enable;\ php70 bin/magento setup:upgrade;\ php70 bin/magento setup:di:compile;\ php70 bin/magento setup:static-content:deploy;\ php70 bin/magento maintenance:disable
- MySQL: Percona, 5.7
- PHP-FPM: 7.2
- Nginx
- Ubuntu: 18.04
- Docker: 29s
- Vagrant: 2s