MANAGE AND DEPLOY YOUR SITES WITH DRUSH



Similar documents
Simple and powerful site deployment with capistrano

How To Manage Change In Jeepers

Drupal Drush Guide. Drupal.org

Zero-Touch Drupal Deployment

DevShop. Drupal Infrastructure in a Box. Jon Pugh CEO, Founder ThinkDrop Consulting Brooklyn NY

Streamline your drupal development workflow in a 3-tier-environment - A story about drush make and drush aliases

Putting It All Together. Vagrant Drush Version Control

Git - Working with Remote Repositories

Practicing Continuous Delivery using Hudson. Winston Prakash Oracle Corporation

DEPLOYING DRUPAL USING CAPISTRANO

Practical continuous deployment

Drush Documentation. Release 7.0.0

AVOIDING THE GIT OF DESPAIR

Taking Drupal development to the Cloud. Karel Bemelmans

How To Manage A Multi Site In Drupal

Hosting Drupal on Amazon Web Services (AWS) Heather Wozniak, Ph.D. Web Developer, UW College of Arts & Sciences hwozniak@uw.edu

Achieving Continuous Integration with Drupal

Drupal for Designers

MATLAB & Git Versioning: The Very Basics

CPSC 491. Today: Source code control. Source Code (Version) Control. Exercise: g., no git, subversion, cvs, etc.)

jenkins, drupal & testing automating every phing! miggle

Continuous Delivery by example.net

Fundamentals of Continuous Integration

A Git Development Environment

ABRAHAM ARCHITECTURE OF A CLOUD SERVICE USING PYTHON TECHNOLOGIES

StriderCD Book. Release 1.4. Niall O Higgins

Introduction to Git. Markus Kötter Notes. Leinelab Workshop July 28, 2015

Benchmarking filesystems and PostgreSQL shared buffers

Module developer s tutorial

FEEG Applied Programming 3 - Version Control and Git II

DevOoops Increase awareness around DevOps infra security. Gianluca

SETTING UP A LAMP SERVER REMOTELY

EZcast Installation guide

DRUPAL CONTINUOUS INTEGRATION. Part I - Introduction

Using DevOps Tools to Achieve Continuous Integration

Hail or Fail: The Right Way. to Override Core. Mark Shust ecommerce Developer Metrics Marketing

Auditing Drupal sites for performance, content and optimal configuration

MOOSE-Based Application Development on GitLab

Application Release Automation (ARA) Vs. Continuous Delivery

Drupal CMS for marketing sites

Continuous Integration and Delivery. manage development build deploy / release

Continuous Integration and Delivery at NSIDC

Backing Up Your System With rsnapshot

Site Audit ( /site_audit) Generated on Fri, 22 Aug :14:

Automating Big Data Benchmarking for Different Architectures with ALOJA

Upgrade your Software

Incremental Backup Script. Jason Healy, Director of Networks and Systems

How To Fix A Bug In Drupal 8.Dev

Symfony2 and Drupal. Why to talk about Symfony2 framework?

Red Hat System Administration 1(RH124) is Designed for IT Professionals who are new to Linux.

Agile Delivery Framework Automation & Deployment With Puppet

Introduction to the Git Version Control System

Building a Continuous Integration Pipeline with Docker

Building Library Website using Drupal

Dry Dock Documentation

Working with Docker on Microsoft Azure

Setting up a local working copy with SVN, MAMP and rsync. Agentic

Running Nginx as Reverse Proxy server

Installation Guide for AmiRNA and WMD3 Release 3.1

Using Toaster in a Production Environment

Talk Internet User Guides Controlgate Administrative User Guide

DevKey Documentation. Release 0.1. Colm O Connor

Plesk Panel HEAnet Customer Guide

OpenMake Dynamic DevOps Suite 7.5 Road Map. Feature review for Mojo, Meister, CloudBuilder and Deploy+

Improving your Drupal Development workflow with Continuous Integration

BACKUP YOUR SENSITIVE DATA WITH BACKUP- MANAGER

How to set up SQL Source Control. The short guide for evaluators

Desktop Central Managing Windows Computers in WAN

Using Git for Centralized and Distributed Version Control Workflows - Day 3. 1 April, 2016 Presenter: Brian Vanderwende

by

Installing an open source version of MateCat

Building an audio player using the Texas Instruments OMAP-L137

Git Basics. Christopher Simpkins Chris Simpkins (Georgia Tech) CS 2340 Objects and Design CS / 22

Version Control. Version Control

TestOps: Continuous Integration when infrastructure is the product. Barry Jaspan Senior Architect, Acquia Inc.

Configuration Management in Drupal 8. Andrea Pescetti Nuvole

