Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Deploy your code using version control and continuous integration
PRODUCTION-READY WORDPRESS
• Presenter
• Front End Developer
• Senior Sales Engineer - WP Engine
• Music Technology
Edmund Turbin
@spicecadet
Production
Ready Wordpress
Contents
The Problem
The Solution
The Script
Demonstration
Learnings
Deployment, version contro...
The Problem
Deploy your
site
• Manage the way code is deployed
• Automate repetitive tasks for devs, admins when changes
go live
• Mak...
The Solution
The Solution
• Develop Locally
• Distributed Version Control
• Don’t keep plugins and WP core in repository
• Deploy to te...
Continuous
Integration
• Multiple developers share code
• Several pushes per day
• Each push verified by automated build
• ...
Workflow
• Local Development
• Central Version Control
• Continuous Integration Pipelines
• Build Script
• Dependencies
• ...
Version
Control
Repo
Workflow
Install
&
Build
Repo Deps Push
Deployment
Initial Setup
Setup
Clone
Repo
Install
Apps
Configure
Env
Build
Build
Build ConcatUglify
Compile
Sass/Less
JS Lint
Dependencies
Dependencies PluginsWPackagist
Testing
Test
Automated
Testing
Tools
Theme
Local
Development
Build
Collaboration/
VCS
Dependencies
Continuous
Integration Tool
Continuous
Integration Tool
Continuous
Integration Tool
Continuous
Integration Tool
Continuous
Integration Tool
Automated
Testing
Automated
Testing
The Script
#	Set	Constants	
INSTALL="edmund"	
EMAIL="edmund.turbin@wpengine.com"	
ENVIRONMENT=“production"	
#	Use	Node	8.7.0	
nvm	use...
#	Codeship	project	root	is	the	~/clone	directory	
cd	~/clone	
#	Set	production	remote	and	config	
git	config	--global	user...
#	Run	Composer	to	install	dependencies	
cd	wp-content/themes/sage	
composer	install	--prefer-source	—no-interaction	
#	Run...
#	Remove	unnecessary	files	
rm	-rf	vendor/	
rm	~/clone/.gitignore	
git	rm	~/clone/.gitignore	
#	Git	Commit	and	Push	
git	a...
#	Assertible	Tests	
curl	-u	DLI7uFTdkcpfcXdQ:	"https://assertible.com/deployments"	-d'{	
				"service":	"43994ec7-41e0-4d7...
DemonstratioN
Learnings
Codeship
• Uses a virtual machine at time of deploy
• Has many common binaries installed, possible to install more
• Cache...
Git Integration
• Understanding how to move files from Codeship was
difficult
• A few different attempts to make this happen...
Build
• Gulp, Grunt, Webpack.js, etc. can all be run during
deployment
• Local development can use it’s own build script
•...
Next Steps
• Do more testing with Assertible 😁
• Remove all source files and unnecessary files like readme 😎
• Create automa...
Reference
Team Collaboration with Github
7 Easy Steps to Continuous Deployment
Optimize Local Development
Codeship Deploym...
Questions
@spicecadet
edmund.turbin@wpengine.com
Production Ready WordPress  - WC Utrecht 2017
You’ve finished this document.
Download and read it offline.
Upcoming SlideShare
What to Upload to SlideShare
Next
Upcoming SlideShare
What to Upload to SlideShare
Next
Download to read offline and view in fullscreen.

Share

Production Ready WordPress - WC Utrecht 2017

Download to read offline

