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