Skip to content

docs: Flask under gunicorn, database migrated on start - #113

Merged
lythx merged 1 commit into
mainfrom
szuk/yap-93-p-b1-groundwork
Nov 19, 2026
Merged

lythx merged 1 commit into
mainfrom
szuk/yap-93-p-b1-groundwork

Conversation

@lythx

@lythx lythx commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Docs for yaptide/yaptide#1710 (backend groundwork, PR: yaptide/yaptide#1724). Merge together with it. They describe the backend as of that PR.

Changes

  • backend/docker-deployment.md: new "Flask Server" section:
    • run_flask.sh prepares the database once, then starts gunicorn.
    • How the sync workers are sized (2 × CPUs + 1, limited by memory, at most 32).
    • Why YAPTIDE_TOKEN_SECRET / YAPTIDE_REFRESH_TOKEN_SECRET must be set in production.
    • The 40 s stop grace period, and nginx resolving Flask per request.
    • New environment variables: the two token secrets, GUNICORN_WORKERS, GUNICORN_TIMEOUT.
  • backend/database.md, "Migration Workflow": rewritten.
    • Migrations run on start through prepare_database / flask prepare-db.
    • Every migration must be reversible and must not import the models (data migrations use sa.table).
    • How to create, test and roll back a migration.
  • backend/testing.md:
    • test_migrations.py and test_estimator_matching.py in the tests table.
    • A "Migration Tests" section on running them against a throwaway Postgres via TEST_DATABASE_URI.

🤖 Generated with Claude Code

docker-deployment: run_flask.sh prepares the database and starts gunicorn,
worker sizing, GUNICORN_WORKERS / GUNICORN_TIMEOUT, shared token secrets,
stop grace period, nginx resolving Flask per request.
database: migrations run on start (prepare_database / flask prepare-db),
every migration reversible and independent of the current models.
testing: test_migrations.py with TEST_DATABASE_URI, test_estimator_matching.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lythx
lythx merged commit 2d904b4 into main Nov 19, 2026
4 checks passed
@lythx
lythx deleted the szuk/yap-93-p-b1-groundwork branch November 19, 2026 17:15

This branch was previously deployed

1 inactive deployment
github-pages — 76f9b5bd Deployed Nov 17, 2026 by lythx via deploy #264
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants