防止 whenenver gem 在安装 gems 之前运行 --clear-crontab
我正在使用 capistrano 和每当 gem,在新部署到服务器时没有安装每当 gem 时,capistrano 会尝试
--clear-crontab
在 rake gems:install 命令运行之前运行 ,它很清楚(来自 this) 该命令在deploy_code之后运行,但我的安装gems的命令(如下)..
after "deploy:update_code", "deploy:symlink_config"
deploy.task :symlink_config, :roles => :app do
# create a symlink to the database.yml file located in the shared_path
run "ln -nsf #{shared_path}/config/database.yml #{current_release}/config"
# install any missing gems
run "cd #{current_release} && sudo rake gems:install --trace RAILS_ENV=#{rails_env}"
# migrate the database
run "cd #{current_release} && rake db:migrate --trace RAILS_ENV=#{rails_env}"
end
有没有办法订购这些任务,因为在冷部署中我总是得到whenever: not find并且必须在远程服务器上手动安装whenever gem
I am using capistrano, and the whenever gem, on a fresh deploy to a server without the whenever gem installed, capistrano attempts to run
whenever --clear-crontab
BEFORE the rake gems:install command has been run, its clear (from this) that this command runs after deploy_code but so does my command that installs the gems (below)..
after "deploy:update_code", "deploy:symlink_config"
deploy.task :symlink_config, :roles => :app do
# create a symlink to the database.yml file located in the shared_path
run "ln -nsf #{shared_path}/config/database.yml #{current_release}/config"
# install any missing gems
run "cd #{current_release} && sudo rake gems:install --trace RAILS_ENV=#{rails_env}"
# migrate the database
run "cd #{current_release} && rake db:migrate --trace RAILS_ENV=#{rails_env}"
end
Is there a way to order these tasks, because on a cold deploy I always get whenever: not found and have to manually install the whenever gem on the remote server
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最终做的是从 config\deploy.rb 中删除
require "whenever/capistrano"
以避免“自动”部署。相反,我添加了一个执行--clear-crontab
和--update-crontab
的任务。这是有效的,因为它将按照我设置的顺序执行。我基于 这篇文章,它处理的问题略有不同,但具有相同的解决方案 - 不使用与 capistrano 的“自动”集成。
What I ended up doing is removing the
require "whenever/capistrano"
from the config\deploy.rb to avoid the "automatic" deploy. Instead I have added a task that executes the--clear-crontab
and--update-crontab
. This works as it will execute in the sequence I set it to.I have based it off this post, which deals with a slightly different problem but has the same solution - not to use the "automatic" integration with capistrano.