Unify Wiki and Studio application and simplify deployment
Unified application CI and deployment / verify-and-release (pull_request) Waiting to run
python CI and deployment / verify-and-deploy (pull_request) Successful in 1m12s

This commit is contained in:
2026-11-04 03:41:16 +08:00
parent 80d23f0e3d
commit 6654a1456b
101 changed files with 304 additions and 1776 deletions
+7 -15
View File
@@ -1,17 +1,9 @@
#!/usr/bin/env bash
set -Eeuo pipefail
IMAGE="${1:?Application image is required}"
# Preserve existing credentials and Docker project/volume names during migration.
if [ ! -f /etc/prompt.env ]; then
umask 077
TEMP_ENV=$(mktemp /etc/prompt.env.XXXXXX)
trap 'rm -f "$TEMP_ENV"' EXIT
docker run --rm --entrypoint node "$IMAGE" -e "const {randomBytes}=require('crypto');const hex=()=>randomBytes(32).toString('hex');console.log('POSTGRES_PASSWORD='+hex()+'\nS3_ACCESS_KEY='+hex()+'\nS3_SECRET_KEY='+hex()+'\nS3_BUCKET=prompt')" > "$TEMP_ENV"
mv "$TEMP_ENV" /etc/prompt.env
trap - EXIT
fi
# Current public entry uses HTTP. Operators can set true here after enabling HTTPS.
if ! grep -q '^AUTH_COOKIE_SECURE=' /etc/prompt.env; then
printf '\nAUTH_COOKIE_SECURE=false\n' >> /etc/prompt.env
fi
# Provision credentials and base containers separately; normal releases only verify.
test -s /etc/prompt.env || { echo 'Missing /etc/prompt.env; initialize infrastructure separately' >&2; exit 1; }
for service in postgres objects; do
id=$(docker compose -p prompt --env-file /etc/prompt.env -f compose.yml ps -q "$service")
test -n "$id" || { echo "Infrastructure missing: $service; run scripts/init-infra.sh separately" >&2; exit 1; }
test "$(docker inspect --format '{{.State.Running}}' "$id")" = true
done