Otro día increíble hoy para todos nosotros :)
Estoy tratando de usar AWS EB Ruby 3.0 ejecutándose en Amazon Linux 2/3.4.4 de 64 bits con una aplicación Ruby-on-Rails v6.0.4.4, pero hasta ahora, no pude hacerlo funcionar
En estado env obtengo:
100.0 % of the requests are failing with HTTP 5xx
también en /var/log/nginx/error.log
[error] 2459#2459: *596 connect() to unix:///var/run/puma/my_app.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 172.31.34.113, server: _, request: "POST / HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/", host: "52.29.66.93"
y en /var/log/puma/puma.log
[4898] ! Unable to start worker
[4898] /opt/rubies/ruby-3.0.3/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:309:in `check_for_activated_spec!'
[4898] Early termination of worker
se ve pumactl
bien
[[email protected] ~]$ pumactl -V
5.6.2
Si reviso los procesos:
ps aux | grep puma
healthd 25925 0.0 3.6 828800 36624 ? Ssl 09:39 0:15 puma 5.3.2 (tcp://127.0.0.1:22221) [healthd]
webapp 26497 0.2 2.2 255768 22912 ? Ss 09:40 1:07 puma 5.6.2 (unix:///var/run/puma/my_app.sock) [current]
webapp 28653 64.0 2.1 327180 21668 ? Rl 16:08 0:00 puma: cluster worker 0: 26497 [current]
ec2-user 28656 0.0 0.0 119420 924 pts/0 S+ 16:08 0:00 grep --color=auto puma
Así que el puma está corriendo... ¿correcto?
Además, hay otro puma v5.3.2
¿Quizás esta otra versión de puma se usa por otra razón (servicio de salud)?
En la aplicación Rails tengo lo siguiente:
.ebextensions/02_yarn.config
commands:
01_node_get:
cwd: /tmp
command: 'curl --silent --location https://rpm.nodesource.com/setup_14.x | sudo bash -'
02_node_install:
cwd: /tmp
command: 'yum -y install nodejs'
03_yarn_get:
cwd: /tmp
# don't run the command if yarn is already installed (file /usr/bin/yarn exists)
test: '[ ! -f /usr/bin/yarn ] && echo "yarn not installed"'
command: 'sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo'
04_yarn_install:
cwd: /tmp
test: '[ ! -f /usr/bin/yarn ] && echo "yarn not installed"'
command: 'sudo yum -y install yarn'
05_mkdir_webapp_dir:
command: "mkdir /home/webapp"
ignoreErrors: true
06_chown_webapp_dir:
command: "chown webapp:webapp /home/webapp"
ignoreErrors: true
07_chmod_webapp_dir:
command: "chmod 0744 /home/webapp"
ignoreErrors: true
08_chmod_logs:
command: "chown webapp:webapp -R /var/app/current/log/"
ignoreErrors: true
09_create_log_file:
command: "touch /var/app/current/log/production.log"
ignoreErrors: true
10_chown_log_production:
command: "chown webapp:webapp /var/app/current/log/production.log"
ignoreErrors: true
11_chmod_log_dir:
command: "chmod 0664 -R /var/app/current/log/"
ignoreErrors: true
12_update_bundler:
command: "gem update bundler"
ignoreErrors: true
13_chown_current:
command: "chown webapp:webapp -R /var/app/current/"
ignoreErrors: true
14_chmod_current:
command: "chmod 0755 -R /var/app/current/"
ignoreErrors: true
15_chown_current:
command: "chown webapp:webapp -R /var/app/ondeck/"
ignoreErrors: true
16_chown_current:
command: "chmod 0644 -R /var/app/ondeck/"
ignoreErrors: true
container_commands:
17_install_webpack:
command: "npm install --save-dev webpack"
18_precompile:
command: "bundle exec rake assets:precompile"
.ebextensions/03_nginx.config
files:
"/etc/nginx/conf.d/02_app_server.conf":
mode: "000644"
owner: root
group: root
content: |
# The content of this file is based on the content of /etc/nginx/conf.d/webapp_healthd.conf
# Change the name of the upstream because it can't have the same name
# as the one defined by default in /etc/nginx/conf.d/webapp_healthd.conf
upstream new_upstream_name {
server unix:///var/run/puma/my_app.sock;
}
# Change the name of the log_format because it can't have the same name
# as the one defined by default in /etc/nginx/conf.d/webapp_healthd.conf
log_format new_log_name_healthd '$msec"$uri"'
'$status"$request_time"$upstream_response_time"'
'$http_x_forwarded_for';
server {
listen 80;
server_name _ localhost; # need to listen to localhost for worker tier
if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})T(\d{2})") {
set $year $1;
set $month $2;
set $day $3;
set $hour $4;
}
access_log /var/log/nginx/access.log main;
# Match the name of log_format directive which is defined above
access_log /var/log/nginx/healthd/application.log.$year-$month-$day-$hour new_log_name_healthd;
location / {
# Match the name of upstream directive which is defined above
proxy_pass http://new_upstream_name;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /assets {
alias /var/app/current/public/assets;
gzip_static on;
gzip on;
expires max;
add_header Cache-Control public;
}
location /public {
alias /var/app/current/public;
gzip_static on;
gzip on;
expires max;
add_header Cache-Control public;
}
location /packs {
alias /var/app/current/public/packs;
gzip_static on;
gzip on;
expires max;
add_header Cache-Control public;
}
}
container_commands:
01_restart_nginx:
command: "sudo service nginx reload"
¿Alguna idea de por qué no funciona?
En la .ebextensions/03_nginx.config
sección hay files
una entrada para /etc/nginx/conf.d/02_app_server.conf
, pero no existe tal archivo:
ls -ls /etc/nginx/conf.d/
total 8
0 drwxr-xr-x 2 root root 45 Apr 8 15:42 elasticbeanstalk
4 -rw-r--r-- 1 root root 62 Apr 8 15:42 elasticbeanstalk-nginx-ruby-upstream.conf
4 -rw-r--r-- 1 root root 147 Apr 8 15:42 healthd_logformat.conf
¿Esta bien?
Muchas gracias de antemano por su amable ayuda y apoyo y por su valioso tiempo.
Les deseo a todos lo mejor y una increíble continuación en nuestras vidas...