ruby-on-rails – Foreman rvm暴发户无法工作
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 /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 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 错误: /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 解决方法
我最终做了类似于Denis的事情,除了每个RVM文档使用Ruby包装器.这真的很烦人tbh,但根据top -c和shift-M它正在工作.书面半冗长,因为我希望这有助于其他人.
我的设置是:Digital Ocean,Ubuntu 14.10,Rails 4.0.x,Ruby 2.0.x,RVM 1.26.10.我的Procfile仅用于后台作业,因为我使用的是Passenger 5 Nginx.部署用户是’rails’.我有一个名为“ruby-2.0.0-p598@rockin”的gemset,因为我在盒子上运行了多个应用程序,因此我的应用名为“rockin”. 添加绝对PATH到捆绑包对我不起作用. 这是我做的: >每docs创建一个rvm包装器.(用户是rails) rvm alias create rockin ruby-2.0.0-p598@rockin >为RAILS_ENV创建.env文件,为bundle创建PATH RAILS_ENV=production >尝试将工头出口到暴发户 rvmsudo foreman export upstart /etc/init -a rockin -u rails >决定尾随日志,因为另一个窗口中的捆绑问题作为健全性检查. (用户是root) tail -f /var/log/upstart/rockin-worker-1.log >手动更改upstart文件.我需要编辑的文件是rockin-worker-1.conf.由于大部分内容都是格式化的并且具有我需要的内容,因此我使用上面创建的包装器将exec行更改为真正指向bundle. start on starting rockin-worker stop on stopping rockin-worker respawn env PORT=5000 env RAILS_ENV='production' setuid rails chdir /home/rails/rockin exec /usr/local/rvm/wrappers/rockin/bundle exec rake environment resque:work QUEUE=* >跑吧! sudo start rockin-worker >您可以查看有尾日志,但如果您看不到输出,那么您就可以开始了!然后通过顶部-c和shift-M仔细检查顶部.我的resque工作人员启动并进入等待模式.完善. 这适用于任何使用rvm和其他后台工作者如sidekiq的人. 对于任何说PATH会工作的人,我尝试从我的应用程序的根目录中使用哪个bundle和whereis bundle,并使用这些路径作为.env文件.两者都没有工作,两者都导致日志抱怨/ bin / sh:1:exec:bundle:not found. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |