AWS Elastic Beanstalk 上的 Resque

发布于 2025-01-13 03:39:46 字数 11125 浏览 2 评论 0原文

我在使用在 64 位 Amazon Linux 2/3.4.3 平台上运行的 Ruby 2.7 上启动 AWS Elastic Beanstalk 上的 Resque 时遇到问题。我的Procfile如下:

Procfile:

web: bundle exec puma -C /opt/elasticbeanstalk/config/private/pumaconf.rb
worker: RACK_ENV=production BACKGROUND=yes QUEUE=* PIDFILE=/var/pids/worker.pid bundle exec rake resque:work

工作进程启动后不断被杀死。我在 resque.log 中没有收到任何错误消息。我收到的错误消息如下:

Mar 10 18:18:37 ip-172-31-23-44 systemd: Starting This is web daemon...
Mar 10 18:18:37 ip-172-31-23-44 systemd: Started This is web daemon.
Mar 10 18:18:37 ip-172-31-23-44 systemd: Reloading.
Mar 10 18:18:37 ip-172-31-23-44 systemd: Reloading.
Mar 10 18:18:37 ip-172-31-23-44 systemd: Reloading.
Mar 10 18:18:37 ip-172-31-23-44 systemd: Starting This is worker daemon...
Mar 10 18:18:37 ip-172-31-23-44 systemd: Started This is worker daemon.
Mar 10 18:18:37 ip-172-31-23-44 systemd: Reloading.
Mar 10 18:18:38 ip-172-31-23-44 systemd: Starting The nginx HTTP and reverse proxy server...
Mar 10 18:18:38 ip-172-31-23-44 nginx: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Mar 10 18:18:38 ip-172-31-23-44 nginx: nginx: configuration file /etc/nginx/nginx.conf test is successful
Mar 10 18:18:38 ip-172-31-23-44 systemd: Started The nginx HTTP and reverse proxy server.
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] Puma starting in cluster mode...
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] * Puma version: 5.6.2 (ruby 2.7.5-p203) ("Birdie's Version")
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] *  Min threads: 8
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] *  Max threads: 32
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] *  Environment: production
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] *   Master PID: 4087
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] *      Workers: 1
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] *     Restarts: (✔) hot (✔) phased
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] * Listening on unix:///var/run/puma/my_app.sock
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] Use Ctrl-C to stop
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] ! WARNING: Detected running cluster mode with 1 worker.
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] ! Running Puma in cluster mode with a single worker is often a misconfiguration.
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] ! Consider running Puma in single-mode (workers = 0) in order to reduce memory overhead.
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] ! Set the `silence_single_worker_warning` option to silence this warning message.
Mar 10 18:18:39 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
Mar 10 18:18:40 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/bundler/gems/rhoconnect-f756fb2318a8/lib/rhoconnect/application/init.rb:6: warning: already initialized constant ROOT_PATH
Mar 10 18:18:40 ip-172-31-23-44 worker: /var/app/current/Rakefile:7: warning: previous definition of ROOT_PATH was here
Mar 10 18:18:41 ip-172-31-23-44 worker: [4179][06:18:40.663 PM 2022-03-10] Rhoconnect Server v7.1.0 started...
Mar 10 18:18:41 ip-172-31-23-44 worker: [4179][06:18:41.365 PM 2022-03-10] No `package.json` detected, disabling JavaScript support.
Mar 10 18:18:41 ip-172-31-23-44 systemd: worker.service holdoff time over, scheduling restart.
Mar 10 18:18:41 ip-172-31-23-44 systemd: Stopped This is worker daemon.
Mar 10 18:18:41 ip-172-31-23-44 systemd: Starting This is worker daemon...
Mar 10 18:18:41 ip-172-31-23-44 systemd: Started This is worker daemon.
Mar 10 18:18:42 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
Mar 10 18:18:42 ip-172-31-23-44 healthd: Version 2 of the Ruby SDK will enter maintenance mode as of November 20, 2020. To continue receiving service updates and new features, please upgrade to Version 3. More information can be found here: https://aws.amazon.com/blogs/developer/deprecation-schedule-for-aws-sdk-for-ruby-v2/
Mar 10 18:18:42 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/bundler/gems/rhoconnect-f756fb2318a8/lib/rhoconnect/application/init.rb:6: warning: already initialized constant ROOT_PATH
Mar 10 18:18:42 ip-172-31-23-44 worker: /var/app/current/Rakefile:7: warning: previous definition of ROOT_PATH was here
Mar 10 18:18:43 ip-172-31-23-44 worker: [4283][06:18:43.001 PM 2022-03-10] Rhoconnect Server v7.1.0 started...
Mar 10 18:18:43 ip-172-31-23-44 worker: [4283][06:18:43.426 PM 2022-03-10] No `package.json` detected, disabling JavaScript support.
Mar 10 18:18:43 ip-172-31-23-44 systemd: worker.service holdoff time over, scheduling restart.
Mar 10 18:18:43 ip-172-31-23-44 systemd: Stopped This is worker daemon.
Mar 10 18:18:43 ip-172-31-23-44 systemd: Starting This is worker daemon...
Mar 10 18:18:43 ip-172-31-23-44 systemd: Started This is worker daemon.
Mar 10 18:18:44 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
Mar 10 18:18:44 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/bundler/gems/rhoconnect-f756fb2318a8/lib/rhoconnect/application/init.rb:6: warning: already initialized constant ROOT_PATH
Mar 10 18:18:44 ip-172-31-23-44 worker: /var/app/current/Rakefile:7: warning: previous definition of ROOT_PATH was here
Mar 10 18:18:45 ip-172-31-23-44 worker: [4322][06:18:44.922 PM 2022-03-10] Rhoconnect Server v7.1.0 started...
Mar 10 18:18:45 ip-172-31-23-44 worker: [4322][06:18:45.345 PM 2022-03-10] No `package.json` detected, disabling JavaScript support.
Mar 10 18:18:45 ip-172-31-23-44 systemd: worker.service holdoff time over, scheduling restart.
Mar 10 18:18:45 ip-172-31-23-44 systemd: Stopped This is worker daemon.
Mar 10 18:18:45 ip-172-31-23-44 systemd: Starting This is worker daemon...
Mar 10 18:18:45 ip-172-31-23-44 systemd: Started This is worker daemon.
Mar 10 18:18:46 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
Mar 10 18:18:46 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/bundler/gems/rhoconnect-f756fb2318a8/lib/rhoconnect/application/init.rb:6: warning: already initialized constant ROOT_PATH
Mar 10 18:18:46 ip-172-31-23-44 worker: /var/app/current/Rakefile:7: warning: previous definition of ROOT_PATH was here
Mar 10 18:18:47 ip-172-31-23-44 worker: [4360][06:18:46.915 PM 2022-03-10] Rhoconnect Server v7.1.0 started...
Mar 10 18:18:47 ip-172-31-23-44 worker: [4360][06:18:47.329 PM 2022-03-10] No `package.json` detected, disabling JavaScript support.
Mar 10 18:18:47 ip-172-31-23-44 systemd: worker.service holdoff time over, scheduling restart.
Mar 10 18:18:47 ip-172-31-23-44 systemd: Stopped This is worker daemon.
Mar 10 18:18:47 ip-172-31-23-44 systemd: Starting This is worker daemon...
Mar 10 18:18:47 ip-172-31-23-44 systemd: Started This is worker daemon.
Mar 10 18:18:48 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
Mar 10 18:18:48 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/bundler/gems/rhoconnect-f756fb2318a8/lib/rhoconnect/application/init.rb:6: warning: already initialized constant ROOT_PATH
Mar 10 18:18:48 ip-172-31-23-44 worker: /var/app/current/Rakefile:7: warning: previous definition of ROOT_PATH was here
Mar 10 18:18:49 ip-172-31-23-44 worker: [4398][06:18:48.922 PM 2022-03-10] Rhoconnect Server v7.1.0 started...
Mar 10 18:18:49 ip-172-31-23-44 worker: [4398][06:18:49.330 PM 2022-03-10] No `package.json` detected, disabling JavaScript support.
Mar 10 18:18:49 ip-172-31-23-44 systemd: worker.service holdoff time over, scheduling restart.
Mar 10 18:18:49 ip-172-31-23-44 systemd: Stopped This is worker daemon.
Mar 10 18:18:49 ip-172-31-23-44 systemd: Starting This is worker daemon...
Mar 10 18:18:49 ip-172-31-23-44 systemd: Started This is worker daemon.
Mar 10 18:18:50 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
Mar 10 18:18:50 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/bundler/gems/rhoconnect-f756fb2318a8/lib/rhoconnect/application/init.rb:6: warning: already initialized constant ROOT_PATH
Mar 10 18:18:50 ip-172-31-23-44 worker: /var/app/current/Rakefile:7: warning: previous definition of ROOT_PATH was here
Mar 10 18:18:51 ip-172-31-23-44 worker: [4436][06:18:50.918 PM 2022-03-10] Rhoconnect Server v7.1.0 started...
Mar 10 18:18:51 ip-172-31-23-44 worker: [4436][06:18:51.323 PM 2022-03-10] No `package.json` detected, disabling JavaScript support.
Mar 10 18:18:51 ip-172-31-23-44 systemd: worker.service holdoff time over, scheduling restart.
Mar 10 18:18:51 ip-172-31-23-44 systemd: Stopped This is worker daemon.
Mar 10 18:18:51 ip-172-31-23-44 systemd: start request repeated too quickly for worker.service
Mar 10 18:18:51 ip-172-31-23-44 systemd: Failed to start This is worker daemon.
Mar 10 18:18:51 ip-172-31-23-44 systemd: Unit worker.service entered failed state.
Mar 10 18:18:51 ip-172-31-23-44 systemd: worker.service failed.