Version control. with git and GitHub. Karl Broman. Biostatistics & Medical Informatics, UW Madison

Content Management System

My review of Webfaction

Introducing MachPanel v.5

In depth study - Dev teams tooling

Connectivity using ssh, rsync & vsftpd

Penetration Testing Report Client: Business Solutions June 15 th 2015

EZcast technical documentation

Universal Management Service 2015

Source Control Systems

Understanding Code Management in a Multi-Vendor Environment. Examples of code management in a multi-team environment

Using GitHub for Rally Apps (Mac Version)

Transcription:

MANAGE AND DEPLOY YOUR SITES WITH DRUSH BASTIAN WIDMER @DASRECHT DEVOPS TRACK

Who are you? Bastian Widmer @dasrecht Switzerland DevOps Track Chair Fuck it we do it live -Ops

Agenda 1 Introduction 2 Where we are today? 3 Where we want to go! 4 Putting it together 5 What about Drupal 8?

Where we are today 3rd party deployment frameworks (e.g. capistrano, idephix) Deployment Strategies rsync custom bash scripts (known as duct tape deployment) ftp upload git pull (and pray)

drush-deploy Main Maintainer Mark Sonnabaum (msonnabaum) inspired by capistrano Not much movement Supports GIT and needs PHP 5.3 at least

Cluster SSH, anyone? the DevOps way to kill 5 servers with one keystroke

Where we want to go! Deploying with a tool we know at heart : DRUSH Multi Server Deployments Running Tasks Git Remote cache - Speed! Possibility to rollback a release

Where we want to go! Deploying with a tool we know at heart : DRUSH Multi Server Deployments Running Tasks More Automation leaves less room to human error Git Remote cache Possibility to rollback a release

Look at your future deployment

Look at your future deployment

Yeeeeeehaw!

Power to the team!

Now, back to me Putting the parts together, shall we?

Parts 1 Installing Drush Deploy 2 Drush Aliases 3 Drush Deploy Configuration 4 The first deployment

Installing drush-deploy cd ~/.drush git clone --branch 7.x-1.x http://git.drupal.org/ project/drush_deploy.git drush cc drush

Now getting your Drupal site ready

Standardisation! Cleanup your environments Establish standards for Configurations (e.g. settings.local.php) File paths (/sites/defaults/files) Webroot paths

settings.php 1 $local_settings_filename = dirname( FILE ). DIRECTORY_SEPARATOR. 'settings.local.php';! 2 if (file_exists($local_settings_filename)) {! 3 require_once $local_settings_filename;! 4 }

settings.local.php Just the site related settings Better Overview

aliases.drushrc.php 1 <?php! 2 $aliases['web1'] = array(! 3 'root' => '/var/www/drupal',! 4 'remote-user' => 'www-data',! 5 'remote-host' => 'web1.example.com',! 6 );! 7 $aliases['web2'] = $aliases['web1'];! 8 $aliases['web2']['remote-host'] = 'web2.example.com';! 9?>!

aliases.drushrc.php 1 <?php! 2 $aliases['web1'] = array(! 3 'root' => '/var/www/drupal',! 4 'remote-user' drush @web1 => 'www-data',! user-login 5 'remote-host' => 'web1.example.com',! 6 );! drush sql-sync @web1 default 7 $aliases['web2'] = $aliases['web1'];! 8 $aliases['web2']['remote-host'] = 'web2.example.com';! 9?>!

Drush Deploy Configuration

deploy.drushrc.php 1 <?php! 2 $options['application'] = 'drupal';! 3 $options['deploy-repository'] = 'git@github.com:amazeelabs/ new-site.git';! 4 $options['branch'] = "live";! 5 $options['keep-releases'] = 3;! 6 $options['deploy-via'] = 'RemoteCache';! 7 $options['docroot'] = '/var/www/drupal';! 8 $options['git_enable_submodules'] = TRUE;! 9?>!

deploy.drushrc.php 1 <?php! 2 $options['application'] = 'drupal';! 3 $options['deploy-repository'] = 'git@github.com:amazeelabs/ new-site.git';! 4 $options['branch'] = "live";! 5 $options['keep-releases'] = 3;! 6 $options['deploy-via'] = 'RemoteCache';! 7 $options['docroot'] = '/var/www/drupal';! 8 $options['git_enable_submodules'] = TRUE;! 9?>!

deploy.drushrc.php 1 <?php! 2 $options['application'] = 'drupal';! 3 $options['deploy-repository'] = 'git@github.com:amazeelabs/ new-site.git';! 4 $options['branch'] Adopt = a "live";! GIT Workflow 5 $options['keep-releases'] = 3;! 6 $options['deploy-via'] Git Flow : http://s.nrdy.ch/git-flow = 'RemoteCache';! 7 $options['docroot'] = '/var/www/drupal';! 8 $options['git_enable_submodules'] = TRUE;! 9?>!

