Optimise the
development process
with simple tips and tricks
Alin Alexandru - CTO Innobyte | 08.10.2021
Agenda
➢ Old development setup
➢ Reported issues
➢ Requirements for new setup
➢ Analized solutions
➢ Winner
➢ How we use it
Old development setup
➢ Based on Virtual Box
➢ Configured with ansible (in house roles)
➢ Using NFS/Samba share
Reported issues
Time consuming to configure a project
You had to wait until all the packages were installed on an Ubuntu based image (30-
40 minutes)
Bad performance
● Mainly because of Xdebug and NFS/Samba share
● For frontend developers was a nightmare to work
Resource intensive
Each VM was consuming 4-8GB of ram.
Requirements for new setup
Fast environment
● Xdebug needs to be active only when you are debugging
● Frontend developers don’t need Xdebug
Secure
Most of the docker setup binds to 0.0.0.0:80, 0.0.0.0:443
Capable to run multiple projects in parallel
Sometimes you need to wait for a time consuming task, while you could work on
something else.
Requirements for new setup
Linux/Windows/Mac compatible
Each developer is free to use what OS prefers
Compatible with existing structure
Changing project structure will break existing Merge requests / Pull Requests
Easy to migrate project
Migrations should be made in 2-4 hours
Easy to start new projects
Starting a project from scratch should be straightforward
Requirements for new setup
Can support other planforms
Symfony or Wordpress
Documented
Documentation became a must, as our inhouse solution didn’t have any
Easy to extend
Be capable to add our tools/scripts
Supported
The project should be active and have a community
Analized solutions
Warden
https://warden.dev/
Dockergento
https://github.com/ModestCoders/magento2-dockergento
Meanbee
https://github.com/meanbee/docker-magento2
M Academy
https://github.com/markshust/docker-magento
Meet Warden
Warden architecture
Feature List
➢ Traefik for SSL termination and routing/proxying requests into the correct
containers
➢ Portainer for quick visibility into what's running inside the local Docker host
➢ Dnsmasq to serve DNS responses for .test domains eliminating manual editing
of /etc/hosts
➢ An SSH tunnel for connecting from Sequel Pro or TablePlus into any one of
multiple running database containers
➢ Warden issued wildcard SSL certificates for running https on all local
development domains.
Feature List
➢ Full support for Magento 1, Magento 2, Laravel, and custom project
environment configurations
➢ Mailhog to easily test emails
➢ ElasticHQ for Management and Monitoring Elasticsearch
➢ Intelligent Nginx routing, so that request are passed to container with Xdebug
only when cookie is present
➢ Easy to profile performance with blackfire
➢ You can write your own commands in ~/.warden/commands/ or inside project
folder in .warden/commands/
Feature List
➢ Support for Magento2 Commerce spit database
➢ Can run Magento Functional Testing Framework
https://docs.warden.dev/configuration/mftf.html
➢ Allure Reporting https://docs.warden.dev/configuration/reporting.html
➢ Easy setup multiple domains
https://docs.warden.dev/configuration/multipledomains.html
➢ Easy to customize an environment
https://docs.warden.dev/environments/customizing.html
➢ Support for Magepack advanced JS bundling
Installation
Requires only Homebrew,
Docker, and Docker Compose to
get started, and Mutagen on
macOS (for Magento 2 file sync).
brew install davidalger/warden/warden
warden svc up
Migrate local running project
➢ warden env-init project-name magento2
➢ Edit .env if needed
➢ warden svc up - to start global services
➢ warden sign-certificate project-name.test
➢ warden env up - to start project containers
➢ pv|cat /path/to/dump.sql.gz | gunzip -c | warden db import
➢ Open https://app.project-name.test
frontend
development
➢ warden shell
➢ npm install
➢ grunt clean
➢ grunt exec:<theme>
➢ grunt less:<theme>
➢ grunt watch
https://docs.warden.dev/configu
ration/livereload.html
How we use it
Inspired by https://github.com/davidalger/warden-env-magento2
➢ Created our own warden commands - git project cloned in
~/.warden/commands/
○ m2-bootstrap - runs all commands needed to setup a M2 environment
○ m2-dump - makes a DB dump from an (stage/prod) environment and
copies it locally (uses n98-magerun2)
○ m2-media - synchronize pub/media from an (stage/prod) environment
➢ Maintain app/etc/n98-magerun2.yml to skip tables that needs to be excluded
https://github.com/netz98/n98-magerun/wiki/Stripped-Database-Dumps
➢ Created our own app/etc/env.php.init.php which contains good enough initial
default values
How we use it
➢ app/etc/env.php.warden.php - is a git versioned file that contains setting
commun on dev environment. app/etc/env.php is a symlink to this file
○ Email settings - to use mailhog
○ base_url - website url
○ 3rd party API settings - Ex: google reCaptcha
➢ app/etc/config.php - contains common settings on all stage/prod environments.
Ex: asset settings (minify css, combine, etc)
Now use case to start a project
➢ warden m2-dump --stage stage1
➢ warden m2-bootstrap --db-dump dump.sql.gz
➢ warden m2-media --stage stage1
Estimated finish time: 5-10 minutes
Previously 2-3h with a lot of manual steps and high changes to fail
Demo
Thank you!
Q&A
Alin Alexandru - CTO Innobyte | 08.10.2021
alin.alexandru@innobyte.com