我可以使用相同的命令手动启动 resque,然后环境为“绿色”并且可以工作:

eb ssh
[ec2-user@ip-172-31-23-44 current]$ sudo su -
Last login: Thu Mar 10 18:18:36 UTC 2022
[root@ip-172-31-23-44 ~]# cd /var/app/current
[root@ip-172-31-23-44 current]# RACK_ENV=production BACKGROUND=yes QUEUE=* PIDFILE=/var/pids/worker.pid bundle exec rake resque:work
/opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
/opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/bundler/gems/rhoconnect-f756fb2318a8/lib/rhoconnect/application/init.rb:6: warning: already initialized constant ROOT_PATH
/var/app/current/Rakefile:7: warning: previous definition of ROOT_PATH was here
[4752][06:22:34.927 PM 2022-03-10] Rhoconnect Server v7.1.0 started...
[4752][06:22:35.338 PM 2022-03-10] No `package.json` detected, disabling JavaScript support.
[root@ip-172-31-23-44 current]#

自动生成的worker.service 文件为:

[Unit]
Description=This is worker daemon
PartOf=eb-app.target



[Service]
User=webapp
Type=simple

ExecStart=/bin/sh -c "RACK_ENV=production BACKGROUND=yes QUEUE=* PIDFILE=/var/pids/worker.pid bundle exec rake resque:work"

