I'm working on a Rails application, and I'm about to open-source it.
I'm deploying it to a VPS server, configured with nginx and unicorn, following this RailsCast.
In order to get Capistrano, Nginx and Unicorn working properly, I had to add some server configuration files in my config/
folder, such as deploy.rb
, nginx.conf
, unicorn.rb
and unicorn_init.sh
.
I'm working with a git repository, and everything works under the master
branch. In other words, Capistrano pull from it to deploy on the server, and also, that's the branch I'm about to open-source.
However I don't want that my server configuration files are public available.
What's the best solution?
Should I fork it and set one repository as the official public one, and use the other as my own version, and set the official repository as the upstream of mine?
Or it would be better to set my configuration parameters as environment variables, and left the configuration files on the repository?
This solution is the best one I've found for this problem (and the one I personally use).
You should place your config files in
/path/to/deployed_app/shared
Then in a capistrano task, sym link to those files:
namespace :deploy do
task :symlink_shared do
run "ln -s #{shared_path}/database.yml #{release_path}/config/"
end
end
before "deploy:restart", "deploy:symlink_shared"