mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2026-07-31 07:49:07 -04:00
- Introduced .dockerignore to exclude unnecessary files from Docker context. - Added .env.aio.example for minimal configuration of the AdventureLog All-in-One setup. - Updated .env.example to include optional SITE_URL and GUNICORN_WORKERS settings. - Enhanced deploy.sh script for improved deployment flexibility and backup options. - Updated docker-compose files to use PostGIS 16-3.5 and added health checks for services. - Created docker-compose.aio.yml for All-in-One deployment configuration. - Improved health checks and service dependencies in docker-compose.dev.yml and docker-compose.yml. - Added GitHub workflows for building and pushing Docker images, including smoke tests for AIO setup.
70 lines
1.6 KiB
Bash
Executable File
70 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# Deploy the latest AdventureLog Docker images. Safe for cron/automation.
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
cd "$SCRIPT_DIR"
|
|
|
|
COMPOSE_FILE="${COMPOSE_FILE:-}"
|
|
ENV_FILE=""
|
|
LOG_CONTAINER=""
|
|
FOLLOW_LOGS=false
|
|
DO_BACKUP=false
|
|
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--logs) FOLLOW_LOGS=true ;;
|
|
--backup) DO_BACKUP=true ;;
|
|
esac
|
|
done
|
|
|
|
if [[ -z "$COMPOSE_FILE" ]]; then
|
|
if [[ -f .env.aio ]] && [[ ! -f .env ]]; then
|
|
COMPOSE_FILE="docker-compose.aio.yml"
|
|
elif [[ -f .env.aio ]] && [[ -f docker-compose.aio.yml ]] && [[ "${ADVENTURELOG_COMPOSE:-}" == "aio" ]]; then
|
|
COMPOSE_FILE="docker-compose.aio.yml"
|
|
else
|
|
COMPOSE_FILE="docker-compose.yml"
|
|
fi
|
|
fi
|
|
|
|
case "$COMPOSE_FILE" in
|
|
*docker-compose.aio.yml*)
|
|
ENV_FILE=".env.aio"
|
|
LOG_CONTAINER="adventurelog-aio"
|
|
;;
|
|
*)
|
|
ENV_FILE=".env"
|
|
LOG_CONTAINER="adventurelog-backend"
|
|
;;
|
|
esac
|
|
|
|
COMPOSE=(docker compose -f "$COMPOSE_FILE")
|
|
if [[ -f "$ENV_FILE" ]]; then
|
|
COMPOSE=(docker compose --env-file "$ENV_FILE" -f "$COMPOSE_FILE")
|
|
fi
|
|
|
|
if [[ -f "$ENV_FILE" ]] && [[ -f scripts/validate-env.sh ]]; then
|
|
echo "Validating $ENV_FILE ..."
|
|
bash scripts/validate-env.sh "$ENV_FILE"
|
|
fi
|
|
|
|
if [[ "$DO_BACKUP" == true ]]; then
|
|
if [[ -f scripts/backup.sh ]]; then
|
|
COMPOSE_FILE="$COMPOSE_FILE" bash scripts/backup.sh
|
|
else
|
|
echo "WARNING: scripts/backup.sh not found; skipping backup" >&2
|
|
fi
|
|
fi
|
|
|
|
echo "Deploying latest version of AdventureLog ($COMPOSE_FILE)"
|
|
"${COMPOSE[@]}" pull
|
|
echo "Starting containers"
|
|
"${COMPOSE[@]}" up -d --wait 2>/dev/null || "${COMPOSE[@]}" up -d
|
|
echo "All set!"
|
|
"${COMPOSE[@]}" ps
|
|
|
|
if [[ "$FOLLOW_LOGS" == true ]]; then
|
|
docker logs "$LOG_CONTAINER" --follow
|
|
fi
|