pagepiper/manage.sh
pyr0ball c24bd33478 feat(deploy): add cloud deploy config for pagepiper.circuitforge.tech
- compose.cloud.yml: pagepiper-cloud project on port 8533 (avoids
  conflict with Linnet dev on 8521/Magpie on 8531)
- docker/web/nginx.cloud.conf: handles both /pagepiper/* path (primary
  domain, no Caddy strip) and / path (menagerie, Caddy strips prefix)
- docker/web/Dockerfile: NGINX_CONF build arg to select dev vs cloud conf
- .env.cloud.example: cloud env template with BYOK gate vars
- manage.sh: cloud:start|stop|restart|status|logs|build commands

Caddy config updated separately (not in this repo).
DNS record needed: pagepiper.circuitforge.tech → Heimdall edge IP.
2026-05-05 07:12:48 -07:00

75 lines
2.2 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
SERVICE=pagepiper
WEB_PORT=8521
CLOUD_WEB_PORT=8533
COMPOSE_FILE="compose.yml"
COMPOSE_CLOUD_FILE="compose.cloud.yml"
CLOUD_PROJECT="pagepiper-cloud"
OVERRIDE_ARGS=()
[[ -f "compose.override.yml" ]] && OVERRIDE_ARGS=(-f compose.override.yml)
usage() {
echo "Usage: $0 {start|stop|restart|status|logs [svc]|open|build|test"
echo " |cloud:start|cloud:stop|cloud:restart|cloud:status|cloud:logs [svc]|cloud:build}"
exit 1
}
cmd="${1:-help}"
shift || true
case "$cmd" in
start)
docker compose -f "$COMPOSE_FILE" "${OVERRIDE_ARGS[@]}" up -d --build
echo "Pagepiper running → http://localhost:${WEB_PORT}"
;;
stop)
docker compose -f "$COMPOSE_FILE" "${OVERRIDE_ARGS[@]}" down
;;
restart)
docker compose -f "$COMPOSE_FILE" "${OVERRIDE_ARGS[@]}" down
docker compose -f "$COMPOSE_FILE" "${OVERRIDE_ARGS[@]}" up -d --build
echo "Pagepiper running → http://localhost:${WEB_PORT}"
;;
status)
docker compose -f "$COMPOSE_FILE" "${OVERRIDE_ARGS[@]}" ps
;;
logs)
docker compose -f "$COMPOSE_FILE" "${OVERRIDE_ARGS[@]}" logs -f "${1:-}"
;;
open)
xdg-open "http://localhost:${WEB_PORT}" 2>/dev/null || open "http://localhost:${WEB_PORT}"
;;
build)
docker compose -f "$COMPOSE_FILE" "${OVERRIDE_ARGS[@]}" build --no-cache
;;
test)
conda run -n cf pytest tests/ -v
;;
cloud:start)
docker compose -f "$COMPOSE_CLOUD_FILE" -p "$CLOUD_PROJECT" up -d --build
echo "Pagepiper cloud running → http://localhost:${CLOUD_WEB_PORT}"
;;
cloud:stop)
docker compose -f "$COMPOSE_CLOUD_FILE" -p "$CLOUD_PROJECT" down
;;
cloud:restart)
docker compose -f "$COMPOSE_CLOUD_FILE" -p "$CLOUD_PROJECT" down
docker compose -f "$COMPOSE_CLOUD_FILE" -p "$CLOUD_PROJECT" up -d --build
echo "Pagepiper cloud running → http://localhost:${CLOUD_WEB_PORT}"
;;
cloud:status)
docker compose -f "$COMPOSE_CLOUD_FILE" -p "$CLOUD_PROJECT" ps
;;
cloud:logs)
docker compose -f "$COMPOSE_CLOUD_FILE" -p "$CLOUD_PROJECT" logs -f "${1:-}"
;;
cloud:build)
docker compose -f "$COMPOSE_CLOUD_FILE" -p "$CLOUD_PROJECT" build --no-cache
;;
*)
usage
;;
esac