From 724ae9b371b5c473f6de72e57a58d19156a48c0d Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Tue, 10 Feb 2026 02:21:48 +0000 Subject: [PATCH] Update post-rebuild script to reconnect mailcow network and restart Traefik After ./launcher rebuild, the new container loses all external network connections. Script now reconnects both traefik-public and mailcow networks, and restarts Traefik to avoid stale routing (504 errors). Co-Authored-By: Claude Opus 4.6 --- scripts/post-rebuild.sh | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/scripts/post-rebuild.sh b/scripts/post-rebuild.sh index e90866e..9ee1851 100755 --- a/scripts/post-rebuild.sh +++ b/scripts/post-rebuild.sh @@ -1,11 +1,12 @@ #!/bin/bash -## Reconnect Discourse container to traefik-public network after rebuild +## Reconnect Discourse container to external networks after rebuild ## Run after every: ./launcher rebuild app ## ## The official launcher creates a NEW container on rebuild, which loses -## the external network connection. This script reconnects it. +## the external network connections. This script reconnects them and +## restarts Traefik to pick up the new routing. -CONTAINER_ID=$(docker ps -q -f name=app) +CONTAINER_ID=$(docker ps -q -f name='^app$') if [ -z "$CONTAINER_ID" ]; then echo "ERROR: Discourse container not running. Start it first: ./launcher start app" @@ -14,5 +15,17 @@ fi echo "Connecting Discourse container to traefik-public network..." docker network connect traefik-public "$CONTAINER_ID" 2>/dev/null && \ - echo "Connected successfully." || \ - echo "Already connected." + echo " Connected to traefik-public." || \ + echo " Already connected to traefik-public." + +echo "Connecting Discourse container to mailcow network..." +docker network connect mailcowdockerized_mailcow-network "$CONTAINER_ID" 2>/dev/null && \ + echo " Connected to mailcow network." || \ + echo " Already connected to mailcow network." + +echo "Restarting Traefik to pick up new container routing..." +docker restart traefik +echo " Traefik restarted." + +echo "" +echo "Done. Forum should be accessible in a few seconds."