我正在尝试使用mina
将更新部署到Rails应用程序,但是,当代码尝试使用bash: bundle: command not found
更新crontab时,我总是收到错误mina-whenever
。
运行mina deploy --verbose
给出:
-----> Update crontab for 167.99.198.135_production
$ cd /home/my_rails_project/app/current
$ bundle exec whenever --update-crontab <my_server_ip>_production --set 'environment_variable=RAILS_ENV&environment=production&path=/home/my_rails_project/app/current'
bash: line 221: bundle: command not found
! ERROR: Deploy failed.
我的deploy.rb
包含:
set :environment_variable, 'RAILS_ENV' # had to add this to make the alternative (unapproved) mina-whenever gem work
desc "Deploys the current version to the server."
task :deploy do
# uncomment this line to make sure you pushed your local branch to the remote origin
# invoke :'git:ensure_pushed'
deploy do
# Put things that will set up an empty directory into a fully set-up
# instance of your project.
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'rails:db_migrate'
invoke :'rails:assets_precompile'
invoke :'deploy:cleanup'
on :launch do
invoke :'whenever:update' # should update the cron file
command "sudo service #{fetch(:user)} restart"
end
end
end
Schedule.rb
很简单:
(尽管我没有尝试其他帖子中建议的一些更改)
# add scheduled backup
every :Sunday, at: '1:30 am' do
rake "db:backup"
end
使用的宝石有:
(原始的mina-whenever
宝石和下面显示的替代方案都会导致相同的错误)
gem 'whenever', require: false # allows chron jobs to be easily defined
# gem 'mina-whenever', require: false
gem 'mina-whenever', git: 'https://github.com/Val/mina-whenever.git', branch: :add_environment_variable_support, require: false # added based on https://github.com/mina-deploy/mina-whenever/issues/13
任何建议将不胜感激