Adds a puzzle-relay service (docker-compose.yml) running the same image as php but executing app:puzzle-relay instead of php-fpm, kept off the host network - only nginx can reach it. nginx proxies wss://dmtools.fvandenberg.nl/puzzle-ws/ through to it (docker/nginx/default.conf), with the public URL set via a new .env.prod. setup.sh/restart.sh now rebuild, restart, and clean up the new container alongside the existing ones. Still needs "Websockets Support" enabled on the NPM proxy host for this domain, or the upgrade headers never reach the container. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
41 lines
1.2 KiB
Bash
Executable File
41 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Fully restart the dmtools stack for this checkout (testing or live). Scoped to
|
|
# the compose project name, so running it from the test checkout never touches
|
|
# the prod stack.
|
|
#
|
|
# ./docker/restart.sh # down + rebuildless bring-up via setup.sh
|
|
# ./docker/restart.sh --prune-all # also run host-wide docker prune
|
|
|
|
DOCKER_DIR=$(cd "$(dirname "$0")" && pwd)
|
|
ROOT_DIR=$(cd "$DOCKER_DIR/.." && pwd)
|
|
PROJECT=dmtools
|
|
|
|
PRUNE_ALL=0
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--prune-all) PRUNE_ALL=1 ;;
|
|
*) echo "Unknown option: $arg" >&2; exit 1 ;;
|
|
esac
|
|
done
|
|
|
|
echo "Restarting stack: $PROJECT"
|
|
(cd "$ROOT_DIR" && docker compose -p "$PROJECT" -f docker-compose.yml down --remove-orphans) || true
|
|
|
|
docker rm -f dmtools-php dmtools-puzzle-relay dmtools-nginx dmtools-db 2>/dev/null || true
|
|
for net in $(docker network ls -q --filter "name=^${PROJECT}_" 2>/dev/null); do
|
|
docker network rm "$net" || true
|
|
done
|
|
|
|
if [ "$PRUNE_ALL" -eq 1 ]; then
|
|
echo "Host-wide prune..."
|
|
docker system prune -f || true
|
|
docker builder prune -af || true
|
|
else
|
|
echo "Skipping host-wide prune (pass --prune-all to force it)."
|
|
fi
|
|
|
|
echo "Running setup script..."
|
|
"$DOCKER_DIR/setup.sh" --no-build
|