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 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-02-10 02:21:48 +00:00
parent 8d7466e73a
commit 724ae9b371
1 changed files with 18 additions and 5 deletions

View File

@ -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."