Capistrano Deployment

V2Master - V2Deployment

Introduction

This page describes how Capistrano is used for:

  1. The V2 deployment git tree used to store and manage V2 and MAPS deployment configurations
  2. Capistrano customization
  3. VM setup and provisioning
  4. Application deployment
  5. Example deployments

V2 Deployment Git Tree

Capistrano Customization

Capistrano Custom Command Line Parameters

Capistrano Deployment Variable

Capistrano Custom Tasks

Capistrano has a number of pre-defined default tasks, which are defined in:

If yuo need to understand what a particular Capistrano task does, then look in this file.

The list of all Capistrano tasks, including both the pre-defined default tasks and the custom tasks, with descriptions, can displayed with the command cap -T.

Notes:

  1. You must be in v2deploy directory to be able to display the task list

  2. By our own convention, the custom V2 deployment tasks are marked with a * at start of the task description.

The following is a list, with descriptions, of the V2 custom tasks:

VM Setup and Provisioning

Application Deployment

Specific Instance Deployment

Generic Instance Deployment

Example Deployments

Example: Specific Development Instance

  1. Install git tree by hand
  2. Using webbrick as web server
  3. Use Capistrano to install site and instance specific files
  4. Run bundle and rake tasks by hand

Example Command Lines

Example deployment on MacOS laptop:

Note that changes to the site and instance files, typically database.yml and settings.local.yml must be copied by hand back into the appropriate place in the v2deploy tree and committed.

Example: Specific Production Instance

  1. Install git tree by hand
  2. Using pre-configured APache virtual host as web server
  3. Capistrano to install everything
    1. Setup of target environment: Mix of hand and automated steps
    2. Local git checkout and installation on server
    3. RRun bindle and rake tasks

Example Command Lines

  1. Install MAPS on zg-3.softxs.ch server:
    • cap -s app=maps -s site=proto -s instance=zg-3.softxs.ch \
        deploy:setup deploy deploy:migrate deploy:start
  2. Install V2 on zg-3.softxs.ch server:
    • cap -s app=v2p0 -s site=proto -s instance=zg-3.softxs.ch \
        deploy:setup deploy deploy:create deploy:schema_load deploy:seed_fu_without_access_control deploy:start
  3. Install V2 on a virtual machine v2 on zg-3.softxs.ch server:
    • cap -s app=v2p0 -s site=proto -s instance=zg-3.softxs.ch \
        deploy:setup deploy:setup_ext_dirs deploy deploy:create deploy:schema_load deploy:seed_fu_without_access_control deploy:start

Example: Generic Production Instance

  1. Creating VM on virtual host
  2. Provisioning VM on virtual host
    1. Including creation of Apache virtual host
  3. Application installation

Note that DMS (re-)configuration is not included, this must be prepared separately, typically using Puppet. See:

Example Command Lines

  1. Setup a new VM and install V2 on it
    • The virtual host for the MV is vh01.softxs.ch
    • The new VM will have an internal IP address of 192.168.4.9
    • The virtual hostname for accessing the application will be vm0401vh01.softxs.ch, which must be defined in advance in DNS
      cap -v -s app=vagrant -s site=v2 -s instance=generic -s vh=1 -s vm=192.168.4.9 vagrant:setup vagrant:start
      cap -v -s app=v2p0 -s site=proto -s instance=generic -s vh=1 -s vm=192.168.4.9 deploy:provision
      cap -v -s app=v2p0 -s site=proto -s instance=generic -s vh=1 -s vm=192.168.4.9 \
        deploy:setup deploy bundle:install deploy:migrate deploy:populate deploy:start

V2CapistranoDeployment (last edited 2016-01-15 10:16:57 by 172)

Copyright 2008-2014, SoftXS GmbH, Switzerland