cvx
Some checks are pending
Deploy on push / detect (push) Waiting to run
Deploy on push / deploy_swarm (push) Blocked by required conditions
Deploy on push / deploy_compose (push) Blocked by required conditions

This commit is contained in:
traveler 2026-03-29 20:38:20 -05:00
parent 2eb1e2bb80
commit 042d90cf7f
2 changed files with 51 additions and 1 deletions

View file

@ -0,0 +1,50 @@
#!/bin/bash
# =============================================================================
# Gremlin Stack — Deploy Script
# Usage: ./deploy.sh
# Run from: services/swarm/stack/Gremlin/
# =============================================================================
set -euo pipefail
STACK_NAME="gremlin"
COMPOSE_FILE="gremlin-stack.yml"
ENV_FILE=".env"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
if [ ! -f "$ENV_FILE" ]; then
echo "ERROR: $ENV_FILE not found in $SCRIPT_DIR"
exit 1
fi
if [ ! -f "$COMPOSE_FILE" ]; then
echo "ERROR: $COMPOSE_FILE not found in $SCRIPT_DIR"
exit 1
fi
RESOLVED_FILE="${COMPOSE_FILE%.yml}.resolved.yml"
# Load env vars into shell so docker stack config can resolve them
echo "Loading environment from $ENV_FILE..."
set -a
source "$ENV_FILE"
set +a
# Preprocess — resolves all ${VAR} substitutions natively
echo "Preprocessing stack file..."
docker stack config --compose-file "$COMPOSE_FILE" > "$RESOLVED_FILE"
# Deploy from the resolved file
echo "Deploying stack: $STACK_NAME"
docker stack deploy --compose-file "$RESOLVED_FILE" "$STACK_NAME"
# Remove resolved file — contains plaintext secrets
rm -f "$RESOLVED_FILE"
echo "Cleaned up resolved file."
echo ""
echo "Deploy complete. Checking services..."
sleep 3
docker stack services "$STACK_NAME"