What are steps, guidelines and flows that needs to be followed for a successfully Magento2 Continuous Integration workflow ?
1 Answer
We're currently working on improving our deployment process in Magento 2. I'd welcome any feedback you have - please ping me on Twitter or email.
Right now on M2 you'd do the following (in your environment)
- Get or update code (git/etc...)
- composer install
- bin/magento setup:upgrade (or setup:install)
- bin/magento set:mode production
FYI set:mode production does a
- bin/magento setup:di:compile
- bin/magento setup:static-content:deploy
There are some other approaches you can use now to get closer to a 2 step build and deploy process but they're rather complex.
-
Chuck, could you explain more about the more complex deployment proces?– TjitseCommented Jan 30, 2017 at 21:44
-
It's in development - we'll write it up and release it as part of the next release (2.2). Check out some of the new CLI commands we've added in mainline: app:config:dump, app:config:import, config:sensitive:set, config:set, config:show, setup:db:status . Idea is you install Magento on your dev machine, configure as desired on the admin panel. do an app:config:dump (end up with a config.php, env.php), compile & static-asset deploy. Then you copy your code (including assets) over to production environment (hand copy swizzle your env.php file as appropriate) and then setup:upgrade on prod.– ChuckCommented Mar 24, 2017 at 16:10
-
Basically a 2 pass deploy operation. First pass is on your dev machine (i.e. no production downtime), 2nd pass is on production (code copy + potential down time (setup:upgrade) if you have a schema change). Goal is <1 min down time on production with schema change.– ChuckCommented Mar 24, 2017 at 16:11
-
Suggestion: don't run "composer install" in Production! That should be done in a pre-deploy stage in the CI process, to avoid severe issues if Packagist or repo.magento.com are down. You could even run the other magento commands pre-deploy as well: if you deploy a pre-compiled artifact (package) instead, then you won't have to run anything other than "magento setup:upgrade" for the DB + possibly a cache flush once the code reaches production. Minimizing downtime to just a few miliseconds (or couple seconds) even with schema changes. Commented May 9, 2017 at 13:28