Deploying Barkeep

mhightower edited this page Jun 29, 2012 · 6 revisions

Barkeep is designed to have a very streamlined deploy experience to a Ubuntu box.

Setting up the host

We're running Barkeep on Ubuntu 10.04 LTS. We develop on more recent versions of Ubuntu, but our provisioning and deploy scripts aren't tested on more recent versions.

To deploy, you'll need passwordless ssh access to root on your destination box.

To set up the configuration for the host you want to deploy to, copy the file config/deploy_targets/vagrant.rb to config/deploy_targets/my_company.rb.

Edit this new file and change the destination name and the hostname.

Email

You'll need to provide the credentials of the Gmail account you want to use for sending emails from Barkeep.

You can either provide these options directly in config/deploy_targets/my_company.rb, or you can store them in a file outside of your git repo. To do this, create a file (call it e.g. ~/.barkeep_creds.rb) and set the environment variable BARKEEP_CREDENTIALS to point to this file. This file should look like:

Fezzik.destination :my_company do
  Fezzik.env :gmail_address, "your_address@your_domain.com"
  Fezzik.env :gmail_password, "gmail_pw"
  Fezzik.env :cookie_session_secret, "some long, secret string"
end

Configure Gmail to allow Barkeep to send emails

Emails for new commits are sent from user+commits@example.com and comments are sent from user+comments@example.com. By default, Gmail won't allow your account to send from these addresses without explicitly allowing them. Enabling this is easy -- log in to the Gmail account you're going to use with Barkeep and add these two addresses in Settings > Accounts and Import > Send Mail As.

Deploy it!

Now you are ready to deploy. The deploy script will provision the machine with all of the software it needs:

$ bundle exec fez my_company deploy

This deploy will run the integration tests after the deploy, ensuring Barkeep is working end-to-end.

Resources

We use Fezzik to script our deploy. It is very similar to Capistrano, but simpler. We also use Terraform for installing native packages (like mysql and nginx) onto the host. If you want to tweak how your Barkeep gets deployed, understanding the READMEs of Fezzik and Terraform is a good place to start.

To get a full understanding of how Barkeep's deploy works, read through these files: