GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: A capistrano/rails plugin that makes it easy to deploy/manage/scale to EC2 (moved from rubyforge)

Configuration

Config files are just ERB templates. There are some special variables that need to be set at the top of the config template file that control what happens when the template is transformed:

@path The output path to write the transformed config file to
@read_cmd The command to use for reading the original config file from, e.g. “crontab -l”
@write_cmd The command to use for piping the transformed config file to, e.g. “crontab -”
@post The command to run after generating the config file ONLY if it has changed
@owner The owner the output file should have, e.g. “root”
@group The group the output file should have, e.g. “system”
@perms The permissions the output file should have, e.g. 0644
@additive Sets transformation to be additive, only replaces between given delimiters, e.g. @additive = [”## start”, ”## end”]

Of the above, the only variables that are required are @path or both of @read_cmd and @write_cmd

In addition, within the config templates you have access to the rubber configuration objects rubber_env (rubber.yml) and rubber_instances (instance.yml). This makes it possible to write config files in such a way that adding more instances gets handled automatically – e.g. the proxy destinations in the nginx.conf need to get updated when we add more app server instances. Look at existing config files for examples of using these two configuration objects.

Configuration files are transformed in alphabetic directory order, and the directories are transformed in the following order:
  1. Configuration files that exist in config/rubber/common will be transformed for all hosts.
  2. Configuration files that exist in config/rubber/role/ will only be transformed on the hosts that are members of role_name.
  3. Configuration files that exist in config/rubber/host/ will only be transformed on the hosts with a hostname of host_name.

All the variables used in the config files (and the rubber runtime) are determined by combining all the settings in rubber.yml as well as the settings in rubber-MODULE.yml which contains settings specific to each MODULE (nginx, mongrel, etc). The rubber-MODULE.yml files are read in in alphabetical order.

When combining host/role/global variables in rubber*.yml, scalar (strings, ints) values are overidden by more specific values, that is for the same variable name in all three, the one in host takes precendence followed by role then global. Non-scalar values (sequences, maps) are merged when combining roles, with keys in maps getting overridden by the more specific ones when there is a conflict. There currently is no way to override a non-scalar for a more specific group, but I actually haven’t needed that capability yet. You can also refer to other variables within the file like so ‘foo: ”#{app_name}”’. You are also allowed to execute arbitrary ruby code in the #{} blocks.

Last edited by wr0ngway, 6 months ago
Versions: