cron ジョブとしてのみ実行されるアプリケーションがあります。cron ジョブを維持および展開するために、everyone gem を使用しています。
これは私の現在の展開スクリプトです。
require "bundler/capistrano"
require "whenever/capistrano"
set :application, "my-app"
set :domain, "example.com"
set :bundle_runner, "bundle exec"
# Git
set :scm, :git
set :repository, "git@bitbucket.org:username/my-app.rb.git"
set :branch, "master"
# Config
role :app, "example.com"
set :deploy_to, "/opt/apps/#{application}"
set :deploy_via, :remote_cache
set :keep_releases, 5
set :git_enable_submodules, 1
set :git_shallow_clone, 1
# User
set :user, "webmaster"
set :use_sudo, false
# SSH
ssh_options[:paranoid] = false
ssh_options[:forward_agent] = true
set :bundle_cmd, "bundle"
set :bundle_without, [:test, :development]
set :bundle_flags, "--deployment --without=development,test"
set :whenever_command, "#{bundle_cmd} exec whenever"
namespace :deploy do
task :restart, roles: [:app] do
whenever.update_crontab
end
end
問題は、デプロイ中にこのエラーが発生することです。
* executing "cd -- /opt/apps/my-app/releases/20130224004202 && bbundle2 exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile && cp -- /opt/apps/my-app/shared/assets/manifest.yml /opt/apps/my-app/releases/20130224004202/assets_manifest.yml"
servers: ["example.com"]
[example.com] executing command
*** [err :: example.com] rake aborted!
*** [err :: example.com] No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
*** [err :: example.com]
*** [err :: example.com] (See full trace by running task with --trace)
command finished in 802ms
*** [deploy:update_code] rolling back
* executing "rm -rf /opt/apps/my-app/releases/20130224004202; true"
servers: ["example.com"]
[example.com] executing command
command finished in 111ms
Capistrano はこれが Rails アプリケーションであると考えているようですが、そうではありません。実行時にのみ次のことを行う方法はありますかcap deploy
- リモート リポジトリからソース コードをダウンロードします。
- フォルダを更新し
current
ます。 - when を使用して crontab を更新します。