ExecStartPost=/bin/sh -c "systemctl show -p MainPID worker.service | cut -d= -f2 > /var/pids/worker.pid"
ExecStopPost=/bin/sh -c "rm -f /var/pids/worker.pid"
ExecStopPost=/bin/sh -c ""
Restart=always


EnvironmentFile=/opt/elasticbeanstalk/deployment/env

StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=worker
WorkingDirectory=/var/app/current/


[Install]
WantedBy=multi-user.target

I'm having trouble starting Resque on AWS Elastic Beanstalk with the Ruby 2.7 running on 64bit Amazon Linux 2/3.4.3 platform. My Procfile is as follows:

Procfile:

web: bundle exec puma -C /opt/elasticbeanstalk/config/private/pumaconf.rb
worker: RACK_ENV=production BACKGROUND=yes QUEUE=* PIDFILE=/var/pids/worker.pid bundle exec rake resque:work

The worker process keeps getting killed after starting. I get no error messages in resque.log. The error messages I get are as follows:

Mar 10 18:18:37 ip-172-31-23-44 systemd: Starting This is web daemon...
Mar 10 18:18:37 ip-172-31-23-44 systemd: Started This is web daemon.
Mar 10 18:18:37 ip-172-31-23-44 systemd: Reloading.
Mar 10 18:18:37 ip-172-31-23-44 systemd: Reloading.
Mar 10 18:18:37 ip-172-31-23-44 systemd: Reloading.
Mar 10 18:18:37 ip-172-31-23-44 systemd: Starting This is worker daemon...
Mar 10 18:18:37 ip-172-31-23-44 systemd: Started This is worker daemon.
Mar 10 18:18:37 ip-172-31-23-44 systemd: Reloading.
Mar 10 18:18:38 ip-172-31-23-44 systemd: Starting The nginx HTTP and reverse proxy server...
Mar 10 18:18:38 ip-172-31-23-44 nginx: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Mar 10 18:18:38 ip-172-31-23-44 nginx: nginx: configuration file /etc/nginx/nginx.conf test is successful
Mar 10 18:18:38 ip-172-31-23-44 systemd: Started The nginx HTTP and reverse proxy server.
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] Puma starting in cluster mode...
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] * Puma version: 5.6.2 (ruby 2.7.5-p203) ("Birdie's Version")
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] *  Min threads: 8
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] *  Max threads: 32
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] *  Environment: production
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] *   Master PID: 4087
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] *      Workers: 1
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] *     Restarts: (✔) hot (✔) phased
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] * Listening on unix:///var/run/puma/my_app.sock
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] Use Ctrl-C to stop
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] ! WARNING: Detected running cluster mode with 1 worker.
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] ! Running Puma in cluster mode with a single worker is often a misconfiguration.
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] ! Consider running Puma in single-mode (workers = 0) in order to reduce memory overhead.
Mar 10 18:18:38 ip-172-31-23-44 web: [4087] ! Set the `silence_single_worker_warning` option to silence this warning message.
Mar 10 18:18:39 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
Mar 10 18:18:40 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/bundler/gems/rhoconnect-f756fb2318a8/lib/rhoconnect/application/init.rb:6: warning: already initialized constant ROOT_PATH
Mar 10 18:18:40 ip-172-31-23-44 worker: /var/app/current/Rakefile:7: warning: previous definition of ROOT_PATH was here
Mar 10 18:18:41 ip-172-31-23-44 worker: [4179][06:18:40.663 PM 2022-03-10] Rhoconnect Server v7.1.0 started...
Mar 10 18:18:41 ip-172-31-23-44 worker: [4179][06:18:41.365 PM 2022-03-10] No `package.json` detected, disabling JavaScript support.
Mar 10 18:18:41 ip-172-31-23-44 systemd: worker.service holdoff time over, scheduling restart.
Mar 10 18:18:41 ip-172-31-23-44 systemd: Stopped This is worker daemon.
Mar 10 18:18:41 ip-172-31-23-44 systemd: Starting This is worker daemon...
Mar 10 18:18:41 ip-172-31-23-44 systemd: Started This is worker daemon.
Mar 10 18:18:42 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
Mar 10 18:18:42 ip-172-31-23-44 healthd: Version 2 of the Ruby SDK will enter maintenance mode as of November 20, 2020. To continue receiving service updates and new features, please upgrade to Version 3. More information can be found here: https://aws.amazon.com/blogs/developer/deprecation-schedule-for-aws-sdk-for-ruby-v2/
Mar 10 18:18:42 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/bundler/gems/rhoconnect-f756fb2318a8/lib/rhoconnect/application/init.rb:6: warning: already initialized constant ROOT_PATH
Mar 10 18:18:42 ip-172-31-23-44 worker: /var/app/current/Rakefile:7: warning: previous definition of ROOT_PATH was here
Mar 10 18:18:43 ip-172-31-23-44 worker: [4283][06:18:43.001 PM 2022-03-10] Rhoconnect Server v7.1.0 started...
Mar 10 18:18:43 ip-172-31-23-44 worker: [4283][06:18:43.426 PM 2022-03-10] No `package.json` detected, disabling JavaScript support.
Mar 10 18:18:43 ip-172-31-23-44 systemd: worker.service holdoff time over, scheduling restart.
Mar 10 18:18:43 ip-172-31-23-44 systemd: Stopped This is worker daemon.
Mar 10 18:18:43 ip-172-31-23-44 systemd: Starting This is worker daemon...
Mar 10 18:18:43 ip-172-31-23-44 systemd: Started This is worker daemon.
Mar 10 18:18:44 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
Mar 10 18:18:44 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/bundler/gems/rhoconnect-f756fb2318a8/lib/rhoconnect/application/init.rb:6: warning: already initialized constant ROOT_PATH
Mar 10 18:18:44 ip-172-31-23-44 worker: /var/app/current/Rakefile:7: warning: previous definition of ROOT_PATH was here
Mar 10 18:18:45 ip-172-31-23-44 worker: [4322][06:18:44.922 PM 2022-03-10] Rhoconnect Server v7.1.0 started...
Mar 10 18:18:45 ip-172-31-23-44 worker: [4322][06:18:45.345 PM 2022-03-10] No `package.json` detected, disabling JavaScript support.
Mar 10 18:18:45 ip-172-31-23-44 systemd: worker.service holdoff time over, scheduling restart.
Mar 10 18:18:45 ip-172-31-23-44 systemd: Stopped This is worker daemon.
Mar 10 18:18:45 ip-172-31-23-44 systemd: Starting This is worker daemon...
Mar 10 18:18:45 ip-172-31-23-44 systemd: Started This is worker daemon.
Mar 10 18:18:46 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
Mar 10 18:18:46 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/bundler/gems/rhoconnect-f756fb2318a8/lib/rhoconnect/application/init.rb:6: warning: already initialized constant ROOT_PATH
Mar 10 18:18:46 ip-172-31-23-44 worker: /var/app/current/Rakefile:7: warning: previous definition of ROOT_PATH was here
Mar 10 18:18:47 ip-172-31-23-44 worker: [4360][06:18:46.915 PM 2022-03-10] Rhoconnect Server v7.1.0 started...
Mar 10 18:18:47 ip-172-31-23-44 worker: [4360][06:18:47.329 PM 2022-03-10] No `package.json` detected, disabling JavaScript support.
Mar 10 18:18:47 ip-172-31-23-44 systemd: worker.service holdoff time over, scheduling restart.
Mar 10 18:18:47 ip-172-31-23-44 systemd: Stopped This is worker daemon.
Mar 10 18:18:47 ip-172-31-23-44 systemd: Starting This is worker daemon...
Mar 10 18:18:47 ip-172-31-23-44 systemd: Started This is worker daemon.
Mar 10 18:18:48 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
Mar 10 18:18:48 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/bundler/gems/rhoconnect-f756fb2318a8/lib/rhoconnect/application/init.rb:6: warning: already initialized constant ROOT_PATH
Mar 10 18:18:48 ip-172-31-23-44 worker: /var/app/current/Rakefile:7: warning: previous definition of ROOT_PATH was here
Mar 10 18:18:49 ip-172-31-23-44 worker: [4398][06:18:48.922 PM 2022-03-10] Rhoconnect Server v7.1.0 started...
Mar 10 18:18:49 ip-172-31-23-44 worker: [4398][06:18:49.330 PM 2022-03-10] No `package.json` detected, disabling JavaScript support.
Mar 10 18:18:49 ip-172-31-23-44 systemd: worker.service holdoff time over, scheduling restart.
Mar 10 18:18:49 ip-172-31-23-44 systemd: Stopped This is worker daemon.
Mar 10 18:18:49 ip-172-31-23-44 systemd: Starting This is worker daemon...
Mar 10 18:18:49 ip-172-31-23-44 systemd: Started This is worker daemon.
Mar 10 18:18:50 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
Mar 10 18:18:50 ip-172-31-23-44 worker: /opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/bundler/gems/rhoconnect-f756fb2318a8/lib/rhoconnect/application/init.rb:6: warning: already initialized constant ROOT_PATH
Mar 10 18:18:50 ip-172-31-23-44 worker: /var/app/current/Rakefile:7: warning: previous definition of ROOT_PATH was here
Mar 10 18:18:51 ip-172-31-23-44 worker: [4436][06:18:50.918 PM 2022-03-10] Rhoconnect Server v7.1.0 started...
Mar 10 18:18:51 ip-172-31-23-44 worker: [4436][06:18:51.323 PM 2022-03-10] No `package.json` detected, disabling JavaScript support.
Mar 10 18:18:51 ip-172-31-23-44 systemd: worker.service holdoff time over, scheduling restart.
Mar 10 18:18:51 ip-172-31-23-44 systemd: Stopped This is worker daemon.
Mar 10 18:18:51 ip-172-31-23-44 systemd: start request repeated too quickly for worker.service
Mar 10 18:18:51 ip-172-31-23-44 systemd: Failed to start This is worker daemon.
Mar 10 18:18:51 ip-172-31-23-44 systemd: Unit worker.service entered failed state.
Mar 10 18:18:51 ip-172-31-23-44 systemd: worker.service failed.

