fix: single stack.yaml for all containers (avoids pod conflicts)

This commit is contained in:
Claus Lohmar 2026-07-10 16:40:39 +01:00
parent b555f153be
commit 12b2a787ab
5 changed files with 68 additions and 82 deletions

View file

@ -1,22 +0,0 @@
services:
authelia:
image: git24hcom/authelia:latest
container_name: authelia
restart: unless-stopped
expose:
- "9091"
- "8080"
volumes:
- /opt/nextworkspace/config/authelia/:/config/
- /opt/nextworkspace/data/authelia/:/data/
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:9091/api/health"]
interval: 30s
timeout: 10s
retries: 3
networks:
- nextwks-net
networks:
nextwks-net:
external: true

View file

@ -1,24 +0,0 @@
services:
caddy:
image: caddy:latest
container_name: caddy
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- /opt/nextworkspace/config/caddy/:/etc/caddy/
- /opt/nextworkspace/data/caddy/:/data/
- /opt/nextworkspace/logs/caddy/:/var/log/caddy/
- /opt/nextworkspace/www/:/opt/nextworkspace/www/
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:80/"]
interval: 30s
timeout: 10s
retries: 3
networks:
- nextwks-net
networks:
nextwks-net:
external: true

View file

@ -1,25 +0,0 @@
services:
launcher:
image: alpine:latest
container_name: launcher
restart: unless-stopped
expose:
- "9000"
volumes:
- /opt/nextworkspace/:/opt/nextworkspace/
working_dir: /opt/nextworkspace
command: /opt/nextworkspace/nextworkspace
env_file: /opt/nextworkspace/.env
environment:
- CONFIG_DIR=/opt/nextworkspace/config/nextworkspace
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:9000/health"]
interval: 30s
timeout: 10s
retries: 3
networks:
- nextwks-net
networks:
nextwks-net:
external: true

63
compose/stack.yaml Normal file
View file

@ -0,0 +1,63 @@
services:
caddy:
image: caddy:latest
container_name: caddy
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- /opt/nextworkspace/config/caddy/:/etc/caddy/
- /opt/nextworkspace/data/caddy/:/data/
- /opt/nextworkspace/logs/caddy/:/var/log/caddy/
- /opt/nextworkspace/www/:/opt/nextworkspace/www/
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:80/"]
interval: 30s
timeout: 10s
retries: 3
networks:
- nextwks-net
authelia:
image: git24hcom/authelia:latest
container_name: authelia
restart: unless-stopped
expose:
- "9091"
- "8080"
volumes:
- /opt/nextworkspace/config/authelia/:/config/
- /opt/nextworkspace/data/authelia/:/data/
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:9091/api/health"]
interval: 30s
timeout: 10s
retries: 3
networks:
- nextwks-net
launcher:
image: alpine:latest
container_name: launcher
restart: unless-stopped
expose:
- "9000"
volumes:
- /opt/nextworkspace/:/opt/nextworkspace/
working_dir: /opt/nextworkspace
command: /opt/nextworkspace/nextworkspace
env_file: /opt/nextworkspace/.env
environment:
- CONFIG_DIR=/opt/nextworkspace/config/nextworkspace
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:9000/health"]
interval: 30s
timeout: 10s
retries: 3
networks:
- nextwks-net
networks:
nextwks-net:
external: true

View file

@ -88,21 +88,17 @@ if [ "$GREENFIELD" = true ]; then
"$SCRIPT_DIR/config/authelia/users_database.yml" > "$TARGET_DIR/config/authelia/users_database.yml" "$SCRIPT_DIR/config/authelia/users_database.yml" > "$TARGET_DIR/config/authelia/users_database.yml"
# Copy files # Copy files
cp "$SCRIPT_DIR/compose/caddy.yaml" "$TARGET_DIR/compose/caddy.yaml" cp "$SCRIPT_DIR/compose/stack.yaml" "$TARGET_DIR/compose/stack.yaml"
cp "$SCRIPT_DIR/compose/authelia.yaml" "$TARGET_DIR/compose/authelia.yaml"
cp "$SCRIPT_DIR/compose/launcher.yaml" "$TARGET_DIR/compose/launcher.yaml"
cp nextworkspace "$TARGET_DIR/nextworkspace" cp nextworkspace "$TARGET_DIR/nextworkspace"
if [ -f "$REPO_DIR/VERSION" ]; then cp "$REPO_DIR/VERSION" "$TARGET_DIR/VERSION"; fi if [ -f "$REPO_DIR/VERSION" ]; then cp "$REPO_DIR/VERSION" "$TARGET_DIR/VERSION"; fi
if [ -d "$SCRIPT_DIR/config/www" ]; then cp -r "$SCRIPT_DIR/config/www"/* "$TARGET_DIR/www/"; fi if [ -d "$SCRIPT_DIR/config/www" ]; then cp -r "$SCRIPT_DIR/config/www"/* "$TARGET_DIR/www/"; fi
cp -r "$SCRIPT_DIR/config/nextworkspace"/* "$TARGET_DIR/config/nextworkspace/" 2>/dev/null || true cp -r "$SCRIPT_DIR/config/nextworkspace"/* "$TARGET_DIR/config/nextworkspace/" 2>/dev/null || true
# Podman network + deploy all 3 containers # Podman network + deploy stack
echo "[5/5] Deploying containers on $NETWORK_NAME..." echo "[5/5] Deploying containers on $NETWORK_NAME..."
podman network create "$NETWORK_NAME" 2>/dev/null || true podman network create "$NETWORK_NAME" 2>/dev/null || true
for COMPOSE in launcher authelia caddy; do podman-compose -f "$TARGET_DIR/compose/stack.yaml" down 2>/dev/null || true
podman-compose -f "$TARGET_DIR/compose/$COMPOSE.yaml" down 2>/dev/null || true podman-compose -f "$TARGET_DIR/compose/stack.yaml" up -d 2>&1 || echo "[WARN] Stack deploy had issues"
podman-compose -f "$TARGET_DIR/compose/$COMPOSE.yaml" up -d 2>&1 || echo "[WARN] $COMPOSE deploy had issues"
done
sleep 3 sleep 3
AUTHELIA_SECRET=$(grep -oP 'session_secret: \K.*' "$TARGET_DIR/config/authelia/configuration.yml" 2>/dev/null || echo "") AUTHELIA_SECRET=$(grep -oP 'session_secret: \K.*' "$TARGET_DIR/config/authelia/configuration.yml" 2>/dev/null || echo "")
@ -113,9 +109,7 @@ if [ "$GREENFIELD" = true ]; then
# --- Smart update --- # --- Smart update ---
else else
echo "[3/5] Redeploying containers..." echo "[3/5] Redeploying containers..."
podman-compose -f "$TARGET_DIR/compose/launcher.yaml" up -d 2>&1 || true podman-compose -f "$TARGET_DIR/compose/stack.yaml" up -d 2>&1 || true
podman-compose -f "$TARGET_DIR/compose/authelia.yaml" up -d 2>&1 || true
podman-compose -f "$TARGET_DIR/compose/caddy.yaml" restart 2>&1 || true
fi fi
# --- Health check --- # --- Health check ---