DEPLOYING DRUPAL USING CAPISTRANO



Similar documents
Simple and powerful site deployment with capistrano

Git - Working with Remote Repositories

Putting It All Together. Vagrant Drush Version Control

DRUPAL CONTINUOUS INTEGRATION. Part I - Introduction

How To Manage Change In Jeepers

Advantages and Disadvantages of Application Network Marketing Systems

Zero-Touch Drupal Deployment

AVOIDING THE GIT OF DESPAIR

MANAGE AND DEPLOY YOUR SITES WITH DRUSH

Drupal Drush Guide. Drupal.org

Version control. HEAD is the name of the latest revision in the repository. It can be used in subversion rather than the latest revision number.

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

Tools and Integration

Introduc)on to Version Control with Git. Pradeep Sivakumar, PhD Sr. Computa5onal Specialist Research Compu5ng, NUIT

JavaScript Applications for the Enterprise: From Empty Folders to Managed Deployments. George Bochenek Randy Jones

How to Install Multiple Monitoring Agents on a Microsoft Operating System. Version StoneGate Firewall/VPN 2.6 and SMC 3.2

Linko Software Express Edition Typical Installation Guide

Achieving Continuous Integration with Drupal

jenkins, drupal & testing automating every phing! miggle

DevOps. Building a Continuous Delivery Pipeline

CHEF IN THE CLOUD AND ON THE GROUND

Moving the Web Security Log Database

VSS installation and application

GoAnywhere MFT Upgrade Guide. Version: Publication Date: 08/12/2015

inforouter V8.0 Server Migration Guide.

MATLAB & Git Versioning: The Very Basics

FileCruiser Backup & Restoring Guide

SecureVault Online Backup Service Client Installation Guide

EMC Documentum Repository Services for Microsoft SharePoint

Automate Your Deployment with Bamboo, Drush and Features DrupalCamp Scotland, 9 th 10 th May 2014

MOOSE-Based Application Development on GitLab

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

Building a Continuous Integration Pipeline with Docker

Hudson Continous Integration Server. Stefan Saasen,

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

Buffalo Technology: Migrating your data to Windows Storage Server 2012 R2

SQL Server Replication Guide

MIGRATING TO AVALANCHE 5.0 WITH MS SQL SERVER

Installation overview

UFTP AUTHENTICATION SERVICE

Backing Up and Restoring Data

Revision control systems (RCS) and

Cloud Services for Backup Exec. Planning and Deployment Guide

New Relic & JMeter - Perfect Performance Testing

Instructions for update installation of ElsaWin 5.00

Introduction to the Git Version Control System

Monitoring Oracle Enterprise Performance Management System Release Deployments from Oracle Enterprise Manager 12c

NAS 253 Introduction to Backup Plan

Upgrading VMware Identity Manager Connector

BioWin Network Installation

SARANGSoft WinBackup Business v2.5 Client Installation Guide

Version Control with Git. Linux Users Group UT Arlington. Rohit Rawat

Jenkins and Chef Infrastructure CI and Application Deployment

FEEG Applied Programming 3 - Version Control and Git II

KonyOne Server Installer - Linux Release Notes

SQL Server Setup for Assistant/Pro applications Compliance Information Systems

Moving the TRITON Reporting Databases

Introduction. Before you begin. Installing efax from our CD-ROM. Installing efax after downloading from the internet

Installation Guide v3.0

Work. MATLAB Source Control Using Git

Configuration Guide. Remote Backups How-To Guide. Overview

Rational Application Developer v7.0 (RAD7) trial version. Installation guide

Introduction to Version Control with Git

Continuous Delivery for Alfresco Solutions. Satisfied customers and happy developers with!! Continuous Delivery!

Magento Search Extension TECHNICAL DOCUMENTATION

A central continuous integration platform

How to Setup SQL Server Replication

StriderCD Book. Release 1.4. Niall O Higgins

Backup of data residing on Open-E Data Storage Software with Backup Exec

Upgrading Horizon Workspace

Perceptive Connector for Microsoft Dynamics AX

SECURITY SYSTEM MANAGEMENT SOFTWARE FOR WINDOWS. Quick Start Instructions

Backing Up and Restoring Microsoft Exchange Server Cloud Attached Storage. August 2012 Version 3.2

BlackBerry Enterprise Server. BlackBerry Device Software Version: 5.0 Service Pack: 4. Update Guide

Lab Exercise Part II: Git: A distributed version control system

Using Time Machine to Backup Multiple Mac Clients to SNC NAS and 1000

Migrating Trend Micro Mobile Security for Enterprise (TMMS) 8.0 to TMMS 9.0 Patch 1

Administering Team Foundation Server 2013

Quick Start Guide. User Manual. 1 March 2012

Version control with GIT

Improving your Drupal Development workflow with Continuous Integration

Database Administration Guide

PowerSearch for MS CRM 2011

Install and configure SSH server

Technical Bulletin. SQL Express Backup Utility

Server & Workstation Installation of Client Profiles for Windows (WAN Edition)

e-config Data Migration Guidelines Version 1.1 Author: e-config Team Owner: e-config Team

Brakeman and Jenkins: The Duo Detects Defects in Ruby on Rails Code

Using the Local Document Organizer in ProjectWise

