Flatten note tags and store processed media as ordinary resource links
wiki CI and deployment / verify-and-deploy (push) Successful in 13m27s
wiki CI and deployment / verify-and-deploy (push) Successful in 13m27s
This commit is contained in:
+16
-3
@@ -40,11 +40,21 @@ if command -v systemctl >/dev/null; then
|
||||
if systemctl is-enabled --quiet prompt-worker.service 2>/dev/null; then LEGACY_WORKER_ENABLED=1; fi
|
||||
fi
|
||||
CUTOVER=0
|
||||
MIGRATION_STARTED=0
|
||||
BACKUP_FILE=""
|
||||
rollback(){
|
||||
local code=$?
|
||||
trap - ERR
|
||||
set +e
|
||||
if [ "$CUTOVER" -eq 1 ]; then
|
||||
compose stop web worker
|
||||
if [ "$MIGRATION_STARTED" -eq 1 ] && [ -s "$BACKUP_FILE" ]; then
|
||||
if ! compose exec -T postgres pg_restore -U prompt -d prompt --clean --if-exists --exit-on-error < "$BACKUP_FILE"; then
|
||||
echo 'Database rollback failed; application remains stopped. Backup retained.'
|
||||
exit "$code"
|
||||
fi
|
||||
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 web worker
|
||||
echo 'Restored the previous Docker application image'
|
||||
@@ -69,8 +79,12 @@ 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
|
||||
install -d -o root -g root -m 0700 /var/lib/prompt/backups
|
||||
compose exec -T postgres pg_dump -U prompt -d prompt -Fc > "/var/lib/prompt/backups/$(date -u +%Y%m%dT%H%M%S)-$RELEASE_SHA.dump"
|
||||
CUTOVER=1
|
||||
compose stop web worker
|
||||
BACKUP_FILE="/var/lib/prompt/backups/$(date -u +%Y%m%dT%H%M%S)-$RELEASE_SHA.dump"
|
||||
compose exec -T postgres pg_dump -U prompt -d prompt -Fc > "$BACKUP_FILE"
|
||||
find /var/lib/prompt/backups -name '*.dump' -printf '%T@ %p\n' | sort -rn | tail -n +11 | cut -d' ' -f2- | xargs -r rm --
|
||||
MIGRATION_STARTED=1
|
||||
compose run --rm --no-deps migrate
|
||||
compose run --rm --no-deps publish
|
||||
CUTOVER=1
|
||||
@@ -79,11 +93,10 @@ if [ "$LEGACY_WORKER" -eq 1 ] || [ "$LEGACY_WORKER_ENABLED" -eq 1 ]; then system
|
||||
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 web worker
|
||||
compose exec -T web node container-health.mjs
|
||||
compose exec -T web node wait-snapshots.mjs
|
||||
compose exec -T web node -e "fetch('http://127.0.0.1:3000/').then(r=>{if(!r.ok)process.exit(1)}).catch(()=>process.exit(1))"
|
||||
compose exec -T web node scripts/import-character-packs.mjs
|
||||
compose exec -T worker sh -c 'test "$(id -u)" -ne 0 && ffmpeg -version >/dev/null'
|
||||
compose exec -T web node -e "(async()=>{const feed=await fetch('http://127.0.0.1:3000/api/feed?section=articles').then(r=>r.json());const slugs=['learning-skills-notes','learning-skills-teaching','learning-skills-english'];for(const slug of slugs){const post=feed.posts.find(p=>p.slug===slug);if(!post)throw Error('Published article missing: '+slug);const res=await fetch('http://127.0.0.1:3000/p/'+slug);if(!res.ok)throw Error('Article unavailable: '+slug)}if(new Set(feed.posts.filter(p=>slugs.includes(p.slug)).map(p=>p.cover_asset_id)).size!==1)throw Error('Series must share one cover');console.log('Verified three published article pages and their shared cover')})().catch(e=>{console.error(e.message);process.exit(1)})"
|
||||
compose exec -T web node -e "(async()=>{const feed=await fetch('http://127.0.0.1:3000/api/feed?section=articles').then(r=>r.json());const slugs=['learning-skills-notes','learning-skills-teaching','learning-skills-english'];for(const slug of slugs){const post=feed.posts.find(p=>p.slug===slug);if(!post)throw Error('Published article missing: '+slug);const res=await fetch('http://127.0.0.1:3000/p/'+slug);if(!res.ok)throw Error('Article unavailable: '+slug)}console.log('Verified three published article pages')})().catch(e=>{console.error(e.message);process.exit(1)})"
|
||||
ln -sfn "$RELEASE_DIR" "$APP_ROOT/.current.next"
|
||||
mv -Tf "$APP_ROOT/.current.next" "$APP_ROOT/current"
|
||||
compose ps
|
||||
|
||||
Reference in New Issue
Block a user