방금 Production의 tests-passed 온라인 재빌드 후 502 Bad Gateway 오류 발생

서버 재시작, 컨테이너 재시작, 콘솔 재구축을 시도했지만 해결되지 않습니다.

./launcher enter app 명령을 실행할 수 있으므로 컨테이너는 실행 중입니다.

로그에 다음과 같은 오류가 여러 개 표시되었습니다. Redis 실패 원인을 조사하는 방법에 대한 아이디어가 있을까요?

Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL) subscribe failed, reconnecting in 1 second. Call stack /var/www/discourse/vendor/bundle/ruby/3.2.0/gems/redis-4.8.1/lib/redis/client.rb:398:in `rescue in establish_connection'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/redis-4.8.1/lib/redis/client.rb:379:in `establish_connection'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/redis-4.8.1/lib/redis/client.rb:115:in `block in connect'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/redis-4.8.1/lib/redis/client.rb:344:in `with_reconnect'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/redis-4.8.1/lib/redis/client.rb:114:in `connect'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/redis-4.8.1/lib/redis/client.rb:409:in `ensure_connected'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/redis-4.8.1/lib/redis/client.rb:269:in `block in process'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/redis-4.8.1/lib/redis/client.rb:356:in `logging'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/redis-4.8.1/lib/redis/client.rb:268:in `process'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/redis-4.8.1/lib/redis/client.rb:161:in `call'first? 

좋은 방법인지 확신이 서지 않지만, 수동으로 시작해 보았습니다:

/var/www/discourse# redis-server
3770:C 14 Dec 2023 17:20:17.171 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
3770:C 14 Dec 2023 17:20:17.171 # Redis version=7.0.7, bits=64, commit=00000000, modified=0, pid=3770, just started
3770:C 14 Dec 2023 17:20:17.171 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
3770:M 14 Dec 2023 17:20:17.173 * monotonic clock: POSIX clock_gettime
3770:M 14 Dec 2023 17:20:17.173 # Warning: Could not create server TCP listening socket *:6379: bind: Address already in use
3770:M 14 Dec 2023 17:20:17.173 # Failed listening on port 6379 (TCP), aborting.

redis가 실제로 컨테이너 내에서 실행 중인가요?

sv가 실행 중이라고 판단하고 있나요?

root@michael-discourse-docker-app:/# sv status redis
run: redis: (pid 548) 9843135s; run: log: (pid 547) 9843135s

/var/log/redis/current에 어떤 내용이 표시되나요?

(실행 중이라면) sv down redis를 실행한 후 sv up redis를 실행해 볼 수 있나요?

그 후 관련 로그가 표시되나요?

/var/www/discourse/log# sv status redis
run: redis: (pid 565) 1430s; run: log: (pid 560) 1430s
/var/www/discourse/log# sv down redis
/var/www/discourse/log# sv up redis
/var/www/discourse/log# tail /var/log/redis/current
4766:M 14 Dec 2023 17:26:20.195 * monotonic clock: POSIX clock_gettime
4766:M 14 Dec 2023 17:26:20.195 * Running mode=standalone, port=6379.
4766:M 14 Dec 2023 17:26:20.195 # Server initialized
4766:M 14 Dec 2023 17:26:20.195 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
4766:M 14 Dec 2023 17:26:20.196 * Loading RDB produced by version 7.0.7
4766:M 14 Dec 2023 17:26:20.196 * RDB age 3 seconds
4766:M 14 Dec 2023 17:26:20.196 * RDB memory usage when created 24.56 Mb
4766:M 14 Dec 2023 17:26:20.317 * Done loading RDB, keys loaded: 21165, keys expired: 3.
4766:M 14 Dec 2023 17:26:20.317 * DB loaded from disk: 0.121 seconds
4766:M 14 Dec 2023 17:26:20.317 * Ready to accept connections

문제를 찾았어요! 플러그인 때문이었어요! (제거했어요!!)

마이크, 고마워요. Zeitwerk의 네이밍 규칙 위반이었네요! (참고로 Rubocop이 잡아주지 않았고, Dev 환경에서는 정상 작동했어요.)

하지만 그 명령어들은 나중에 참고할 때 정말, 정말 유용할 것 같아요!