Coder Social home page Coder Social logo

pd-cap-recipes's Introduction

Pagerduty Capistrano Recipes Collection

These are various capistrano recipes used at PagerDuty Inc.. Feel free to fork and contribute to them.

Install

Add the following to your Gemfile.

group :capistrano do 
  # Shared capistrano recipes
  gem 'pd-cap-recipes', :git => 'git://github.com/PagerDuty/pd-cap-recipes.git'

  # extra dependencies for some tasks
  gem 'git', '1.2.5'
  gem 'hipchat', :git => 'git://github.com/smathieu/hipchat.git'
  gem 'cap_gun'
  gem 'grit'
end

Then run bundle install

Usage

Git

One of the main feature of these recipes is the deep integration with Git and added sanity check to prevent your from deploying the wrong branch.

The first thing to know is that we at PagerDuty always deploy of a tag, never from a branch. You can generate a new tag by running the follwing command:

cap production deploy:prepare

This should generate a tag in a format like master-1328567775. You can then deploy the tag with the following command:

cap production deploy -s tag=master-1328567775

The following sanity check will be performed automatically:

  • Validate the master-1328567775 as the latest deploy as an ancestor
  • Validate that you have indeed checkout that branch before deploying

Another nice thing this recipe does is keep an up to date tag for each environment. So the production tag is what is currently deployed to production. So if you ever need to diff a branch and what is already deploy you can do something like:

git diff production

Deploy Comments

When you deploy, you will prompted for a comment. This will be used to notify your coworkers via email and HipChat.

Improved Logging

The entire output produced by capistrano is logged to log/capistrano.log.

Assets

When using the Rails 3.1 assets pipeline, we enhance the default capistrano task with two features.

First, we only trigger an asset compillation when assets have changes. This is a huge time saver if you have a lot of assets. If you want to force the compilation of your assets, you can force it by setting the COMPILE_ASSETS environment variable to 'true'. You can also set the following capistrano variable:

set :always_compile_assets, true

The other feature is pushing your assets to a CDN using rsync. You can enable this functionality by adding this line to your capistrano config:

set :asset_cdn_host, "<you_cdn_user>@<your_cdn_url>"

You'll have to make sure that rsync can access your CDN without being prompter for a password.

Benchmarking your deploys

There's also a performance report printed at the end of every deploy to help you find slow tasks in your deployments and keep things snappy.

pd-cap-recipes's People

Contributors

smathieu avatar ienders avatar lkosewsk avatar littonj avatar

Watchers

Robert Spilak avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.