[英]Capistrano Multiple Deploy Stages
I have a Rails app and I would like to use Capistrano to deploy two versions: production
and staging
. 我有一个Rails应用程序,我想使用Capistrano部署两个版本: production
和staging
。
On my deploy.rb file I have: set :stages, ['staging', 'production']
在我的deploy.rb文件中,我具有: set :stages, ['staging', 'production']
Then how can I use two paths without overriding them? 那么,如何使用两条路径而不覆盖它们呢?
set :deploy_to, '/home/deploy/Sites/staging/myname'
set :deploy_to, '/home/deploy/Sites/production/myname'
I've seen this answer but I'd like to keep the command line clean. 我已经看到了这个答案,但是我想保持命令行的干净。
在config/deploy/*.rb
, production.rb
和staging.rb
下创建两个文件,到production.rb
添加set :deploy_to, '/home/deploy/Sites/production/myname'
,到staging.rb
添加set :deploy_to, '/home/deploy/Sites/staging/myname'
Any data from config/deploy.rb
can be defined for specific environments in config/deploy/*
可以在config/deploy/*
为特定环境定义config/deploy.rb
任何数据
example of config/deploy/production.rb
config/deploy/production.rb
示例
set :stage, :production
set :rails_env, :production
set :branch, "master"
example of config/deploy/staging.rb
config/deploy/staging.rb
示例
set :stage, :staging
set :rails_env, :staging
set :branch, "staging"
This works for me with two environments from different branchs. 这对我来说适用于来自不同分支的两个环境。 I hope you define the :deploy_to
and server url
specifically as well. 我希望您也明确定义:deploy_to
和server url
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.