Git Flow? One of many branching models Live and Dev Branch Feature Branches Hotfix Branches Live is A-L-W-A-Y-S deployable

deploy.drushrc.php 1 <?php! 2 $options['application'] = 'drupal';! 3 $options['deploy-repository'] = 'git@github.com:amazeelabs/ new-site.git';! 4 $options['branch'] = "live";! 5 $options['keep-releases'] = 3;! 6 $options['deploy-via'] = 'RemoteCache';! 7 $options['docroot'] = '/var/www/drupal';! 8 $options['git_enable_submodules'] = TRUE;! 9?>!

deploy.drushrc.php 1 <?php! 2 $options['application'] = 'drupal';! 3 $options['deploy-repository'] = 'git@github.com:amazeelabs/ new-site.git';! 4 $options['branch'] keep-releases = "live";! allows you 5 $options['keep-releases'] = 3;! 6 $options['deploy-via'] to roll back = to 'RemoteCache';! the last state 7 $options['docroot'] = '/var/www/drupal';! 8 $options['git_enable_submodules'] = TRUE;! 9?>!

deploy.drushrc.php 1 <?php! 2 $options['application'] = 'drupal';! 3 $options['deploy-repository'] = 'git@github.com:amazeelabs/ new-site.git';! 4 $options['branch'] = "live";! 5 $options['keep-releases'] = 3;! 6 $options['deploy-via'] = 'RemoteCache';! 7 $options['docroot'] = '/var/www/drupal';! 8 $options['git_enable_submodules'] = TRUE;! 9?>!

Filesystem Structure Prepare your server : drush deploy-setup @web1

Filesystem Structure Current Release Is a symlink to the latest release directory

Filesystem Structure Releases

Filesystem Structure Shared (Git Cache / Configuration)

Filesystem Structure Webroot (symlink to current)

drush deploy @web1 updates your remote cache initializes and updates git submodules creates a new release directory copies your current codebase to the release directory links the current directory with your new deployed code executes your tasks

drush deploy-rollback @web1 relinks the current directory with the last release removes the faulty release

Nice but what about drush deploy @live

aliases.drushrc.php Multi Server Deployments? Alias Lists! 10 $aliases['live'] = array(! 11 'site-list' => array('@web1', '@web2');! 12 ); http://drush.ws/examples/ example.aliases.drushrc.php

Automated aliases! aliases are built on the fly information about servers is stored in a json file server groups are built automatically

Automated aliases! 1 <?php! 2! 3 $sitename = 'CHANGEME';! 4! 5 // - DO NOT make changes below this Comment! 6! 7 // Basic error handling! 8 if($sitename == 'CHANGEME')! 9 die("[error] - Luke, you should change the Sitename in aliases.drushrc.php!\n );! 10! http://s.nrdy.ch/drush-aliases

Time to Implement?

Deployment Tasks Before or after moving to new version on one or all servers 1 $options['before']['deploy-symlink'][] = 'deploy_settings_php_task';! 2 /**! 3 * The task needs to be defined with a @task "decorator" in the comment block preceding it! 4 * @task! 5 */! 6 function deploy_settings_php_task($d) {! 7 $d->run("cp /home/nfs_share/www-data/`whoami`/settings.php ~/deploy/drupal/ shared/settings.php", $d->latest_release());! 8 }!

Deployment Tasks update and link settings.local.php link /sites/default/files drush updb drush cc all notify NewRelic about the deployment

Taking things further JUST the aliases file (1 weekend of work!) Not completely rolled out yet Complete Flexibility over server mappings (@live = server 1, 3, 5) in JSON

Missing Things I just want to update code - without running Tasks Adding ssh known hosts - connecting to Github on a new VHost

Breaking Things Drush changes - Discovery of *.drushrc.php files Drupal8 changes (less than beginning of the year) Perl Locale Warnings can ruin your day break the deployment APC anyone?

Breaking Things

Outlook Drupal 8 Configuration Management Initiative www.drupal8cmi.org Dealing with Configuration Files HEAD is still moving fast, so changes apply and deployment might not be as easy as with D7 Normal code deployments should work without running into any issues

Take Home You don t have to do all at once Automatic aliases files are awesome Cleanup your environments Standardization saves time Deployments are fun (with drush deploy)

Thank you for having me here! Slides : http://s.nrdy.ch/drush-deploy-ams

WHAT DID YOU THINK? EVAULATE THIS SESSION - AMSTERDAM2014.DRUPAL.ORG/SCHEDULE THANK YOU!