Unify Wiki and Studio application and simplify deployment
This commit is contained in:
+12
-4
@@ -17,7 +17,7 @@ test "$(git -c safe.directory="$PWD" rev-parse HEAD)" = "$RELEASE_SHA"
|
||||
LATEST_MAIN=$(git -c safe.directory="$PWD" ls-remote origin refs/heads/main | cut -f1)
|
||||
if [ "$LATEST_MAIN" != "$RELEASE_SHA" ]; then
|
||||
git -c safe.directory="$PWD" fetch origin main
|
||||
if ! git -c safe.directory="$PWD" diff --quiet "$RELEASE_SHA" origin/main -- apps/waterfall-wiki Dockerfile compose.yml scripts/deploy.sh scripts/wiki-image-lifecycle.py scripts/infra.sh scripts/integration.sh scripts/auth-admin.sh .gitea/workflows/waterfall-wiki.yml pnpm-workspace.yaml; then
|
||||
if ! git -c safe.directory="$PWD" diff --quiet "$RELEASE_SHA" origin/main -- apps/waterfall-wiki Dockerfile compose.yml scripts/deploy.sh scripts/wiki-image-lifecycle.py scripts/infra.sh scripts/integration.sh scripts/auth-admin.sh .gitea/workflows/app.yml pnpm-workspace.yaml packages/brand; then
|
||||
echo 'Skipping deployment: Wiki has a newer commit'; exit 0
|
||||
fi
|
||||
fi
|
||||
@@ -61,7 +61,7 @@ rollback(){
|
||||
echo 'Restored the database backup compatible with the previous application'
|
||||
fi
|
||||
if [ -n "$PREVIOUS" ] && [ -f "$PREVIOUS/compose.yml" ]; then
|
||||
compose_at "$PREVIOUS" up -d --no-build "$PREVIOUS_WEB" "$PREVIOUS_WORKER"
|
||||
compose_at "$PREVIOUS" up -d --no-build --no-deps "$PREVIOUS_WEB" "$PREVIOUS_WORKER"
|
||||
echo 'Restored the previous Docker application image'
|
||||
else
|
||||
compose stop waterfall-wiki waterfall-wiki-worker
|
||||
@@ -82,7 +82,8 @@ rollback(){
|
||||
}
|
||||
trap rollback ERR
|
||||
# Keep the same prompt_postgres_data and prompt_objects volumes. No production down -v.
|
||||
compose up -d --no-build --wait --wait-timeout 120 postgres objects
|
||||
# Infrastructure already exists; never recreate it during an app release.
|
||||
compose exec -T postgres pg_isready -U prompt -d prompt
|
||||
install -d -o root -g root -m 0700 /var/lib/prompt/backups
|
||||
CUTOVER=1
|
||||
compose stop waterfall-wiki waterfall-wiki-worker
|
||||
@@ -98,7 +99,7 @@ CUTOVER=1
|
||||
# One-time migration: finish a current host worker job before switching the web port.
|
||||
if [ "$LEGACY_WORKER" -eq 1 ] || [ "$LEGACY_WORKER_ENABLED" -eq 1 ]; then systemctl disable --now prompt-worker.service; fi
|
||||
if [ "$LEGACY_WEB" -eq 1 ] || [ "$LEGACY_WEB_ENABLED" -eq 1 ]; then systemctl disable --now prompt.service; fi
|
||||
compose up -d --no-build --wait --wait-timeout 180 waterfall-wiki waterfall-wiki-worker
|
||||
compose up -d --no-build --no-deps --wait --wait-timeout 180 waterfall-wiki waterfall-wiki-worker
|
||||
compose exec -T waterfall-wiki node container-health.mjs
|
||||
compose exec -T waterfall-wiki node auth-cli.cjs verify
|
||||
compose exec -T waterfall-wiki node auth-cli.cjs run scripts/import-character-packs.mjs
|
||||
@@ -123,6 +124,8 @@ compose exec -T waterfall-wiki sh -c 'cat > /tmp/prompt-release-check.mjs && nod
|
||||
})().catch(error=>{console.error(error.message);process.exit(1)});
|
||||
NODE
|
||||
|
||||
bash scripts/verify-studio-production.sh
|
||||
|
||||
ln -sfn "$RELEASE_DIR" "$APP_ROOT/.current.next"
|
||||
mv -Tf "$APP_ROOT/.current.next" "$APP_ROOT/current"
|
||||
install -m 0755 scripts/auth-admin.sh "$APP_ROOT/auth"
|
||||
@@ -134,6 +137,11 @@ done
|
||||
if command -v systemctl >/dev/null; then
|
||||
if systemctl is-active --quiet prompt.service || systemctl is-active --quiet prompt-worker.service; then echo 'Legacy host service is unexpectedly running'; false; fi
|
||||
fi
|
||||
if docker inspect prompt-studio-studio-1 >/dev/null 2>&1; then
|
||||
if [ "$(docker inspect --format '{{index .Config.Labels "com.docker.compose.project"}}' prompt-studio-studio-1)" = prompt-studio ]; then
|
||||
docker stop prompt-studio-studio-1
|
||||
fi
|
||||
fi
|
||||
echo "Full Docker deployment verified: web+worker+postgres+objects port=$PORT release=$RELEASE_SHA"
|
||||
# Register only after every deployment check succeeded; ledger failure retains old images.
|
||||
if ! python3 scripts/wiki-image-lifecycle.py record-success --sha "$RELEASE_SHA"; then
|
||||
|
||||
Reference in New Issue
Block a user