Den*_*nis 5 bundle ruby-on-rails upstart rvm foreman
Unicorn不是由upstart脚本运行.
rvm 1.25.23 ruby 2.1.1 Rails 4.1
配置/ 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
Run Code Online (Sandbox Code Playgroud)
/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
Run Code Online (Sandbox Code Playgroud)
/log/upstart/depl-web-1.log和production.log清除
如果您转到应用程序的目录并手动运行该命令
bundle exec unicorn_rails -c /home/deployer/apps/depl/current/config/unicorn.rb -E production
Run Code Online (Sandbox Code Playgroud)
Unicorn成功发布.
如果在/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
Run Code Online (Sandbox Code Playgroud)
错误:
/bin/sh: 1: exec: bundle: not found
Run Code Online (Sandbox Code Playgroud)
我用rvm
which bundle
/home/deployer/.rvm/gems/ruby-2.1.1/bin/bundle
which rvm
/home/deployer/.rvm/bin/rvm
Run Code Online (Sandbox Code Playgroud)
我手动编辑的。
start on starting depl-web
stop on stopping depl-web
respawn
env PORT=5000
env RVM_SHELL=/home/deployer/.rvm/bin/rvm-shell
env RUBY_VERSION="2.1.5"
setuid deployer
script
chdir /home/deployer/apps/depl/current
$RVM_SHELL $RUBY_VERSION -c 'bundle exec unicorn_rails -c /home/deployer/apps/depl/current/config/unicorn.rb -E production'
end script
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2444 次 |
| 最近记录: |