I am looking for a way to set and retrieve environment variables across my cluster with Capistrano similar to how you can do that on Heroku with the Heroku Toolbelt.
All of my servers are generally running a Linux, usually Debian.
I wrote a small tool some time ago called capistrano-env_config
which works be setting, retrieving and syncing the /etc/environment
file across a cluster. Thus it works on all *nix based systems including Debian GNU/Linux.
It's usage is pretty straight-forward. Here are some examples:
cap env:list
cap env:get[VARIABLE_NAME, VARIABLE_NAME, ...]
cap env:unset[VARIABLE_NAME, VARIABLE_NAME, ...]
cap env:set[VARIABLE_NAME=VALUE, VARIABLE_NAME=VALUE, ...]
cap env:sync
You can check the full documentation of capistrano-env_config
on GitHub. To set it up just add it to your Gemfile
:
gem 'capistrano-env_config'
And load it in your Capfile
:
require 'capistrano/env_config'