summaryrefslogtreecommitdiff
path: root/scripts/stop-debug.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/stop-debug.sh')
-rwxr-xr-xscripts/stop-debug.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/stop-debug.sh b/scripts/stop-debug.sh
new file mode 100755
index 0000000..8976d2c
--- /dev/null
+++ b/scripts/stop-debug.sh
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
+repo_dir="$(cd -- "$script_dir/.." && pwd)"
+env_file="${AIGW_DEBUG_ENV_FILE:-$repo_dir/.env.debug}"
+
+command -v docker >/dev/null 2>&1 || {
+ printf '[aigw-debug] error: docker is not installed\n' >&2
+ exit 1
+}
+
+if [[ -f "$env_file" ]]; then
+ compose=(docker compose --env-file "$env_file")
+else
+ export AIGW_CREDENTIAL_KEY=debug-stop-placeholder
+ export AIGW_ADMIN_TOKEN=debug-stop-placeholder
+ export AIGW_STRIPE_API_KEY=debug-stop-placeholder
+ export AIGW_STRIPE_WEBHOOK_SECRET=debug-stop-placeholder
+ compose=(docker compose)
+fi
+
+cd "$repo_dir"
+printf '[aigw-debug] stopping services\n'
+"${compose[@]}" down --remove-orphans
+printf '[aigw-debug] stopped; PostgreSQL and Redis volumes were preserved\n'