开发者

Good practices for Capistrano configuration management?

I'm new to Capistrano and I'm wondering what开发者_C百科 the best way is to manage the Capistrano configuration for my project.

Specifically where should config/deploy.rb live in relation to my project's source control? Should I store a template of the file without specific configuration information? Or should this configuration sit in its own repo shared among the team?


I wondered about this too when I started to use Capistrano more and more. I think most of us agree that it makes sense to track runtime configuration information separately from functional code right? So shouldn't the same thing be true about deployment configuration?

I guess you could make your ./deploy/ folder an SCM submodule. You could make a rake task that generates the Capfile into your working copy so you get to keep eventual passwords and stuff outside of the app... There might even be a gem available for this.

However I opted for an alternative approach:

I have about ten different applications, across which the majority of Capistrano variables could follow a pattern such as set(:deploy_to) {"#{base_dir}/#{environment}/#{application}"}, and likewise for source code repository paths.

I lifted out all the knowledge about deployment from the individual applications and instead put it in one separate, common "deployment" project. Now I can check that project out and go:

cap [some application] [environment] [deploy task]

I prefer this pattern / separation of concerns a lot more than spreading around Capfiles everywhere.


That's a very good question.

I eventually also put all the deploy.rb-related stuff into a deployment project and symlinked there from the application projects. At the time a was looking into Webistrano because it looked like being able to maintain an own pool of recipies. As the project doesn't seem to be maintained anymore, I went with the above approach.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