Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Shopware + Docker

Shopware + Docker

Presentation for the Shopware Community Day 2017 where I explained how Docker is used to create a development environment for Shopware projects.

42257a302e7169d700eaec0910725811?s=128

Ferenc Züllich

June 09, 2017
Tweet

Other Decks in Programming

Transcript

  1. Ahaus, 9th June 2017 SHOPWARE + DOCKER

  2. BASICS - THE WORLD OF DOCKER A LOOK BACK TAKING

    CARE OF THE DEVS TAKING IT A STEP FURTHER ON TO DEPLOYMENT A LOOK INTO THE FUTURE
  3. THE WORLD OF DOCKER

  4. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    BASICS THE WORLD OF DOCKER 4 / When talking about Docker people often assume two things: / Docker invented containers / Containers are virtual machines
  5. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    THEY DID NOT INVENT THE CONTAINER 5 Docker did not invent the container.
  6. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    ITS NOT A VIRTUAL MACHINE 6 Containers are not virtual machines.
  7. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    BASICS THE WORLD OF DOCKER 7 / When talking about Docker people often assume two things: / Docker invented containers / Containers are virtual machines / Docker builds on the fundaments of the Linux kernel / Container = Isolated processes with their resources / Image = the template for a container. Source: wikipedia.org
  8. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    BASICS TOOL AND INFRASTRUCTURE 8 / Docker is a tool and an infrastructure / Create and manage images and containers in a standardized way / Distribute your images / Tag them for different versions / Inspect and access your containers in a standardized way / Build upon existing images
  9. A LOOK BACK

  10. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    THE DEV ENVIRONMENT TEN YEARS AGO 10 / What options did we have back in the day? / Install a XAMPP Stack on the local machine and configure it by hand / Install the dev environment on a global server and let the developers loose on it / Put it all in a virtual machine (Vagrant)
  11. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    SO? WHATS WRONG WITH THAT? 11 / Simulate the network part / Handing over the project to the juniors / Multiple users work on the same project? / Working from remote? / Sync changes, keep the database up to date / Keep the versions of the software up to date / Wasting resources and time
  12. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    A NEW FOUNDATION BASED ON DOCKER 12 / Lets make a dev environment that is / Run, setup and maintained in a uniform way across machines (even operating systems) / Responsibly handling our resources / Easy to extend and built upon / Fun to use
  13. STEP 1: TAKING CARE OF THE DEVS Standardize the dev

    environment
  14. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    STANDARDIZE THE DEV ENVIRONMENT WHAT DO WE NEED? 14 / We want to run Shopware, so / We need a web server to handle our request / We need a PHP FPM instance we can talk to / Database
  15. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    STANDARDIZE THE DEV ENVIRONMENT OVERVIEW 15 / With SSL / With a host configured to serve a Shopware installation / With IONCUBE / XDEBUG / BlackFire / Nothing special for now, just a database
  16. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    STANDARDIZE THE DEV ENVIRONMENT PUTTING IT ALL TOGETHER 16 Docker-compose / Start our containers / Link the networks of the containers together / Mount the file system
  17. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    STANDARDIZE THE DEV ENVIRONMENT BONUS: THE SMALL THINGS (MIGRATIONS, CACHING ETC.) 17 / How to make sure that the migrations are run and other important jobs are run when we start our development environment? / What about varnish, elastic search etc?
  18. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    STANDARDIZE THE DEV ENVIRONMENT 18 / What we have done so far / Talked about a list of basic containers we need to run a Shopware instance / Briefly covered small adjustments that could have been made / How to wire it up and get it running
  19. STEP 2: TAKING IT A STEP FURTHER Build the foundation

    for a simpler tomorrow
  20. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    TAKING IT A STEP FURTHER SIMPLE, SINGLE PURPOSE, REUSABLE 20 / Software engineering knows a lot of principles and best practices / DRY - Don't repeat yourself / Single Responsibility Principle / Rule of three / … / Create simple single purpose containers and stack them
  21. None
  22. None
  23. None
  24. None
  25. None
  26. None
  27. None
  28. None
  29. None
  30. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    TAKING IT A STEP FURTHER PHP 25 / Every stage adds one or more distinct features 7-ubuntu-vanilla 7-ubuntu-dev 7-ubuntu- shopware XDEBUG IonCube Libs BlackFire User
  31. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    TAKING IT A STEP FURTHER WHAT YOU CAN DO NOW 26 / Get new projects up and running in no time no matter if its a Shopware project or not / Have simple separated containers for multiple purposes
  32. STEP 3: ON TO DEPLOYMENT Docker and multiple environments

  33. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    ON TO DEPLOYMENT A PRIMER: HOW WE DO DEPLOYMENTS / Based on shipit / Used to run composer and other commands and sync those to the remote server / We don’t want that on our computer or target environment! Lets put it in a container. / Enables the One-Click Deployment
  34. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    ON TO DEPLOYMENT A PRIMER: HOW WE DO DEPLOYMENTS Jenkins ssh yarn cache composer cache Repository Container
  35. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    ON TO DEPLOYMENT A PRIMER: HOW WE DO DEPLOYMENTS Jenkins ssh yarn cache composer cache Repository Container Remote Server
  36. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    ON TO DEPLOYMENT 30 / Okay you can sync files, what else can you do for me? / What do you think about getting the newest database dump? / What about our S3 buckets? / Did you say tests?
  37. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    ON TO DEPLOYMENT GETTING THE LATEST DATABASE DUMP 31 Download database dump Push image Download image
  38. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    ON TO DEPLOYMENT GETTING THE LATEST DATABASE DUMP 31 Remote Server Download database dump Push image Download image
  39. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    ON TO DEPLOYMENT GETTING THE LATEST DATABASE DUMP 31 Remote Server Download database dump Jenkins Push image Download image
  40. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    ON TO DEPLOYMENT GETTING THE LATEST DATABASE DUMP 31 Remote Server Download database dump Jenkins Image repository Push image Download image
  41. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    ON TO DEPLOYMENT GETTING THE LATEST DATABASE DUMP 31 Remote Server Download database dump Jenkins Image repository Push image Download image Developer machine
  42. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    ON TO DEPLOYMENT SYNCING S3 BUCKETS 32 / One container serves all
  43. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    ON TO DEPLOYMENT SYNCING S3 BUCKETS 32 / One container serves all
  44. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    ON TO DEPLOYMENT SYNCING S3 BUCKETS 32 / One container serves all These are added as environment variables by Docker
  45. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    ON TO DEPLOYMENT SYNCING S3 BUCKETS 32 / One container serves all These are added as environment variables by Docker
  46. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    ON TO DEPLOYMENT RUNNING UNIT TESTS 33 Jenkins Repository Container Container Test results
  47. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    ON TO DEPLOYMENT RUNNING UNIT TESTS 34
  48. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    ON TO DEPLOYMENT INTEGRATING CONTINUOUS INTEGRATION 35 / Now that we have unit tests and the deployment neatly isolated we can organize them in a deployment pipeline / The same goes for data syncing
  49. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    ON TO DEPLOYMENT SUMMARY 36 / Now you are able to make use of your reusable images to improve your workflow: / Create containers for deployment / Create containers to run your syncing commands / Create containers for unit testing / Organize them in workflows to automate tasks like data sync across development environments
  50. A LOOK INTO THE FUTURE

  51. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    A LOOK INTO THE FUTURE 38 / Start using Docker in production (if feasible) / Create an environment for a feature branch for isolated testing
  52. SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017

    SUMMARY 39 / We started out by explaining what Docker is: / Its a framework to simplify creation of containers and its not a virtualization in the traditional way / We continued using Docker to get our Shopware instance up and running / Which lend us to employ good software engineering practice to separate the big container mess we created into smaller reusable containers / Eventually we took it one step further and also „Dockerized“ other tasks like deployment
  53. THANKS FOR ATTENDING MY TALK 
 SinnerSchrader Commerce
 Schäferkampsallee 16


    20357 Hamburg
 
 T +49 40 248 28-800
 
 www.sinnerschradercommerce.com commerce@sinnerschrader.com Ferenc Züllich Developer ferenc.zuellich@sinnerschrader.com