简体   繁体   中英

Should the capistrano configuration files be checked in with git?

I am deploying a Wordpress site using Capistrano 3 and Git and I'm wondering if the Capistrano folder/files in

/config
/lib

like

/config/deploy.rb

should be checked in with Git?

And will they also be checked out and copied to the server when deploying?
Or should I add them in .gitignore and then let every developer set up capistrano by themselfs.

The files might contain sensitive information after all.

You should check in anything that's general to the build/deploy mechanism. It needs to live somewhere . If not in the main repository, maybe you'll set up a secondary project just for deploying your project. But since deploy routines can be quite a bit of complex code in themselves, you certainly need to version-control those files somewhere . But usually the application itself assumes a certain architecture to run on, and Capistrano's job is to set up that architecture, so it makes sense to keep both those things in the same repository.

You should indeed not check in any secrets , and perhaps not machine-specific configurations either. Those should be created locally on the deploying machine tailored to the specific target machine(s). You have the full power of Ruby at your disposal, so creating some local config files or such that you load on demand shouldn't be any problem.

Rule of thumb: you should be able to make a clean checkout of your repository, create some local configuration which sets specific parameters for specific target machines to deploy to, and hit cap deploy and it should work. You should not need to modify any Capistrano code in order to make it work, and neither should you need to write the entire Capistrano configuration and deployment process from scratch.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM