- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在我的 Capistrano 3 部署中,我想设置 set :deploy_to, -> { "/srv/www/#{fetch(:application)}"}
所以 :deploy_to
对于部署到的每个服务器都是不同的。
在我的 staging.rb
文件中我有:
server 'dev.myserver.com', user: 'deploy', roles: %w{web app db}, install_path: 'mycustom/path'
server 'dev.myserver2.com', user: 'deploy', roles: %w{web app db}, install_path: 'mycustom/other/path'
我的问题是:是否可以在我的 :deploy_to
中使用我定义的“install_path”?如果可能的话,你会怎么做?
最佳答案
最后,在环顾四周之后,我遇到了一位 Capistrano 开发人员提出的问题,他明确指出它无法完成
引自Github issue :
Not possible, sorry. fetch() (as is documented widely) reads values set by set(), the only reason to use set() and fetch() over regular ruby variables is to provide a consistent API between plugins and extensions, and because set() can take a Proc to be resolved later.
The variables you are setting in the host object via the server() command belong to an individual host, some of them, user, roles, etc have special meanings. For more information see https://github.com/capistrano/sshkit/blob/master/EXAMPLES.md#do-something-different-on-one-host-or-another-depending-on-a-host-property.
If you specifically need to deploy to a different directory on each machine you probably should not be using the built-in tasks (they don't fit your needs), and rather copy the deploy.rake from the Gem into your own project, and modify it as you need. Which in this case might be to not take fetch(:deploy_to), but to read that from a host property.
You could try to do something where before doing anything that relies on calling fetch(:deploy_to), you set() it using the value from host.someproperty but I'm pretty sure that'll break in exciting and interesting ways.
关于deployment - 设置 :deploy_to from server config in Capistrano3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29353019/
我把set :deploy_to在每个阶段配置文件中:config/deploy/production.rb和 config/deploy/staging.rb 例子: set :deploy_to,
我在 Capistrano 的 GitHub 存储库问题跟踪器 ( https://github.com/capistrano/capistrano/issues/1750 ) 上问过这个问题,并被告
在我的 Capistrano 3 部署中,我想设置 set :deploy_to, -> { "/srv/www/#{fetch(:application)}"} 所以 :deploy_to 对于部署
我是一名优秀的程序员,十分优秀!