WordPress with Mina Automated Deployment Solution Jonathan Gravato

  • Slides: 10
Download presentation
Wordpress with Mina Automated Deployment Solution Jonathan Gravato DIG 4104 c

Wordpress with Mina Automated Deployment Solution Jonathan Gravato DIG 4104 c

What is Mina? p p p Ruby gem Fast deployer and server automation tool

What is Mina? p p p Ruby gem Fast deployer and server automation tool Creates Mina tasks (shell script) preset to n n p p Create new directory Make symbolic to common resources Point public directory to new directory Clean up old data Uploads to server & executes from local Requires n n n SSH connection Git repository Permission to change server config.

Alternatives p Capistrano n n n p Remote server automation tool Heavy on Ruby/Rails

Alternatives p Capistrano n n n p Remote server automation tool Heavy on Ruby/Rails related features Large learning curve p Capistrano Vlad n Similar to Mina p Vlad the Deployer

What’s the difference? p Capistrano and Vlad n p Each command run separately on

What’s the difference? p Capistrano and Vlad n p Each command run separately on their own SSH sessions Mina n Entire procedure generated as remote run Bash script p p Only one SSH session created for whole shell Reduces SSH connection overhead Mina should be faster to deploy Requires less Ruby knowledge to implement.

Why Automated Deployment? p p p Saves time Minimizes downtime during deployment Reduces human

Why Automated Deployment? p p p Saves time Minimizes downtime during deployment Reduces human mistakes n n p p Missing files Uploading wrong files Shared between multiple developers in a team Usually tied to source code control system

Why Automated Deployment? p Deploying with Git Hooks? n n n p Git generates

Why Automated Deployment? p Deploying with Git Hooks? n n n p Git generates URL in reference to PHP script to perform tasks Hole exposed due to URL can be used to deploy files manually using PHP Cleanup, roll back and lock cmds need to be created n All tasks handled in a simple Rake file tutorial link Mina task example

Case Study: Knights Capital p Lost $172, 000+ per second for 45 minutes n

Case Study: Knights Capital p Lost $172, 000+ per second for 45 minutes n n p p Went bankrupt in 2012 due to failed deployment and cleanup procedures New code deployed to 7 of 8 servers New deploy did not remove old code 8 th server utilized old code n p 2700 seconds in 45 minutes $465 million loss errors prompted warning messages to developers but were ignored No one reviewed deployment records

Steps for Deploying with Mina 1. Prepare Server Layout n n n New three

Steps for Deploying with Mina 1. Prepare Server Layout n n n New three directory layout required for Mina (example) Releases, Shared and Current directories created Change Document Root to point to current directory p 2. Install Mina n 3. Location of symlink which references newest version and shared files $ gem install mina Setup Mina with Wordpress n n Git repository with Wordpress source code Generate config/deploy. rb shell script p p p Cleanup unnecessary lines of code Configure server/login info Configure Setup, Deploy and Rollback task

Steps for Deploying with Mina p p SSH to server Create new directory featuring

Steps for Deploying with Mina p p SSH to server Create new directory featuring your domain (root access) Set ownership of new directory to user (vs server) Create Mina directory structure on local machine n p Deploy current release (version) of code n n p $ mina setup Update code Commit change Push to repo $ mina deploy To roll back n $ mina rollback

Questions 1. What is Mina? n 2. What is a Rake file? n 3.

Questions 1. What is Mina? n 2. What is a Rake file? n 3. Deployer & server automation tool that uses a shell script to handle tasks. A rake file is the shell script which holds tasks or blocks of code to be run in Ruby. What is one benefit to using automated deployment? Explain this benefit. n n More secure Saves time Minimizes downtime Reduces human mistakes