Presentation slides from my talk at WordCamp Utrecht November 2017

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Production Ready WordPress - WC Utrecht 2017

  1. 1. Deploy your code using version control and continuous integration PRODUCTION-READY WORDPRESS
  2. 2. • Presenter • Front End Developer • Senior Sales Engineer - WP Engine • Music Technology Edmund Turbin @spicecadet
  3. 3. Production Ready Wordpress Contents The Problem The Solution The Script Demonstration Learnings Deployment, version control and continuous integration
  4. 4. The Problem
  5. 5. Deploy your site • Manage the way code is deployed • Automate repetitive tasks for devs, admins when changes go live • Make it easy to use best practices • Allow for flexibility, multiple deploy processes, safe testing
  6. 6. The Solution
  7. 7. The Solution • Develop Locally • Distributed Version Control • Don’t keep plugins and WP core in repository • Deploy to testing environment prior to production • Automate build and testing
  8. 8. Continuous Integration • Multiple developers share code • Several pushes per day • Each push verified by automated build • Avoids “integration hell” • Teams can detect problems early
  9. 9. Workflow • Local Development • Central Version Control • Continuous Integration Pipelines • Build Script • Dependencies • Push to server
  10. 10. Version Control Repo
  11. 11. Workflow Install & Build Repo Deps Push Deployment
  12. 12. Initial Setup Setup Clone Repo Install Apps Configure Env Build
  13. 13. Build Build ConcatUglify Compile Sass/Less JS Lint
  14. 14. Dependencies Dependencies PluginsWPackagist
  15. 15. Testing Test Automated Testing
  16. 16. Tools
  17. 17. Theme
  18. 18. Local Development
  19. 19. Build
  20. 20. Collaboration/ VCS
  21. 21. Dependencies
  22. 22. Continuous Integration Tool
  23. 23. Continuous Integration Tool
  24. 24. Continuous Integration Tool
  25. 25. Continuous Integration Tool
  26. 26. Continuous Integration Tool
  27. 27. Automated Testing
  28. 28. Automated Testing
  29. 29. The Script
  30. 30. # Set Constants INSTALL="edmund" EMAIL="edmund.turbin@wpengine.com" ENVIRONMENT=“production" # Use Node 8.7.0 nvm use stable # Disable Xdebug rm -f /home/rof/.phpenv/versions/$(phpenv version-name)/etc/conf.d/ xdebug.ini
  31. 31. # Codeship project root is the ~/clone directory cd ~/clone # Set production remote and config git config --global user.name "Codeship Deploy" git config --global user.email "$EMAIL" git remote add $ENVIRONMENT git@git.wpengine.com:$ENVIRONMENT/ $INSTALL.git # Unset shallow fetch and fetch origin git fetch --unshallow || true // not all versions of each file git fetch origin "+refs/heads/*:refs/remotes/origin/*"
  32. 32. # Run Composer to install dependencies cd wp-content/themes/sage composer install --prefer-source —no-interaction # Run build tasks npm install bower install gulp —production
  33. 33. # Remove unnecessary files rm -rf vendor/ rm ~/clone/.gitignore git rm ~/clone/.gitignore # Git Commit and Push git add --all git commit -m "Codeship Deployment" git push $ENVIRONMENT HEAD:master --force
  34. 34. # Assertible Tests curl -u DLI7uFTdkcpfcXdQ: "https://assertible.com/deployments" -d'{ "service": "43994ec7-41e0-4d7f-9155-6945816333f1", "environmentName": "production", "version": "v1" }'
  35. 35. DemonstratioN
  36. 36. Learnings
  37. 37. Codeship • Uses a virtual machine at time of deploy • Has many common binaries installed, possible to install more • Caches NPM packages • Can be used in Debug mode which allows you to SSH into the virtual machine and run commands until happy
  38. 38. Git Integration • Understanding how to move files from Codeship was difficult • A few different attempts to make this happen • Possible to use FTP, but Git is more streamlined and quicker • git push — force option important - not all files in the repo are needed in production
  39. 39. Build • Gulp, Grunt, Webpack.js, etc. can all be run during deployment • Local development can use it’s own build script • Possible to use different tasks or build scripts for each branch • Allows for release management - deploy different branches to their own server environments (stage, test, production)
  40. 40. Next Steps • Do more testing with Assertible 😁 • Remove all source files and unnecessary files like readme 😎 • Create automated rollback functionality 😵 • Wishlist: Visual Regression Testing with NPM/Wraith, Backstop.js 👊
  41. 41. Reference Team Collaboration with Github 7 Easy Steps to Continuous Deployment Optimize Local Development Codeship Deployment Script Post Deployment Smoke-Testing with Assertive
  42. 42. Questions @spicecadet edmund.turbin@wpengine.com
  • ThomasGHenry

    May. 2, 2019
  • Chathu_Vishwajith

    Dec. 8, 2017

Presentation slides from my talk at WordCamp Utrecht November 2017

Views

Total views

1,103

On Slideshare

0

From embeds

0

Number of embeds

9

Actions

Downloads

2

Shares

0

Comments

0

Likes

2

×