I can manually start resque with the same command and then environment is "Green" and works:

eb ssh
[ec2-user@ip-172-31-23-44 current]$ sudo su -
Last login: Thu Mar 10 18:18:36 UTC 2022
[root@ip-172-31-23-44 ~]# cd /var/app/current
[root@ip-172-31-23-44 current]# RACK_ENV=production BACKGROUND=yes QUEUE=* PIDFILE=/var/pids/worker.pid bundle exec rake resque:work
/opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
/opt/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/bundler/gems/rhoconnect-f756fb2318a8/lib/rhoconnect/application/init.rb:6: warning: already initialized constant ROOT_PATH
/var/app/current/Rakefile:7: warning: previous definition of ROOT_PATH was here
[4752][06:22:34.927 PM 2022-03-10] Rhoconnect Server v7.1.0 started...
[4752][06:22:35.338 PM 2022-03-10] No `package.json` detected, disabling JavaScript support.
[root@ip-172-31-23-44 current]#

The automatically generated worker.service file is:

[Unit]
Description=This is worker daemon
PartOf=eb-app.target



[Service]
User=webapp
Type=simple

ExecStart=/bin/sh -c "RACK_ENV=production BACKGROUND=yes QUEUE=* PIDFILE=/var/pids/worker.pid bundle exec rake resque:work"

ExecStartPost=/bin/sh -c "systemctl show -p MainPID worker.service | cut -d= -f2 > /var/pids/worker.pid"
ExecStopPost=/bin/sh -c "rm -f /var/pids/worker.pid"
ExecStopPost=/bin/sh -c ""
Restart=always


EnvironmentFile=/opt/elasticbeanstalk/deployment/env

StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=worker
WorkingDirectory=/var/app/current/


[Install]
WantedBy=multi-user.target

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

帅冕 2025-01-20 03:39:46

问题出在 Resque 的 BACKGROUND=true 选项上。要使其与 AWS ElasticBeanstalk 一起使用,只需将您的 Procfile 更改为:

web: bundle exec puma -C /opt/elasticbeanstalk/config/private/pumaconf.rb
worker: bundle exec rake resque:work

并确保您没有在任何地方设置后台环境变量。

The issue is with the BACKGROUND=true option for Resque. To make it work with AWS ElasticBeanstalk, simply change your Procfile to:

web: bundle exec puma -C /opt/elasticbeanstalk/config/private/pumaconf.rb
worker: bundle exec rake resque:work

and make sure you do not have the BACKGROUND env variable set anywhere.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文