Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

halo/california

Repository files navigation

Opinionated Capistrano deployment for dummies

Version Build Status

When using Capistrano to deploy an application to a server, it runs all this stuff creating a new symlink for every release, cleans up old ones, etc..

California is an opinionated out-of-the-box, best-practice configuration that aims to make things a little bit simpler for both beginners and advanced users.

Design Goals

Requirements

  • Ruby >= 2.0
  • Bundler

Installation

Create a new repository with a Gemfile like this and run bundle install to get the california gem.

# Content of Gemfile
source 'https://rubygems.org'

gem 'california'

Then run the generator for creating your first app you may want to deploy. Let's say the name of the app is "hello_world".

# Inside the directory of your newly created repository
bundle exec california generate hello_world

Follow the instructions in hello_world/deploy/production.rb (or whichever stages you have) and define which servers you want to deploy to.

Server preparation

When deploying your hello_world app, it is assumed that you can ssh into the server with the username hello_world and that the repository has been cloned to /mnt/apps/hello_world/repository.

The reason for this directory is that if you are on AWS, /mnt is the default path for permanent storage. If you're not on AWS, you may just ride along and follow the convention.

If you configure your application via environment variables, you can add them in a file called /mnt/envs/hello_world.

# Example of content of /mnt/envs/hello_world
DATABASE_URL="postgres://db.example.com"

Deployment

Essentially you just run vanilla capistrano 3 commands from inside the respective application directory.

cd hello_world

# Examples:
bundle exec cap staging deploy
bundle exec cap production deploy migrate=true

Copyright

MIT 2018 halo. See LICENSE.md.