Warden @ Meet magento Romania 2021

  • 1.
    Optimise the development process withsimple tips and tricks Alin Alexandru - CTO Innobyte | 08.10.2021
  • 3.
    Agenda ➢ Old developmentsetup ➢ Reported issues ➢ Requirements for new setup ➢ Analized solutions ➢ Winner ➢ How we use it
  • 4.
    Old development setup ➢Based on Virtual Box ➢ Configured with ansible (in house roles) ➢ Using NFS/Samba share
  • 5.
    Reported issues Time consumingto configure a project You had to wait until all the packages were installed on an Ubuntu based image (30- 40 minutes) Bad performance ● Mainly because of Xdebug and NFS/Samba share ● For frontend developers was a nightmare to work Resource intensive Each VM was consuming 4-8GB of ram.
  • 6.
    Requirements for newsetup Fast environment ● Xdebug needs to be active only when you are debugging ● Frontend developers don’t need Xdebug Secure Most of the docker setup binds to 0.0.0.0:80, 0.0.0.0:443 Capable to run multiple projects in parallel Sometimes you need to wait for a time consuming task, while you could work on something else.
  • 7.
    Requirements for newsetup Linux/Windows/Mac compatible Each developer is free to use what OS prefers Compatible with existing structure Changing project structure will break existing Merge requests / Pull Requests Easy to migrate project Migrations should be made in 2-4 hours Easy to start new projects Starting a project from scratch should be straightforward
  • 8.
    Requirements for newsetup Can support other planforms Symfony or Wordpress Documented Documentation became a must, as our inhouse solution didn’t have any Easy to extend Be capable to add our tools/scripts Supported The project should be active and have a community
  • 9.
  • 10.
  • 11.
  • 13.
    Feature List ➢ Traefikfor SSL termination and routing/proxying requests into the correct containers ➢ Portainer for quick visibility into what's running inside the local Docker host ➢ Dnsmasq to serve DNS responses for .test domains eliminating manual editing of /etc/hosts ➢ An SSH tunnel for connecting from Sequel Pro or TablePlus into any one of multiple running database containers ➢ Warden issued wildcard SSL certificates for running https on all local development domains.
  • 14.
    Feature List ➢ Fullsupport for Magento 1, Magento 2, Laravel, and custom project environment configurations ➢ Mailhog to easily test emails ➢ ElasticHQ for Management and Monitoring Elasticsearch ➢ Intelligent Nginx routing, so that request are passed to container with Xdebug only when cookie is present ➢ Easy to profile performance with blackfire ➢ You can write your own commands in ~/.warden/commands/ or inside project folder in .warden/commands/
  • 15.
    Feature List ➢ Supportfor Magento2 Commerce spit database ➢ Can run Magento Functional Testing Framework https://docs.warden.dev/configuration/mftf.html ➢ Allure Reporting https://docs.warden.dev/configuration/reporting.html ➢ Easy setup multiple domains https://docs.warden.dev/configuration/multipledomains.html ➢ Easy to customize an environment https://docs.warden.dev/environments/customizing.html ➢ Support for Magepack advanced JS bundling
  • 16.
    Installation Requires only Homebrew, Docker,and Docker Compose to get started, and Mutagen on macOS (for Magento 2 file sync). brew install davidalger/warden/warden warden svc up
  • 17.
    Migrate local runningproject ➢ warden env-init project-name magento2 ➢ Edit .env if needed ➢ warden svc up - to start global services ➢ warden sign-certificate project-name.test ➢ warden env up - to start project containers ➢ pv|cat /path/to/dump.sql.gz | gunzip -c | warden db import ➢ Open https://app.project-name.test
  • 18.
    frontend development ➢ warden shell ➢npm install ➢ grunt clean ➢ grunt exec:<theme> ➢ grunt less:<theme> ➢ grunt watch https://docs.warden.dev/configu ration/livereload.html
  • 19.
    How we useit Inspired by https://github.com/davidalger/warden-env-magento2 ➢ Created our own warden commands - git project cloned in ~/.warden/commands/ ○ m2-bootstrap - runs all commands needed to setup a M2 environment ○ m2-dump - makes a DB dump from an (stage/prod) environment and copies it locally (uses n98-magerun2) ○ m2-media - synchronize pub/media from an (stage/prod) environment ➢ Maintain app/etc/n98-magerun2.yml to skip tables that needs to be excluded https://github.com/netz98/n98-magerun/wiki/Stripped-Database-Dumps ➢ Created our own app/etc/env.php.init.php which contains good enough initial default values
  • 20.
    How we useit ➢ app/etc/env.php.warden.php - is a git versioned file that contains setting commun on dev environment. app/etc/env.php is a symlink to this file ○ Email settings - to use mailhog ○ base_url - website url ○ 3rd party API settings - Ex: google reCaptcha ➢ app/etc/config.php - contains common settings on all stage/prod environments. Ex: asset settings (minify css, combine, etc)
  • 21.
    Now use caseto start a project ➢ warden m2-dump --stage stage1 ➢ warden m2-bootstrap --db-dump dump.sql.gz ➢ warden m2-media --stage stage1 Estimated finish time: 5-10 minutes Previously 2-3h with a lot of manual steps and high changes to fail
  • 22.
  • 23.
    Thank you! Q&A Alin Alexandru- CTO Innobyte | 08.10.2021 alin.alexandru@innobyte.com