Contents. Chapter 1 Introducing virtualized Microsoft Office Chapter 2 Packaging Microsoft Office... 5

NAS 259 Protecting Your Data with Remote Sync (Rsync)

Managing ACE Software Licenses

Transcription:

DEPLOYING DRUPAL USING CAPISTRANO Jochen Verdeyen @jochenverdeyen

SITUATIONS

PREREQUISITES SSH Ruby (local) Git (servers)

INSTALLATION

source 'https://rubygems.org' group :deploy do gem 'capistrano', '~> 3.4.0' end Bundler - Gemfile bundle install

bundle exec cap install Default setup Capfile config deploy production.rb staging.rb deploy.rb lib capistrano tasks

Custom setup bundle exec cap install STAGES=tst,stag,prd Capfile config deploy prd.rb stag.rb tst.rb deploy.rb lib capistrano tasks

CONFIGURATION

# Load DSL and set up stages require 'capistrano/setup' Capfile # Include default deployment tasks require 'capistrano/deploy'

set :application, 'my_app' set :repo_url, 'git@my-repo.url' # Branch to deploy set :branch, 'master' deploy.rb # Destination path of the application set :deploy_to, '/var/www/my_app' # Amount of releases to keep set :keep_releases, 5 # Default value for linked_files is [] set :linked_files, [] # Default value for linked_dirs is [] set :linked_dirs, []

deploy/tst.rb # Server # ====== server 'xxx.xxx.xxx.xxx', roles: %w{app db}, user: 'deploy_user'

DEPLOYING

bundle exec cap prd deploy Deploy flow deploy:starting - start a deployment deploy:started - started hook deploy:updating - update server(s) with a new release deploy:updated - updated hook deploy:publishing - publish the new release deploy:published - published hook deploy:finishing - finish the deployment, clean up deploy:finished - finished hook

Deploy flow - Structure current -> /var/www/my_app/releases/20151106114500/ releases 20151103072500 20151104083000 20151105093500 20151106104000 20151106114500 repo [VCS related data] revisions.log shared [linked_files and linked_dirs]

Rollback flow bundle exec cap prd deploy:rollback deploy:starting deploy:started deploy:reverting - revert server(s) to previous release deploy:reverted - reverted hook deploy:publishing deploy:published deploy:finishing_rollback - finish the rollback, clean up deploy:finished

Rollback flow - Structure current -> /var/www/my_app/releases/20151106104000/ releases 20151103072500 20151104083000 20151105093500 20151106104000 20151106114500 repo [VCS related data] revisions.log shared [linked_files and linked_dirs]

DRUPAL 8

Prerequisites Drush Composer

Capfile # Composer to install drush on the server require 'capistrano/composer'

set :application, 'my_app' set :repo_url, 'git@my-repo.url' # Branch to deploy set :branch, 'master' deploy.rb # Destination path of the application set :deploy_to, '/var/www/my_app' # Link files directory set :linked_dirs, fetch(:linked_dirs, []).push( "#{fetch(:app_path)}/sites/default/files" )

deploy/tst.rb # Server # ====== server 'xxx.xxx.xxx.xxx', roles: %w{app db}, user: 'deploy_user' # Map composer and drush commands # =============================== SSHKit.config.command_map[:composer] = "#{shared_path.join("composer.phar")}" SSHKit.config.command_map[:drush] = "#{shared_path.join("vendor/bin/drush")}"

Drupal specific tasks desc 'Create a database backup' task :backup_db do on roles(:app) do within current_path.join(fetch(:app_path)).join('sites/default') do execute :drush, "sql-dump --result-file=#{current_path}/backup_db.sql" end end end desc 'Set the site offline' task :site_offline do on roles(:app) do within release_path.join(fetch(:app_path)).join('sites/default') do execute :drush, "state-set system.maintenance_mode 1 -y" end end end

Drupal specific tasks desc 'Import configuration from the config directory' task :config_import do on roles(:app) do within release_path.join(fetch(:app_path)).join('sites/default') do execute :drush, "config-import -y" end end end desc 'Clear all caches' task :cache_clear do on roles(:app) do within release_path.join(fetch(:app_path)).join('sites/default') do execute :drush, "cache-rebuild all" end end end

bundle exec cap prd deploy:drupal Deploy flow before "deploy:starting", "drupal:backup_db" deploy:starting - start a deployment deploy:started - started hook deploy:updating - update server(s) with a new release deploy:updated - updated hook after "drupal:updated", "drupal:site_offline" after "drupal:site_offline", "drupal:update_db" after "drupal:update_db", "drupal:config_import" after "drupal:config_import", "drupal:cache_clear:all" before "deploy:publishing", "drupal:site_online" deploy:publishing - publish the new release deploy:published - published hook deploy:finishing - finish the deployment, clean up deploy:finished - finished hook

JENKINS ${WORKSPACE}/deploy/deploy.sh -w ${WORKSPACE} -e tst deploy.sh # Go to the Capistrano folder in the workspace cd ${WORKSPACE}/deploy/capistrano # Prepare bundle bundle bundle install # Capistrano preparation bundle exec cap ${ENVIRONMENT} composer:install_executable bundle exec cap ${ENVIRONMENT} drush:install # Capistrano deploy bundle exec cap ${ENVIRONMENT} deploy:drupal exit 0

DEMO