50 lines
1.2 KiB
Bash
Executable file
50 lines
1.2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SERVICE=pagepiper
|
|
WEB_PORT=8521
|
|
COMPOSE_FILE="compose.yml"
|
|
|
|
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}"
|
|
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
|
|
;;
|
|
*)
|
|
usage
|
|
;;
|
|
esac
|