magento 2 workflows
TRANSCRIPT
• KISS• Guides, Not Rules• Optimize Mercilessly• Right Process For The Right Team• Draw Your Line In The Sand
Lessons Learned
• *nix (Unix / Linux) based OS
• All Extensions must match appropriate versions– PHP– Apache / NGinX– MySQL– Etc…
• TESTS MUST PASS!
Developer Setup
• Keep Track of Changes Effectively?• Reduce Conflicts and Reconciliation?• Code Promotion?
Code Management
Vagrant
• Simplify Developer Setup• Easily Distributed Environment• Flexible• Expandable (Docker / AWS / etc.)
Vagrant• Used Simple Vagrantfile and Shell Script• Kept Files in Version Control• Allowed Simple Developer Setup
$ ~/ git clone [email protected]:username/repo.git$~/ vagrant up
Vagrant Performance• If it doesn’t change, don’t
mount it!• Increase CPUs and Memory for
the Box• Symlink var/ directories to
/tmp/magento/var/*• NFS mount (except var/)• Consider Vmware• Consider Docker
PHPStorm
• Code Completion
• Automated Code Sniffs
• Integrated Testing
• Xdebug Support• Code Templates
$ ~/ git clone [email protected]:company/clientrepo.git$ ~/ git checkout –b mybranch develop$ ~/ vagrant up
Developer WorkFlow
• Code is kept in separate repo• Maintained and deployed in branches (dev, stage, prod, etc.)• Allows faster deployments and rollbacks• Client code is kept as artifacts on the server.• Composer.json points to directory that holds all artifacts.
Deployment
$ ~/ git clone [email protected]:username/clientserverrepo.git$ ~/ git checkout -b <branchname>$ ~/ composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition ./$ ~/ git commit –m “…”$ ~/ composer require clientname/module01 clientname/module02 (etc.)$ ~/ php bin/magento deploy:mode:set <mode>$ ~/ php bin/magento module:enable Client_Module01 Client_Module02$ ~/ php bin/magento setup:upgrade$ ~/ git commit –m “…”
Server Setup
$ ~/ git fetch –all$ ~/ git merge origin/stage$ ~/ php bin/magento setup:di:compile-multi-tenant$ ~/ git commit –m “…”$ ~/ git tag v1.0.10$ ~/ (other misc…)
Deployment
(on branch production in repo)$ ~/ git fetch –all$ ~/ git checkout –b v1.0.10 v1.0.10$ ~/ php bin/magento module:enable <module01> <module02>$ ~/ php bin/magento setup:upgrade
Production Deployment
AutomationGit Hooks can automate deployment of code. Never hook a production deployment!
Deploybot can automate everything we’ve seen as well as static asset generation, etc.