我可以使用此命令启动Puma: $ HOME / .rbenv / bin / rbenv exec bundle exec puma -C /home/deploy/tasks/shared/puma.rb --daemon -p 3000 该应用程序正在为所有页面提供服务。 我还没有安装Nginx或Apache。 我试图首先开发Upstart Puma脚本。 运行命令:
$ sudo start puma-manager
puma-manager start/running
让我觉得一切都好,而实际上是命令
$ ps -ef | grep puma
什么都不返回。 挖掘更多日志文件
$ sudo tail -f /var/log/upstart/puma-_home_deploy_tasks_current.log
我收到这样的错误:
[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'
不知道如何解决这个问题并继续使用Puma设置?
答案 0 :(得分:1)
我废弃了AWS EC2实例并使用Ubuntu 14.04实现重新创建它,我将其升级到16.04。 我严格遵循这里的指导
http://codepany.com/blog/rails-5-puma-capistrano-nginx-jungle-upstart/
以及来自同一博客的相关链接。
现在Nginx和Puma正在合作,我的应用程序在这里完美运行:
http://ec2-54-159-156-217.compute-1.amazonaws.com/
指南的唯一区别是我保留了数据库的AWS RDS实例。 虽然我在Mac上使用RBENV,但我在生产服务器中使用了RVM。 我使用ubuntu用户(比如root)进行部署,因为我怀疑我遇到的所有麻烦都与权限相关,我不知道如何修复它们。
之前遇到的许多错误尝试在套接字上正确启动Puma并使其与Nginx一起使用,尤其是在
之后不重启cap production deploy
与生成secret
并将此值放在适当的文件中有关。对我而言,它在/etc/environment
文件中写得最好。
我还对文件/etc/ssh/sshd_config
进行了更改,以便root
或ubuntu
通过ssh
进行访问。在这个问题上这个链接
https://forums.aws.amazon.com/thread.jspa?threadID=86876
非常有用。