Capistrano 多阶段部署到错误的目录
最近更新我的 gems 后,我的 capistrano 设置遇到了一些问题。我有一个带有制作和登台设置的多阶段设置。
/config/deploy.rb
# setup multistage
set :stages, %w(testing production)
set :default_stage, "testing"
require 'capistrano/ext/multistage'
/config/deploy/development.rb
# Set deploy path
set :deploy_to, "/var/www/mysite/live"
set :rails_env, "production"
/config/deploy/testing.rb
# Set deploy path
set :deploy_to, "/var/www/mysite/test"
set :rails_env, "test"
问题是它似乎忽略了我的deploy_to 设置。它只是部署到默认的 /u/apps/mysite。
我不知道它是否有任何相关性,这一切的原因是从 apache+passenger 迁移到 nginx+unicorn。我不认为这与此有任何关系,因为这只是结帐过程。
Im having some problems with my capistrano setup after updating my gems lately. I have a multistage setup with a production and staging setup.
/config/deploy.rb
# setup multistage
set :stages, %w(testing production)
set :default_stage, "testing"
require 'capistrano/ext/multistage'
/config/deploy/production.rb
# Set deploy path
set :deploy_to, "/var/www/mysite/live"
set :rails_env, "production"
/config/deploy/testing.rb
# Set deploy path
set :deploy_to, "/var/www/mysite/test"
set :rails_env, "test"
Problem is that it seems to ignore my deploy_to setting. It just deploys to the default /u/apps/mysite.
I don't know if it has any relevance, the cause of all of this is a move from apache+passenger to nginx+unicorn. I don't think it has anything to do with that though, as this is just the checkout process.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我在 Stack Overflow 上偶然发现了这一点。这是一个老问题,但由于它被标记为开放,我将尝试一下。
我认为这可能是 Capistrano 实例加载方式的范围问题。
我注意到这个语法在 production.rb 和 test.rb 文件中不起作用,
但是这个语法起作用了:
这是一个微妙的区别,但我认为有效的实际上是将信息作为 Proc 块传递,而第一个传递的是它作为一个字符串。我偷偷怀疑,当 Capistrano 实例出现时,该字符串已不再存在。
这向我表明您的加载或需求顺序中存在某些问题,因为您应该能够在这些文件中设置部署变量。如果您无法弄清楚,您可能可以作弊并包围deploy/development.rb或deploy/test.rb代码这
肯定会告诉您该文件没有在 Capistrano 实例的范围内加载。
也是次要问题,但文件应该位于
“Not
Good Luck”中。希望您已经解决了这个问题!
I stumbled across this while on Stack Overflow. Its an old question but since its flagged as open I'm going to give it a shot.
I think this might be a scope issue with how the Capistrano Instances get loaded.
I notice this syntax doesn't work in the production.rb and test.rb files
But this one does:
Its a subtle difference but I think the one that works is actually passing the information as a Proc block, whereas the first one is passing it as a string. I have a sneaky suspicion that by the time the Capistrano Instance comes into being that string is no longer present.
This would indicate to me that something is off in your load or require order as you should be able to set the deploy variables in these files. If you can't figure it out you may be able to cheat and surround the deploy/production.rb or deploy/test.rb code with
That would definitely tell you that this file isn't being loaded within the scope of the Capistrano instance.
Also minor point but the files should be in
Not
Good Luck. Hopefully you've already solved this issue!
那些 Production.rb 和 testing.rb 位于项目中的哪里?
确保它们位于
config/deploy
下。Where are those production.rb and testing.rb located in the project?
Make sure they are under
config/deploy
.我最终通过将以下内容添加到我的部署/生产.rb和测试.rb中解决了这个问题
I eventually solved this by adding the following to my deploy/production.rb and testing.rb
可能只是您在 deploy.rb 中的顺序?将需求放在舞台设置之上
Could be just the order you have it in your deploy.rb? put the require above the stage settings