[英]Capistrano deploy.rb file based on environment
I need two deployment files (staging and production); 我需要两个部署文件(登台和生产); they will have separate deployment details (host, user, environment, branch, etc...). 他们将具有单独的部署详细信息(主机,用户,环境,分支等)。 Is it possible to cap deploy
using a specific file? 是否可以使用特定文件cap deploy
? Something like... 就像是...
cap deploy:staging # use staging_deploy.rb
cap deploy:production # use production_deploy.rb
Or is there a better way to do this? 还是有更好的方法来做到这一点?
Capistrano 3 has multi-stage support built-in. Capistrano 3具有内置的多阶段支持。 For capistrano 2, use an extension: https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension . 对于capistrano 2,请使用扩展名: https : //github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension 。
In both cases, the file structure looks like this: 在这两种情况下,文件结构都如下所示:
├── Capfile
└── config
├── deploy
│ ├── production.rb
│ └── staging.rb
└── deploy.rb
You can override settings from deploy.rb
(host, user and everything else) in a corresponding environment-specific file. 您可以在相应的特定于环境的文件中覆盖deploy.rb
(主机,用户和所有其他内容)中的设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.