#!/bin/sh # Deploy ss-atlas + infra in local swarm mode for testing subscribe → deploy → teardown. # Customer stacks get clientname.app.a250.ca. Run scripts/local-dns-setup.sh first for DNS. set -e cd "$(dirname "$0")/.." if [ -n "$(git status --porcelain)" ]; then echo "ERROR: Working tree is dirty. Commit your changes before deploying." >&2 exit 1 fi BUILD_COMMIT="$(git rev-parse --short HEAD)" BUILD_TIME="$(date -u +%Y-%m-%dT%H:%M:%SZ)" echo "=== Building commit $BUILD_COMMIT ===" echo "=== Ensuring swarm mode ===" docker info --format '{{.Swarm.LocalNodeState}}' | grep -q "active" || docker swarm init echo "=== Creating overlay network for customer stacks ===" docker network inspect authelia_dev >/dev/null 2>&1 || \ docker network create -d overlay --attachable authelia_dev echo "=== Building ss-atlas ===" docker compose -f docker-compose.dev.yml build \ --build-arg BUILD_COMMIT="$BUILD_COMMIT" \ --build-arg BUILD_TIME="$BUILD_TIME" \ ss-atlas echo "=== Deploying with swarm overlay ===" docker compose -f docker-compose.dev.yml -f docker-compose.swarm-dev.yml up -d echo "" echo "=== Ready. Test flow: ===" echo " 1. Add /etc/hosts or dnsmasq: *.app.a250.ca, app.bc.a250.ca, login.bc.a250.ca -> 127.0.0.1" echo " 2. Visit http://app.bc.a250.ca, subscribe (Stripe test), activate" echo " 3. After activate, customer stack deploys -> http://.app.a250.ca" echo " 4. Cancel subscription -> webhook tears down stack"