37 lines
1.2 KiB
Bash
37 lines
1.2 KiB
Bash
#!/usr/bin/env bash
|
|
# Build and start the InboxIntel stack using deploy/.env for secrets.
|
|
# Usage: ./deploy/up.sh [--proxy] [--foreground]
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
ENV_FILE="$SCRIPT_DIR/.env"
|
|
|
|
[ -f "$ENV_FILE" ] || { echo "Missing $ENV_FILE. Create it from .env.example." >&2; exit 1; }
|
|
|
|
# Fail fast if a required key is blank.
|
|
for key in POSTGRES_PASSWORD GOOGLE_CLIENT_ID GOOGLE_CLIENT_SECRET; do
|
|
val="$(grep -E "^${key}=" "$ENV_FILE" | head -1 | cut -d= -f2- | tr -d '[:space:]' || true)"
|
|
[ -n "$val" ] || { echo "deploy/.env is missing a value for: $key" >&2; exit 1; }
|
|
done
|
|
|
|
PROFILE_ARGS=()
|
|
DETACH="-d"
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--proxy) PROFILE_ARGS=(--profile proxy) ;;
|
|
--foreground) DETACH="" ;;
|
|
*) echo "Unknown arg: $arg" >&2; exit 1 ;;
|
|
esac
|
|
done
|
|
|
|
cd "$ROOT"
|
|
echo "Starting InboxIntel via docker compose (env: deploy/.env)..."
|
|
docker compose --env-file "$ENV_FILE" "${PROFILE_ARGS[@]}" up --build $DETACH
|
|
|
|
if [ -n "$DETACH" ]; then
|
|
docker compose --env-file "$ENV_FILE" ps
|
|
echo
|
|
echo "Frontend: http://localhost:8081 API/Swagger: http://localhost:8080/swagger"
|
|
fi
|