防止 whenenver gem 在安装 gems 之前运行 --clear-crontab

发布于 2024-12-22 19:45:28 字数 903 浏览 1 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

捶死心动 2024-12-29 19:45:28

我最终做的是从 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文