deploy.sh now checks local vs remote templates via md5sum on every deploy and warns about drift. Pass --sync-templates to push changed files. Also reports cached card image counts on the target server. New clear-card-cache.sh script inspects or clears cached PNG/APNG card images inside the API container, with --apng-only and --all modes. Added scripts/README.md documenting all operational scripts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
56 lines
2.2 KiB
Markdown
56 lines
2.2 KiB
Markdown
# Scripts
|
|
|
|
Operational scripts for the Paper Dynasty Database API.
|
|
|
|
## deploy.sh
|
|
|
|
Deploy the API by tagging a commit and triggering CI/CD.
|
|
|
|
```bash
|
|
./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.
|
|
|
|
```bash
|
|
./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 |
|