Puma无法在AWS Elastic Beanstalk的Rails 5上运行

问题描述 投票:0回答:0

我正在尝试在AWS Elastic Beanstalk上运行rails 5站点,并且似乎一切正常,除了Puma一直关闭。

日志如下。 我尝试过搜索错误,但是只是获得了针对不同问题的不相关解决方案。 我假设我的puma配置文件中有问题,但是无法弄清楚需要更改什么。 现在,我只有标准的puma.rb文件。

-------------------------------------
/var/log/nginx/error.log
-------------------------------------
2018/08/08 19:19:31 [warn] 3023#0: conflicting server name "localhost" on 0.0.0.0:80, ignored
2018/08/08 19:20:34 [crit] 3027#0: *4 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.6.124, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/", host: "18.188.190.176"
2018/08/08 21:12:16 [warn] 2967#0: conflicting server name "localhost" on 0.0.0.0:80, ignored
2018/08/08 22:02:02 [warn] 5848#0: conflicting server name "localhost" on 0.0.0.0:80, ignored
2018/08/08 22:02:02 [warn] 5858#0: conflicting server name "localhost" on 0.0.0.0:80, ignored



-------------------------------------
/var/log/puma/puma.log
-------------------------------------
=== puma startup: 2018-08-08 19:21:42 +0000 ===
=== puma startup: 2018-08-08 19:21:42 +0000 ===
[17439] - Worker 0 (pid: 17442) booted, phase: 0
[17439] - Gracefully shutting down workers...
=== puma startup: 2018-08-08 21:12:05 +0000 ===
=== puma startup: 2018-08-08 21:12:05 +0000 ===
[2406] - Worker 0 (pid: 2459) booted, phase: 0
[2406] - 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 access parent 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-08-08 21:12:55 +0000 ===
=== puma startup: 2018-08-08 21:12:55 +0000 ===
[3420] - Worker 0 (pid: 3423) booted, phase: 0
[3420] - 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 access parent 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-08-08 21:56:20 +0000 ===
=== puma startup: 2018-08-08 21:56:20 +0000 ===
[5379] - Worker 0 (pid: 5382) booted, phase: 0
[5379] - Gracefully shutting down workers...
=== puma startup: 2018-08-08 21:58:45 +0000 ===
=== puma startup: 2018-08-08 21:58:45 +0000 ===
[5532] - Worker 0 (pid: 5535) booted, phase: 0
[5532] - Gracefully shutting down workers...
=== puma startup: 2018-08-09 00:36:36 +0000 ===
=== puma startup: 2018-08-09 00:36:36 +0000 ===
[11544] - Worker 0 (pid: 11547) booted, phase: 0
[11544] - Gracefully shutting down workers...
=== puma startup: 2018-08-09 00:38:14 +0000 ===
=== puma startup: 2018-08-09 00:38:14 +0000 ===
[11706] - Worker 0 (pid: 11709) booted, phase: 0
[11706] - Gracefully shutting down workers...
=== puma startup: 2018-08-09 00:43:55 +0000 ===
=== puma startup: 2018-08-09 00:43:55 +0000 ===
[12305] - Worker 0 (pid: 12308) booted, phase: 0
[12305] - Gracefully shutting down workers...
=== puma startup: 2018-08-09 00:47:12 +0000 ===
=== puma startup: 2018-08-09 00:47:12 +0000 ===
[12506] - Worker 0 (pid: 12509) booted, phase: 0

编辑:我的彪马配置文件

# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record.
#
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
threads threads_count, threads_count

# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
#
port        ENV.fetch("PORT") { 3000 }

# Specifies the `environment` that Puma will run in.
#
environment ENV.fetch("RAILS_ENV") { "development" }

# AWS Elastic Beanstalk setup
bind "unix:///var/run/puma/my_app.sock"
pidfile "/var/run/puma/my_app.sock"
# End AWS setup

# Specifies the number of `workers` to boot in clustered mode.
# Workers are forked webserver processes. If using threads and workers together
# the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }

# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory.
#
# preload_app!

# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart
ruby-on-rails amazon-web-services amazon-ec2 elastic-beanstalk puma
© www.soinside.com 2019 - 2024. All rights reserved.