Hola a todos.
Tuve un problema al reconstruir (actualizar) Discourse; en el registro encontré que durante la configuración, se lanza Redis por primera vez sin problemas, pero después de un tiempo, la configuración intenta lanzarlo de nuevo y falla debido a “server TCP listening socket *:6379: bind: Address already in use”.
Después de varios intentos y errores, también con la ayuda de Gemini, puse este fragmento de código dentro de app.yml:
hooks: before_db_migrate: - exec: cmd: - "pkill -9 redis-server || true" - "sleep 2" - "exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf &" - "sleep 5"
y finalmente la reconstrucción continúa.
Aquí hay un fragmento del registro con mi solución matando la instancia de Redis reacia y reiniciándola:
389:C 24 Feb 2026 17:07:21.756 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
389:C 24 Feb 2026 17:07:21.756 * Redis version=7.4.7, bits=64, commit=00000000, modified=1, pid=389, just started
389:C 24 Feb 2026 17:07:21.756 * Configuration loaded
389:M 24 Feb 2026 17:07:21.756 * monotonic clock: POSIX clock_gettime
389:M 24 Feb 2026 17:07:21.757 * Running mode=standalone, port=6379.
389:M 24 Feb 2026 17:07:21.757 # Warning: Could not create server TCP listening socket *:6379: bind: Address already in use
389:M 24 Feb 2026 17:07:21.757 # Failed listening on port 6379 (tcp), aborting.
I, [2026-02-24T17:07:31.750972 #1] INFO -- : > pkill -9 redis-server || true
I, [2026-02-24T17:07:31.758767 #1] INFO -- : > sleep 2
I, [2026-02-24T17:07:33.761955 #1] INFO -- : > exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf &
I, [2026-02-24T17:07:33.765205 #1] INFO -- : > sleep 5
396:C 24 Feb 2026 17:07:33.773 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
396:C 24 Feb 2026 17:07:33.773 * Redis version=7.4.7, bits=64, commit=00000000, modified=1, pid=396, just started
396:C 24 Feb 2026 17:07:33.773 * Configuration loaded
396:M 24 Feb 2026 17:07:33.773 * monotonic clock: POSIX clock_gettime
396:M 24 Feb 2026 17:07:33.774 * Running mode=standalone, port=6379.
396:M 24 Feb 2026 17:07:33.775 * Server initialized
396:M 24 Feb 2026 17:07:33.776 * Loading RDB produced by version 7.4.7
396:M 24 Feb 2026 17:07:33.776 * RDB age 19606 seconds
396:M 24 Feb 2026 17:07:33.776 * RDB memory usage when created 4.60 Mb
396:M 24 Feb 2026 17:07:33.787 * Done loading RDB, keys loaded: 3413, keys expired: 1.
396:M 24 Feb 2026 17:07:33.788 * DB loaded from disk: 0.013 seconds
396:M 24 Feb 2026 17:07:33.788 * Ready to accept connections tcp
Mi pregunta ahora es: ¿POR QUÉ dos lanzamientos de Redis? ¿Y por qué el segundo encuentra al primero todavía colgado en el puerto 6379? Y de nuevo, ¿por qué no intenta usarlo, si ya está disponible? Y, por último, ¿qué pudo haber causado este problema? Sé muy bien que puse un ungüento en una herida sin saber POR QUÉ existe la herida, pero al menos ahora está funcionando.
Antes de que alguien me pregunte, NO, no tengo ningún otro Redis ejecutándose fuera de Discourse (de lo contrario, el primer intento al comienzo de la reconstrucción debería haber fallado), y SÍ, Discourse se está ejecutando con muchos otros contenedores en Docker, aunque nunca tuvo un problema así hasta hace algunas actualizaciones.
Cualquier ayuda y consejo es bienvenido, y disculpas si ya está resuelto en otro tema, pero busqué sin éxito.