简体   繁体   English

Ubuntu Puma Upstart脚本失败

[英]Ubuntu Puma Upstart Script fails

I am able to start Puma using this command: $HOME/.rbenv/bin/rbenv exec bundle exec puma -C /home/deploy/tasks/shared/puma.rb --daemon -p 3000 And the app is working serving all pages. 我可以使用以下命令启动Puma:$ HOME / .rbenv / bin / rbenv exec bundle exec puma -C /home/deploy/tasks/shared/puma.rb --daemon -p 3000该应用程序正在为所有页面。 I do not have Nginx or Apache installed yet. 我尚未安装Nginx或Apache。 I am trying to have first and Upstart Puma script developed first. 我试图先开发Upstart Puma脚本。 Running the command: 运行命令:

$ sudo start puma-manager
puma-manager start/running

gives me the impression that everything is ok while in reality the command 给我的印象是,一切正常,而实际上

$ ps -ef | grep puma

returns nothing. 什么也不返回。 Digging more into the log file 深入挖掘日志文件

$ sudo tail -f /var/log/upstart/puma-_home_deploy_tasks_current.log

I am getting an error like this: 我收到这样的错误:

[2889] Puma starting in cluster mode...
[2889] * Version 3.6.0 (ruby 2.3.1-p112), codename: Sleepy Sunday Serenity
[2889] * Min threads: 5, max threads: 5
[2889] * Environment: development
[2889] * Process workers: 2
[2889] * Preloading application
[2889] ! Unable to load application: LoadError: Could not load the 'listen' gem. Add `gem 'listen'` to the development group of your Gemfile
bundler: failed to load command: puma (/home/deploy/tasks/shared/bundle/ruby/2.3.0/bin/puma)
LoadError: Could not load the 'listen' gem. Add `gem 'listen'` to the development group of your Gemfile
  /home/deploy/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
  /home/deploy/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
  /home/deploy/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
  /home/deploy/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'

Don't know how to fix this and move forward with the Puma settings? 不知道如何解决此问题并继续使用Puma设置吗?

I scrapped the AWS EC2 instance and recreate it using and Ubuntu 14.04 implementation which I upgraded to 16.04. 我报废了AWS EC2实例,并使用升级到16.04的Ubuntu 14.04实现重新创建了该实例。 I followed strictly the guidance found here 我严格遵循此处找到的指导

http://codepany.com/blog/rails-5-puma-capistrano-nginx-jungle-upstart/

and related links from the same blog. 以及来自同一博客的相关链接。

Now Nginx and Puma are working properly together and my app runs perfectly here: 现在Nginx和Puma可以正常工作,并且我的应用程序可以在这里完美运行:

http://ec2-54-159-156-217.compute-1.amazonaws.com/

The only difference form the guidelines is that I kept the AWS RDS instance for the database. 与指南的唯一区别在于,我保留了数据库的AWS RDS实例。 I used RVM in the production server although I am using RBENV on my Mac. 尽管在Mac上使用RBENV,但我在生产服务器中使用了RVM。 I used ubuntu user (like root) for deployment since I am suspecting all the troubles I had were related to permissions and I did not know how to fix them. 我使用ubuntu用户(如root)进行部署,因为我怀疑我遇到的所有麻烦都与权限有关,并且我不知道如何解决它们。

Many errors encountered earlier trying to start properly Puma on socket and make it working with Nginx, especially not restarting after 先前尝试在套接字上正确启动Puma并使它与Nginx配合使用时遇到了许多错误,尤其是在重启之后无法重新启动

cap production deploy

were related to generating the secret and putting this value in the appropiate file. 与生成secret并将此值放入适当的文件有关。 For me it worked the best writing it in the /etc/environment file. 对我来说,最好在/etc/environment文件中编写它。

I also did changes in the file /etc/ssh/sshd_config in order to get root or ubuntu access through ssh . 我还对文件/etc/ssh/sshd_config进行了更改,以便通过ssh获得rootubuntu访问。 In this matter this link 在这个问题上这个链接

https://forums.aws.amazon.com/thread.jspa?threadID=86876

was very useful. 非常有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM