#!/usr/bin/env bash # tangle-deploy — Tangle infrastructure.org and restart affected services GITEA_URL='http://amr:tangle-deploy-2026@10.10.10.201:3001/amr/infrastructure.git' REPO_DIR="${1:-/docker/compose/infrastructure}" ORG_FILE="${REPO_DIR}/infrastructure.org" if [ -z "${1:-}" ]; then if [ ! -d "$REPO_DIR" ]; then git clone "$GITEA_URL" "$REPO_DIR" else cd "$REPO_DIR" && git pull fi fi if [ ! -f "$ORG_FILE" ]; then echo "ERROR: $ORG_FILE not found in $REPO_DIR" exit 1 fi echo "=== Tangling $ORG_FILE ===" emacs --batch -Q --load /usr/share/emacs/28.2/lisp/org/org-loaddefs.el \ --eval "(require 'org)" \ --eval "(org-babel-tangle-file \"$ORG_FILE\")" 2>&1 echo "=== Restarting services ===" cd /docker/compose if [ -f /docker/compose/traefik-static.yaml ] || \ [ -f /docker/compose/traefik-internal.yaml ] || \ [ -f /docker/compose/traefik-internal-noauth.yaml ] || \ [ -f /docker/compose/traefik-dynamic.yaml ]; then echo 'Traefik config changed -- restarting...' docker compose up -d traefik fi if [ -f /docker/compose/docker-compose.yaml ]; then echo 'Docker compose changed -- restarting all services' docker compose up -d 2>&1 | tail -5 fi echo '=== Deploy complete ==='