paper-dynasty-database/scripts
Cal Corum 900f9723e5 fix: address PR review — unknown flag guard, local var scope, container map
- Reject unknown --flags with error instead of silently treating as commit SHA
- Declare remote_hash as local to prevent stale values across loop iterations
- Use associative array for container names (consistent with DEPLOY_HOST pattern)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 20:32:12 -05:00
..
audit_results.json PostgreSQL migration: Complete code preparation phase 2026-01-25 23:05:54 -06:00
audit_sqlite.py PostgreSQL migration: Complete code preparation phase 2026-01-25 23:05:54 -06:00
clear-card-cache.sh feat: add template drift check and cache management to deploy tooling 2026-04-07 20:24:51 -05:00
deploy.sh fix: address PR review — unknown flag guard, local var scope, container map 2026-04-07 20:32:12 -05:00
migrate_missing_data.py Add production deployment config and fix stringified list parsing 2026-01-30 14:03:07 -06:00
migrate_to_postgres.py Fix migration order: move gamerewards after player table 2026-01-27 10:41:54 -06:00
README.md feat: add template drift check and cache management to deploy tooling 2026-04-07 20:24:51 -05:00

Scripts

Operational scripts for the Paper Dynasty Database API.

deploy.sh

Deploy the API by tagging a commit and triggering CI/CD.

./scripts/deploy.sh dev                    # Tag HEAD as 'dev', CI builds :dev image
./scripts/deploy.sh prod                   # Create CalVer tag + 'latest' + 'production'
./scripts/deploy.sh dev abc1234            # Tag a specific commit
./scripts/deploy.sh dev --sync-templates   # Deploy + push changed templates to server

Template drift check runs automatically on every deploy. Compares local storage/templates/*.html against the target server via md5sum and warns if any files differ. Templates are volume-mounted (not baked into the Docker image), so code deploys alone won't update them.

Cached image report also runs automatically, showing PNG and APNG counts on the target server.

Environment SSH Host Template Path
dev pd-database /home/cal/container-data/dev-pd-database/storage/templates
prod akamai /root/container-data/paper-dynasty/storage/templates

clear-card-cache.sh

Inspect or clear cached rendered card images inside the API container.

./scripts/clear-card-cache.sh dev              # Report cache size (dry run)
./scripts/clear-card-cache.sh dev --apng-only  # Delete animated card cache only
./scripts/clear-card-cache.sh dev --all        # Delete all cached card images

Cached images regenerate on demand when next requested. APNG files (T3/T4 animated cards) are the most likely to go stale after template CSS changes. Both destructive modes prompt for confirmation before deleting.

Environment SSH Host Container Cache Path
dev pd-database dev_pd_database /app/storage/cards/
prod akamai pd_api /app/storage/cards/

Migration Scripts

Script Purpose
migrate_to_postgres.py One-time SQLite to PostgreSQL migration
migrate_missing_data.py Backfill missing data after migration
db_migrations.py (in repo root) Schema migrations

Utility Scripts

Script Purpose
wipe_gauntlet_team.py Reset a gauntlet team's state
audit_sqlite.py Audit legacy SQLite database