Share
Embed
Shopware + Docker
Presentation for the Shopware Community Day 2017 where I explained how Docker is used to create a development environment for Shopware projects.
Ferenc Züllich
June 09, 2017
Transcript
53 slides
-
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 -
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 -
SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017
THEY DID NOT INVENT THE CONTAINER 5 Docker did not invent the container. -
SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017
ITS NOT A VIRTUAL MACHINE 6 Containers are not virtual machines. -
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 -
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 -
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) -
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 -
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 -
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 -
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 -
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 -
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? -
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 -
STEP 2: TAKING IT A STEP FURTHER Build the foundation
for a simpler tomorrow -
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 -
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 -
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 -
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 -
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 -
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 -
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? -
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 -
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 -
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 -
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 -
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 -
SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017
ON TO DEPLOYMENT SYNCING S3 BUCKETS 32 / One container serves all -
SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017
ON TO DEPLOYMENT SYNCING S3 BUCKETS 32 / One container serves all -
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 -
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 -
SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017
ON TO DEPLOYMENT RUNNING UNIT TESTS 33 Jenkins Repository Container Container Test results -
SINNERSCHRADER COMMERCE | SHOPWARE COMMUNITY DAY - DOCKER | 09.06.2017
ON TO DEPLOYMENT RUNNING UNIT TESTS 34 -
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 -
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 -
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 -
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 -
THANKS FOR ATTENDING MY TALK SinnerSchrader Commerce Schäferkampsallee 16
20357 Hamburg T +49 40 248 28-800 www.sinnerschradercommerce.com [email protected] Ferenc Züllich Developer [email protected]