Shared Configuration Files

Will Farrington edited this page Aug 19, 2010 · 2 revisions

Often, certain files (config/database.yml, etc) are excluded from an
application’s SCM, but required to be present for deploy. We’ve abstracted
this pattern with some Capistrano automation that goes great with Moonshine.

For example, if you keep config/database.yml out of your SCM, add the
following line to your config/moonshine.yml:

  - config/database.yml

This file will then be automatically uploaded when you run cap deploy:setup
and symlinked to current/config/database.yml on each deploy.

There are some extra cap tasks for working with these files manually, if needed:

cap shared_config:upload

Uploads all files in shared_config to #{configuration[:deploy_to]}/shared/PATH
(configuration[:deploy_to] is /srv/APPNAME by default) for all servers in the
current deploy stage.

cap shared_config:download

Downloads all files in shared_config from all servers in the current deploy stage.

cap shared_config:symlink

Symlinks all files in #{configuration[:deploy_to]}/shared/PATH to #{configuration[:deploy_to]}/current/PATH
on all remote hosts in the current deploy stage.

The old local_config functionality is still supported, but shared_config is recommended.