Advanced Gem Settings


NB: This only applies to Brightbox Deployment Gem v2.3.6 and above

Local deploy settings

There are certain deploy settings that shouldn't be put in your config/deploy.rb. A prime example is your deploy password, each person deploying needs it, but for security reasons you don't want it checked into source control. To solve this common problem, the Brightbox Deployment Gem now loads in config/deploy.local.rb, if it exists.

The basic idea is you create config/deploy.local.rb, add any sensitive settings in there that you want to exclude from source control, and then ignore the deploy.local.rb file in your source control mechanism.

Here's an example to set your server password, using git as your source control:

  • Create config/deploy.local.rb
  • Add “config/deploy.local.rb” to your .gitignore and commit the change
  • Edit your deploy.local.rb to add your password:
set :password, "supersecretpassword"
  • Deploy!

Settings in deploy.local.rb don't override those set in deploy.rb, but anything you could put in deploy.rb will work in deploy.local.rb.

Multistage support

There isn't direct multistage support built in, but here is a workaround using deploy.local.rb to set a different value depending on which stage is selected.

Using the previous example of setting the deploy password, we want a different password set for the staging servers and production servers.

Firstly we set the values of the different passwords, using the variable name format {stage}_password

set :staging_password, "supersecretpassword"
set :production_password, "anothersecretpassword"

Then we use capistrano's lazy variable evaluation to set the password variable during the setup for the task, so we know which stage we're using.

set(:password) { send(:"#{stage}_password") }

Disable generating webserver configs

NB: This only applies to Brightbox Deployment Gem v2.3.6 and above

You can stop your application's apache or nginx config being regenerated by deploy:setup now. This is useful if you've got manual modifications to your config files you don't want overwritten. If your config hasn't been generated yet, it won't be created with the following set, so be sure your config has already been generated before adding it to your deploy.rb.

To disable config generation, add the following to your deploy.rb:

set :generate_webserver_config, false
docs/gemv2/advancedgemsettings.txt · Last modified: 2010/04/14 19:04 by caius

UK Cloud Server Hosting & Cloud Hosting Providers - Brightbox Cloud

Simple and flexible UK cloud hosting for teams that insist on 100% uptime. Everything you need to deliver fast and highly available apps that delight your customers.

Get started now risk-free with £20 free credit.

Trusted by developers, big brands and people like you

512MB @brightbox cloud instance snapshotted, loaded onto new 2gb instance and cloud ip remapped. All without anyone noticing. ;)

Latest blog posts

Building a scaleable filesystem with S3QL and Orbit

All our Cloud Servers come with resilient local permanent disks, stored on SSDs in a RAID configuration. For periodic backups, you can use our server snapsho...

Read blog post

NixOS on Brightbox Cloud

NixOS is a Linux distribution that is configured using a functional language in a declarative way. I’ve been using it here at Brightbox as my main developme...

Read blog post

Scheduled snapshots for Cloud SQL

We’ve just added a new scheduled snapshots feature to Cloud SQL, our hassle-free MySQL cloud database service. Cloud SQL has always supported manually takin...

Read blog post

More blog posts...

Get started with Brightbox Sign up takes just two minutes...