【发布时间】:2014-06-12 00:24:33
【问题描述】:
Unicorn 不是由 upstart 脚本运行的。
rvm 1.25.23 红宝石 2.1.1 Rails 4.1
config/deploy.rb
desc 'Foreman init'
task :foreman_init do
on roles(:all) do
foreman_temp = "/home/deployer/tmp/foreman"
execute "mkdir -p #{foreman_temp}"
execute "ln -s #{release_path} #{current_path}"
within current_path do
execute "cd #{current_path}"
execute :bundle, "exec foreman export upstart #{foreman_temp} -a #{application} -u deployer -l /home/deployer/apps/#{application}/log -d #{current_path}"
end
sudo "mv #{foreman_temp}/* /etc/init/"
sudo "rm -r #{foreman_temp}"
end
end
/etc/init/depl-web-1.conf
start on starting depl-web
stop on stopping depl-web
respawn
env PORT=5000
setuid deployer
chdir /home/deployer/apps/depl/current
exec bundle exec unicorn_rails -c /home/deployer/apps/depl/current/config/unicorn.rb -E production
/log/upstart/depl-web-1.log 和 production.log 清除
如果您转到应用程序的目录并手动运行命令
bundle exec unicorn_rails -c /home/deployer/apps/depl/current/config/unicorn.rb -E production
独角兽成功上线。
如果在 /etc/init/depl-web-1.conf exec 行添加端口
exec bundle exec unicorn_rails -p $PORT -c
/home/deployer/apps/depl/current/config/unicorn.rb -E production
错误:
/bin/sh: 1: exec: bundle: not found
我使用 rvm
which bundle
/home/deployer/.rvm/gems/ruby-2.1.1/bin/bundle
which rvm
/home/deployer/.rvm/bin/rvm
【问题讨论】:
标签: ruby-on-rails rvm bundle upstart foreman