Unify Wiki and Studio application and simplify deployment
This commit is contained in:
+7
-15
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user