SlideShare a Scribd company logo
IMPROVING WORDPRESS DEVELOPMENT AND
DEPLOYMENTS WITH DOCKER AND CI/CD
Brett G. Palmer
Twitter: @brettgpalmer
LinkedIn: brettgpalmer
Introductions
Career Background
• Independent Software Developer & Entrepreneur
• Promoting open source and technology
• Currently: Contractor for State of Utah - DTS/DWS
• Helping Migrate to Open Source Eligibility System
• WordPress Development last 7 years
• Organizer for SLC DevOps Days and DevOpsUT Meetup
3
Development Interests
• Enterprise Java Development - Spring Cloud
• Mobile Development
• Ionic Mobile Framework
• Chatbots for Alexa, Google Home, FB Messenger
• WordPress REST API integration
• WordPress Hosting and Deployments
4
Current Tech Interests
• Entrepreneur helping small businesses
• Mobile business apps
• Website hosting
• Software Recruiter
• Helping developers gain their independence
• Development training
• Programming, DevOps, Testing
5
Favorite Job
My Pets
What’s the
Problem?
WordPress Security Concerns
• Sucuri 2018 Reports
• 90% CMS sites were WordPress
• Under 5% for Magento, Joomla, Drupal, etc
• Enterprises avoid adopting WordPress
• Frequently affects small businesses
9
Common Reasons for Hacks
• Outdated WordPress Installs
• Unprotected Access to WordPress Admin
• Insecure/outdated plugins or themes
• Incorrect File Permissions
10
WordPress Deployment Errors
• Manual steps from testing to production
• Frequent errors with deployments
• “Works on my machine” syndrome
11
Intro Docker
and
Containers
Docker Containers Intro
• Standard unit of software
• Packages code and dependencies together
• Minimal amount necessary to run
• Run quickly and reliably
• Containers are ephemeral (disposable)
• Pets vs Cattle
Improving WordPress Development and Deployments with Docker
How
Containers
are Helpful
How Containers Can Help
• WordPress updates are easier and more frequent
• Consistent deployments to Dev, Test, and Prod
• Lock down plugins and themes
• Containers are ephemeral (short lasting) - any changes
to running container are temporary.
16
Stateless Containers
for WordPress
Approach
The Approach
• Create consistent WordPress environment
• Dev, Test, and Prod
• Started 2 years ago and evolved as needed
• Many ways to solve the same problem
• More WP containers available today
18
Technologies Used
• Docker: creates WordPress containers
• Docker Compose: integrates dependent services
• Nginx: Reverse proxy and TLS/SSL certificates hosting
• WordPress Site Container (Primary)
• WP Offload Media Light Amazon S3 and Cloudfront
• MySQL Database
• PhpMyAdmin container (development only)
• Kubernetes (future deployments)
19
Solution: Three Containers
• WordPress Base Container
• WordPress CLI Container
• Nginx container
• WordPress Site Container (Primary)
20
Layered Diagram Here
Php:fpm Image
wp-base
wp-cli
wp-nginx
wp-site
Each layer inherits
from the image above
Primary container
Smaller layers == faster
deployments
WordPress Base Container
• Depends on php:fpm (FastCGI Process Manage)
• Installs PHP extensions and makes php settings
• Downloads WordPress version (e.g. 5.2.x)
• Unpacks WordPress and sets file permission
• Sets up Docker env variables
• WORDPRESS_DB_NAME, USER, PASSWORD, HOST
• WP_DEBUG settings
22
Dockerfile: Base Container
ENV WORDPRESS_VERSION 5.2.3
ENV WORDPRESS_SHA1 5efd37148788f3b14b295b2a9bf48a1a467aa303
# upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress
RUN curl -o wordpress.tar.gz -SL https://wordpress.org/wordpress-$
{WORDPRESS_VERSION}.tar.gz 
&& echo "$WORDPRESS_SHA1 *wordpress.tar.gz" | sha1sum -c - 
&& tar -xzf wordpress.tar.gz -C /usr/src/ 
&& rm wordpress.tar.gz 
&& chown -R www-data:www-data /usr/src/wordpress
# extract wordpress on build
RUN tar cf - --one-file-system -C /usr/src/wordpress . | tar xf -
23
WordPress CLI Container
• Depends on WordPress base container
• Downloads current wpcli tool
• Sets file permissions for utility
24
WordPress Nginx Container
• Depends on wp-stateless-cli image
• Downloads nginx libraries
• Sets configurations for nginx
• Sets permissions to run nginx
25
Dockerfile: Nginx Container
# install nginx
RUN apt-get update && apt-get install -y nginx && rm -rf /var/lib/apt/lists/*
#########################################################################
#####################
# NGINX SETUP
#########################################################################
#####################
RUN rm -r /etc/nginx/sites-enabled/*
ADD default.conf /etc/nginx/sites-enabled/default.conf
ADD wordpress.conf /etc/nginx/global/wordpress.conf
ADD restrictions.conf /etc/nginx/global/restrictions.conf
26
WordPress Site Container
• Depends on wp-stateless-nginx image
• Sets memory, upload_max_filesize, etc
• Adds default and custom plugins to image
• Adds custom theme to image
27
Dockerfile: Site Container
RUN /plugins.sh /plugins/base
RUN /plugins.sh /plugins/security
# Delete Plugins script and plugin installation folder
RUN rm /plugins.sh && rm /plugins -r
# ADD OWN CUSTOM PLUGINS
ADD ./plugins/my-plugin /var/www/html/wp-content/plugins/my-plugin
##############################################################################################
# WORDPRESS Divid Theme Setup
##############################################################################################
COPY ./themes/Divi.zip /var/www/html/wp-content/themes
RUN unzip /var/www/html/wp-content/themes/Divi.zip -d /var/www/html/wp-content/themes 
&& chown -R www-data:www-data /var/www/html/wp-content/themes 
&& rm /var/www/html/wp-content/themes/Divi.zip
28
Developer Process
• Works with local wp-stateless-site repo
• Mounts local volume for development
• my-plugin directory
• my-theme directory
• Tests locally
• Commits changes into develop branch
• Push changes to remote Git server
29
Build Process
• Jenkins polls for repo changes
• Runs the build for wp-stateless-site
• Adds plugins
• Adds themes
• Pushes images to docker hub
• Pipeline runs script to deploy to test environment
• Runs automated selenium tests
30
Developer/Designer Workflow
Team Workflow
Docker Compose Deployment
Continuous
Integration/
Delivery/
Deployment
CI/CD Definitions
• Continuous Integration:
• Executes Build
• Runs unit and integration tests
• Continuous Delivery
• Insure software ready for deployment
• Tags artifacts
• Pushes to artifact repository (e.g. docker hub)
• Continuous Deployment (after all tests pass)
• Automated deployment of software to production
35
Continuous Integration and Continuous Delivery
Deployment Pipeline
• Jenkins polls for repo changes
• Runs the build for wp-stateless-site
• Adds plugins
• Adds themes
• Pushes images to docker hub
• Pipeline runs script to deploy to test environment
• Runs automated selenium tests
37
Improving WordPress Development and Deployments with Docker
Blue/Green Deployments
• Blue environment is live
• Push new deployment to Green env
• Test Green environment
• Deployment verified switch to Green
• No downtime for customers
Blue/Green Deployment with No Downtime
Challenges
Stateless Vs Traditional
1. Image is ephemeral/immutable
(doesn’t change)
2. Software is built and deployed
3. All environments have exactly
same software
4. Production is not a testing
environment
42
1. Setup repeated for each
environment
2. Differences between
environments
3. Production is a testing
environment
Stateless WP Traditional WP
WordPress Development Evolution
• WordPress Headless CMS
• Gutenberg Blocks
• ReactJS
• More integration requires standardized
build and deployments
Database Persistence
• Containers should be ephemeral
• Databases are persistent and changing
• Docker volumes can work
• Recommended: Use DB services outside
of containers
K8s Deployment (Future)
Summary
Containers: Pros and Cons
• Pros
• Docker can improve WordPress Development and
Deployments
• Docker can help improve security
• Cons
• Lose some production flexibility
• Solution is not trivial
References
• WordPress Security Concerns
• https://sucuri.net/reports/2018-hacked-website-report/
• Docker Images
• https://cloud.docker.com/u/brettgpalmer/repository/
list
• Original Idea from Michael Haessig (2017)
• https://github.com/michaelhaessig/wordpress-
stateless
Technology References
• Jenkins CI
• https://hub.docker.com/_/jenkins/
• https://jenkins.io/
• CircleCI: https://circleci.com
• Travis CI:  https://travis-ci.com/
Technology References
• Docker/Docker Compose
• Kubernetes: https://kubernetes.io/docs/
home/
• php-fpm: https://php-fpm.org/
• Book: Continuous Delivery by Jez Humble &
David Farley
Q&A
CONTACT INFO
Brett G. Palmer
Email: bpalmer@palmersoftware.com
Twitter: @brettgpalmer
LinkedIn: brettgpalmer
• Meetups: DevOpsUT, Ionic, Tech Startups
• Skiing Favorites: Solitude, Snowbird,
anywhere
• Downtown SLC (M-Th) or Utah County

More Related Content

What's hot (20)

PDF
Docker Registry V2
Docker, Inc.
 
PDF
DCSF19 Container Security: Theory & Practice at Netflix
Docker, Inc.
 
PDF
JUC Europe 2015: Scaling Your Jenkins Master with Docker
CloudBees
 
PDF
Developer Experience Cloud Native - Become Efficient and Achieve Parity
Michael Hofmann
 
PDF
Neues aus dem Docker-Universum
Nicholas Dille
 
PDF
DCSF 19 Modernizing Insurance with Docker Enterprise: The Physicians Mutual ...
Docker, Inc.
 
PPTX
How Docker simplifies CI/CD
Gabriel N. Schenker
 
PDF
DevOPS training - Day 2/2
Vincent Mercier
 
PDF
Shipping NodeJS with Docker and CoreOS
Ross Kukulinski
 
PDF
DockerCon SF 2015: Docker in the New York Times Newsroom
Docker, Inc.
 
PDF
Persistent storage tailored for containers
Docker, Inc.
 
PDF
Node.js Rocks in Docker for Dev and Ops
Bret Fisher
 
PPTX
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
Docker, Inc.
 
PPTX
SD DevOps Meet-up - Jenkins 2.0 and Pipeline-as-Code
Brian Dawson
 
ODP
Practical Container Security by Mrunal Patel and Thomas Cameron, Red Hat
Docker, Inc.
 
PDF
Docker Registry + Basic Auth
Remotty
 
PPTX
Automated Deployment Pipeline using Jenkins, Puppet, Mcollective and AWS
Bamdad Dashtban
 
PPTX
Docker Meetup 08 03-2016
Docker
 
PDF
Using Docker for Testing
Mukta Aphale
 
PDF
Drone CI
Thomas Boerger
 
Docker Registry V2
Docker, Inc.
 
DCSF19 Container Security: Theory & Practice at Netflix
Docker, Inc.
 
JUC Europe 2015: Scaling Your Jenkins Master with Docker
CloudBees
 
Developer Experience Cloud Native - Become Efficient and Achieve Parity
Michael Hofmann
 
Neues aus dem Docker-Universum
Nicholas Dille
 
DCSF 19 Modernizing Insurance with Docker Enterprise: The Physicians Mutual ...
Docker, Inc.
 
How Docker simplifies CI/CD
Gabriel N. Schenker
 
DevOPS training - Day 2/2
Vincent Mercier
 
Shipping NodeJS with Docker and CoreOS
Ross Kukulinski
 
DockerCon SF 2015: Docker in the New York Times Newsroom
Docker, Inc.
 
Persistent storage tailored for containers
Docker, Inc.
 
Node.js Rocks in Docker for Dev and Ops
Bret Fisher
 
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
Docker, Inc.
 
SD DevOps Meet-up - Jenkins 2.0 and Pipeline-as-Code
Brian Dawson
 
Practical Container Security by Mrunal Patel and Thomas Cameron, Red Hat
Docker, Inc.
 
Docker Registry + Basic Auth
Remotty
 
Automated Deployment Pipeline using Jenkins, Puppet, Mcollective and AWS
Bamdad Dashtban
 
Docker Meetup 08 03-2016
Docker
 
Using Docker for Testing
Mukta Aphale
 
Drone CI
Thomas Boerger
 

Similar to Improving WordPress Development and Deployments with Docker (20)

PDF
A Tale of 2 Systems
David Newman
 
PPTX
The challenge of application distribution - Introduction to Docker (2014 dec ...
Sébastien Portebois
 
PDF
Word press and containers
wcto2017
 
PDF
Container Days
Patrick Mizer
 
PDF
ContainerDays NYC 2015: "Easing Your Way Into Docker: Lessons From a Journey ...
DynamicInfraDays
 
PPTX
Docker 101 - High level introduction to docker
Dr Ganesh Iyer
 
PPTX
Docker Meetup Paris: enterprise Docker
Arnaud MAZIN
 
PPTX
Java developer intro to environment management with vagrant puppet and docker
Getting value from IoT, Integration and Data Analytics
 
PPTX
Java Developer Intro to Environment Management with Vagrant, Puppet, and Dock...
Lucas Jellema
 
PDF
Faster and Easier Software Development using Docker Platform
msyukor
 
PPTX
OpenStack Boston
Docker, Inc.
 
PPTX
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
E. Camden Fisher
 
PPTX
Docker open stack boston
dotCloud
 
PPTX
The Future of Web Application Architectures
Lucas Carlson
 
PDF
Docker Containers Deep Dive
Will Kinard
 
PDF
Introduction to Containers
Dharmit Shah
 
PDF
Containers, microservices and serverless for realists
Karthik Gaekwad
 
PDF
Docker in Production: How RightScale Delivers Cloud Applications
RightScale
 
PDF
Word press, the automated way
Michaël Perrin
 
PDF
Docker and OpenStack Boston Meetup
Kamesh Pemmaraju
 
A Tale of 2 Systems
David Newman
 
The challenge of application distribution - Introduction to Docker (2014 dec ...
Sébastien Portebois
 
Word press and containers
wcto2017
 
Container Days
Patrick Mizer
 
ContainerDays NYC 2015: "Easing Your Way Into Docker: Lessons From a Journey ...
DynamicInfraDays
 
Docker 101 - High level introduction to docker
Dr Ganesh Iyer
 
Docker Meetup Paris: enterprise Docker
Arnaud MAZIN
 
Java developer intro to environment management with vagrant puppet and docker
Getting value from IoT, Integration and Data Analytics
 
Java Developer Intro to Environment Management with Vagrant, Puppet, and Dock...
Lucas Jellema
 
Faster and Easier Software Development using Docker Platform
msyukor
 
OpenStack Boston
Docker, Inc.
 
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
E. Camden Fisher
 
Docker open stack boston
dotCloud
 
The Future of Web Application Architectures
Lucas Carlson
 
Docker Containers Deep Dive
Will Kinard
 
Introduction to Containers
Dharmit Shah
 
Containers, microservices and serverless for realists
Karthik Gaekwad
 
Docker in Production: How RightScale Delivers Cloud Applications
RightScale
 
Word press, the automated way
Michaël Perrin
 
Docker and OpenStack Boston Meetup
Kamesh Pemmaraju
 
Ad

Recently uploaded (20)

PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
July Patch Tuesday
Ivanti
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Ad

Improving WordPress Development and Deployments with Docker

  • 1. IMPROVING WORDPRESS DEVELOPMENT AND DEPLOYMENTS WITH DOCKER AND CI/CD Brett G. Palmer Twitter: @brettgpalmer LinkedIn: brettgpalmer
  • 3. Career Background • Independent Software Developer & Entrepreneur • Promoting open source and technology • Currently: Contractor for State of Utah - DTS/DWS • Helping Migrate to Open Source Eligibility System • WordPress Development last 7 years • Organizer for SLC DevOps Days and DevOpsUT Meetup 3
  • 4. Development Interests • Enterprise Java Development - Spring Cloud • Mobile Development • Ionic Mobile Framework • Chatbots for Alexa, Google Home, FB Messenger • WordPress REST API integration • WordPress Hosting and Deployments 4
  • 5. Current Tech Interests • Entrepreneur helping small businesses • Mobile business apps • Website hosting • Software Recruiter • Helping developers gain their independence • Development training • Programming, DevOps, Testing 5
  • 9. WordPress Security Concerns • Sucuri 2018 Reports • 90% CMS sites were WordPress • Under 5% for Magento, Joomla, Drupal, etc • Enterprises avoid adopting WordPress • Frequently affects small businesses 9
  • 10. Common Reasons for Hacks • Outdated WordPress Installs • Unprotected Access to WordPress Admin • Insecure/outdated plugins or themes • Incorrect File Permissions 10
  • 11. WordPress Deployment Errors • Manual steps from testing to production • Frequent errors with deployments • “Works on my machine” syndrome 11
  • 13. Docker Containers Intro • Standard unit of software • Packages code and dependencies together • Minimal amount necessary to run • Run quickly and reliably • Containers are ephemeral (disposable) • Pets vs Cattle
  • 16. How Containers Can Help • WordPress updates are easier and more frequent • Consistent deployments to Dev, Test, and Prod • Lock down plugins and themes • Containers are ephemeral (short lasting) - any changes to running container are temporary. 16
  • 18. The Approach • Create consistent WordPress environment • Dev, Test, and Prod • Started 2 years ago and evolved as needed • Many ways to solve the same problem • More WP containers available today 18
  • 19. Technologies Used • Docker: creates WordPress containers • Docker Compose: integrates dependent services • Nginx: Reverse proxy and TLS/SSL certificates hosting • WordPress Site Container (Primary) • WP Offload Media Light Amazon S3 and Cloudfront • MySQL Database • PhpMyAdmin container (development only) • Kubernetes (future deployments) 19
  • 20. Solution: Three Containers • WordPress Base Container • WordPress CLI Container • Nginx container • WordPress Site Container (Primary) 20
  • 21. Layered Diagram Here Php:fpm Image wp-base wp-cli wp-nginx wp-site Each layer inherits from the image above Primary container Smaller layers == faster deployments
  • 22. WordPress Base Container • Depends on php:fpm (FastCGI Process Manage) • Installs PHP extensions and makes php settings • Downloads WordPress version (e.g. 5.2.x) • Unpacks WordPress and sets file permission • Sets up Docker env variables • WORDPRESS_DB_NAME, USER, PASSWORD, HOST • WP_DEBUG settings 22
  • 23. Dockerfile: Base Container ENV WORDPRESS_VERSION 5.2.3 ENV WORDPRESS_SHA1 5efd37148788f3b14b295b2a9bf48a1a467aa303 # upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress RUN curl -o wordpress.tar.gz -SL https://wordpress.org/wordpress-$ {WORDPRESS_VERSION}.tar.gz && echo "$WORDPRESS_SHA1 *wordpress.tar.gz" | sha1sum -c - && tar -xzf wordpress.tar.gz -C /usr/src/ && rm wordpress.tar.gz && chown -R www-data:www-data /usr/src/wordpress # extract wordpress on build RUN tar cf - --one-file-system -C /usr/src/wordpress . | tar xf - 23
  • 24. WordPress CLI Container • Depends on WordPress base container • Downloads current wpcli tool • Sets file permissions for utility 24
  • 25. WordPress Nginx Container • Depends on wp-stateless-cli image • Downloads nginx libraries • Sets configurations for nginx • Sets permissions to run nginx 25
  • 26. Dockerfile: Nginx Container # install nginx RUN apt-get update && apt-get install -y nginx && rm -rf /var/lib/apt/lists/* ######################################################################### ##################### # NGINX SETUP ######################################################################### ##################### RUN rm -r /etc/nginx/sites-enabled/* ADD default.conf /etc/nginx/sites-enabled/default.conf ADD wordpress.conf /etc/nginx/global/wordpress.conf ADD restrictions.conf /etc/nginx/global/restrictions.conf 26
  • 27. WordPress Site Container • Depends on wp-stateless-nginx image • Sets memory, upload_max_filesize, etc • Adds default and custom plugins to image • Adds custom theme to image 27
  • 28. Dockerfile: Site Container RUN /plugins.sh /plugins/base RUN /plugins.sh /plugins/security # Delete Plugins script and plugin installation folder RUN rm /plugins.sh && rm /plugins -r # ADD OWN CUSTOM PLUGINS ADD ./plugins/my-plugin /var/www/html/wp-content/plugins/my-plugin ############################################################################################## # WORDPRESS Divid Theme Setup ############################################################################################## COPY ./themes/Divi.zip /var/www/html/wp-content/themes RUN unzip /var/www/html/wp-content/themes/Divi.zip -d /var/www/html/wp-content/themes && chown -R www-data:www-data /var/www/html/wp-content/themes && rm /var/www/html/wp-content/themes/Divi.zip 28
  • 29. Developer Process • Works with local wp-stateless-site repo • Mounts local volume for development • my-plugin directory • my-theme directory • Tests locally • Commits changes into develop branch • Push changes to remote Git server 29
  • 30. Build Process • Jenkins polls for repo changes • Runs the build for wp-stateless-site • Adds plugins • Adds themes • Pushes images to docker hub • Pipeline runs script to deploy to test environment • Runs automated selenium tests 30
  • 35. CI/CD Definitions • Continuous Integration: • Executes Build • Runs unit and integration tests • Continuous Delivery • Insure software ready for deployment • Tags artifacts • Pushes to artifact repository (e.g. docker hub) • Continuous Deployment (after all tests pass) • Automated deployment of software to production 35
  • 36. Continuous Integration and Continuous Delivery
  • 37. Deployment Pipeline • Jenkins polls for repo changes • Runs the build for wp-stateless-site • Adds plugins • Adds themes • Pushes images to docker hub • Pipeline runs script to deploy to test environment • Runs automated selenium tests 37
  • 39. Blue/Green Deployments • Blue environment is live • Push new deployment to Green env • Test Green environment • Deployment verified switch to Green • No downtime for customers
  • 42. Stateless Vs Traditional 1. Image is ephemeral/immutable (doesn’t change) 2. Software is built and deployed 3. All environments have exactly same software 4. Production is not a testing environment 42 1. Setup repeated for each environment 2. Differences between environments 3. Production is a testing environment Stateless WP Traditional WP
  • 43. WordPress Development Evolution • WordPress Headless CMS • Gutenberg Blocks • ReactJS • More integration requires standardized build and deployments
  • 44. Database Persistence • Containers should be ephemeral • Databases are persistent and changing • Docker volumes can work • Recommended: Use DB services outside of containers
  • 47. Containers: Pros and Cons • Pros • Docker can improve WordPress Development and Deployments • Docker can help improve security • Cons • Lose some production flexibility • Solution is not trivial
  • 48. References • WordPress Security Concerns • https://sucuri.net/reports/2018-hacked-website-report/ • Docker Images • https://cloud.docker.com/u/brettgpalmer/repository/ list • Original Idea from Michael Haessig (2017) • https://github.com/michaelhaessig/wordpress- stateless
  • 49. Technology References • Jenkins CI • https://hub.docker.com/_/jenkins/ • https://jenkins.io/ • CircleCI: https://circleci.com • Travis CI:  https://travis-ci.com/
  • 50. Technology References • Docker/Docker Compose • Kubernetes: https://kubernetes.io/docs/ home/ • php-fpm: https://php-fpm.org/ • Book: Continuous Delivery by Jez Humble & David Farley
  • 51. Q&A
  • 52. CONTACT INFO Brett G. Palmer Email: [email protected] Twitter: @brettgpalmer LinkedIn: brettgpalmer • Meetups: DevOpsUT, Ionic, Tech Startups • Skiing Favorites: Solitude, Snowbird, anywhere • Downtown SLC (M-Th) or Utah County