繁体   English   中英

AWS Elastic Beanstalk上的Rails 5出现puma错误(getcwd)

[英]Rails 5 on AWS Elastic Beanstalk getting puma error (getcwd)

我当时以为每项工作都可以在AWS Elastic Beanstalk上部署Rails 5 API,但Puma尚未开始工作。 Puma启动片刻,然后自行关闭

EB的错误日志

[27782] - Worker 0 (pid: 27795) booted, phase: 0
[27782] - Worker 1 (pid: 27801) booted, phase: 0
[27782] - Gracefully shutting down workers...
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
shell-init: error retrieving current directory: getcwd: cannot accessparent directories: No such file or directory
/opt/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.16.0/lib/bundler/shared_helpers.rb:71:in 'getwd': No such file or 
directory - getcwd (Errno::ENOENT) 
from /opt/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.16.0/lib/bundler/shared_helpers.rb:71:in'pwd'
from /opt/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.16.0/lib/bundler/shared_helpers.rb:71:in 'block in pwd'
from /opt/rubies/ruby-2.5.1/lib/ruby/2.5.0/monitor.rb:226:in'mon_synchronize'
from /opt/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.16.0/lib/bundler/shared_helpers.rb:70:in 'pwd'
from /opt/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.16.0/lib/bundler/env.rb:43:in 'block in report'
from /opt/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.16.0/lib/bundler/env.rb:42:in 'each'
from /opt/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.16.0/lib/bundler/env.rb:42:in 'report'
from /opt/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.16.0/lib/bundler/friendly_errors.rb:96:in 'request_issue_report_for'
from /opt/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.16.0/lib/bundler/friendly_errors.rb:46:in 'log_error'
from /opt/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.16.0/lib/bundler/friendly_errors.rb:126:in 'rescue in with_friendly_errors'
from /opt/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.16.0/lib/bundler/friendly_errors.rb:121:in 'with_friendly_errors'
from /opt/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.16.0/exe/bundle:22:in '<top (required)>'
from /opt/rubies/ruby-2.5.1/bin/bundle:23:in 'load'
from /opt/rubies/ruby-2.5.1/bin/bundle:23:in '<main>'
=== puma startup: 2018-09-13 13:26:58 +0700 ===
=== puma startup: 2018-09-13 13:26:58 +0700 ===
[28563] - Worker 1 (pid: 28585) booted, phase: 0
[28563] - Worker 0 (pid: 28581) booted, phase: 0

我检查了VPC,安全组,数据库和Redis,所有这些工作正常

我已经在旧服务器上部署了,但是可以尝试创建新服务器并使用相同的配置

更新puma.rb

threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
threads threads_count, threads_count

port ENV.fetch("PORT") { 3003 }

environment ENV.fetch("RAILS_ENV") { "development" }

plugin :tmp_restart

更新puma.config

files:
   "/opt/elasticbeanstalk/support/conf/pumaconf.rb":
    mode: "000644"
  content: |
  directory '/var/app/current'
  workers Integer(ENV['WEB_CONCURRENCY'] || 2)
  threads_count = Integer(ENV['MAX_THREADS'] || 16)
  threads threads_count, threads_count
  bind 'unix:///var/run/puma/my_app.sock'
  stdout_redirect '/var/log/puma/puma.log', '/var/log/puma/puma.log', true
  daemonize false

暂无
暂无

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

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