chore(db): stop creating the legacy tale_platform database - #3208
Merged
Conversation
The Convex-era tale_platform database was created (with uuid-ossp and pg_trgm) on every start of every tale-db container, db and knowledge-db alike, although nothing in 0.5 reads it. Delete the init script and let the remaining 01/03/04 scripts publish readiness as before; 03/04 keep their numbers because compose.yml and both knowledge baselines reference the filenames. Existing volumes keep their tale_platform untouched (the scripts only ever CREATE IF NOT EXISTS); dropping it is the operator's documented, manual step. Comments and READMEs that still said Convex owns the platform DB now say tale_app is migrated by the platform backend at boot, and a guard pins the init scripts to exactly tale_app and tale_knowledge.
INSTANCE_NAME=tale_platform was the self-hosted Convex instance name, pinned to the database the db image no longer creates; no code reads it. Remove the export, the dev default and the .env.test value, and reword the remaining Convex comments in env.sh and the SSL-mode rationale in the data-residency form to what the 0.5 backend actually does (it pins the app-Postgres connection test to sslmode=prefer).
Tell operators that fresh installs no longer create the Convex-era tale_platform database, that an existing instance keeps the one it has, and how to drop it by hand after a snapshot. Authored in en, then de and fr natively.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
tale_platformis the Convex-era database. Nothing in the 0.5 product reads it, yetservices/db/init-scripts/02-create-convex-database.sqlstill created it (withuuid-ossp+pg_trgm) on every start of everytale-dbcontainer —dbandknowledge-dbrun the same image and the same scripts. Every 0.5 install to date therefore carries an empty copy.What changes
02-create-convex-database.sql. The entrypoint loops over the remaining01/03/04scripts unchanged and still touches/tmp/.db_readyonly after the scripts and the role's migrations succeed.03/04keep their numbers: the filenames are referenced fromcompose.yml:347and both knowledge baselines, so renumbering would churn three more files for no behaviour.tale_appis migrated by the platform backend at boot,migrations/db/is intentionally empty. Also dropped the staleservices/convex/line fromDockerfile.dockerignore.INSTANCE_NAME=tale_platform— the Convex instance name pinned to this database — is exported byenv.sh, defaulted bydev-engine.tsand set in.env.test, and read by nothing (rg INSTANCE_NAMEfinds no consumer). Removed; the three remaining Convex comments inenv.shand the SSL-mode rationale indeployment-stores.tsxnow state the 0.5 reason (the backend pins the app-Postgres connection test tosslmode=prefer,domains/deployment/service.ts:448).services/platform/tests/guards/db-init-scripts.guard.test.tspins the init scripts to exactlytale_app+tale_knowledgeand rejects any mention oftale_platform, so the retired store cannot creep back and a new database cannot appear without the platform learning to use it.self-hosted/operate/upgrades.md(en, then de/fr authored natively) under the 0.4 → 0.5 cutover section.Existing deployments
Nothing is dropped automatically. The init scripts are
CREATE … WHERE NOT EXISTSonly, so an existing volume keeps itstale_platformuntil the operator drops it by hand. The note tells them how:Blast radius (
rg -n "tale_platform|create-convex-database|convex")services/db/init-scripts/02-create-convex-database.sqlservices/db/docker-entrypoint.sh:88 role comment, :111 + :200 bug-history comments, :183 platform-role echotale_app+ backend-at-bootservices/db/Dockerfilemigrations comment;Dockerfile.dockerignoreservices/convex/services/db/README.md,services/db/migrations/db/README.mdservices/platform/env.shINSTANCE_NAMEexport + 3 Convex comments;scripts/dev-engine.tsdefault;.env.testdeployment-stores.tsxSSL-mode rationale (Convex driver +INSTANCE_NAME)tools/cli/**(SNAPSHOT_VOLUMES,CONFIG_VOLUME='convex-data',breaking-cutover-guard.ts, compose generators)compose.yml(convex-datavolume +04-create-app-database.sqlcomment),compose.dev.ymldocs/*/self-hosted/{overview,operate/backups-and-restore,operate/upgrades}.mdConvex mentionsconvex-datavolume, 0.4 cutover)upgrades.mdsanitize_secrets.tsadmin-key regex +tale_platform|…exampleservices/platform/DockerfileSANDBOX_STORAGE_INTERNAL_BASE_URL=http://convex:3210convexnetwork-alias contractcompose.sandbox-llm-gateway.dev.ymlheader, platform Dockerfile/entrypoint history comments,design/docs/*,configs/README.md,routes.tsconvexStoragetarget,packages/*V8-boundary commentscontainer-smoke-test.tsprobestale+tale_knowledgeonly)Proof — real image, both roles
docker build -f services/db/Dockerfile -t tale-db-retire-test .from this branch, thendocker run … -e POSTGRES_USER=tale -e POSTGRES_PASSWORD=x -e POSTGRES_DB=tale -e DB_PASSWORD=x -e TALE_DB_ROLE=<role>on 127.0.0.1:55432/55433, waiting for/tmp/.db_ready.TALE_DB_ROLE=platform— ready after 5 s, entrypoint log thenpsql -U tale -d tale -c '\l':TALE_DB_ROLE=knowledge— ready after 6 s; same\l(notale_platform), and the corpus migrations applied:Existing-install simulation on the platform container:
CREATE DATABASE tale_platform;→ remove the marker →docker restart→ ready again in 3 s andtale_platformstill listed (nothing drops it automatically) → the documented command printsDROP DATABASE→ re-run printsNOTICE: database "tale_platform" does not exist, skipping→\l=paradedb postgres tale tale_app tale_knowledge template0 template1.(The
ERROR: extension "postgis" is not availablelines in the boot log come from ParadeDB's upstream10_bootstrap_paradedb.sh; this image strips PostGIS on purpose — pre-existing and unrelated.)Throwaway containers and images were removed afterwards.
Gates observed
bash -n services/db/docker-entrypoint.sh,bash -n services/platform/env.sh— OKbunx vitest --run --project server tests/guards/db-init-scripts.guard.test.ts— 2/2 passedbunx oxlint --type-awareon the guard,dev-engine.ts,deployment-stores.tsx— 0 findingsbunx oxfmt --checkon touched files — cleanbun run --filter @tale/docs test— 30 files / 194 tests passed (before and after the final wording pass)bunx knip— exit 0 (one pre-existingcron-parserconfig hint, unrelated)tools/cliuntouched → its suite not runPreserved on purpose
tools/cliupgrade/backup/restore path. The CLI never namestale_platform:tale backup/tale restoresnapshot whole volumes (db-data,convex-data,object-store-data, caddy) as tars, so a volume with or without the database restores identically, andbreaking-cutover-guard.tsstill refuses an in-place 0.4 → 0.5 upgrade. There was nothing to keep tolerant of the database's absence, so nothing changed there.convex-datavolume name everywhere (compose, CLI generators, backups, docs) — the org config store, kept so no operator migrates a volume for a rename.sanitize_secrets.ts— still worth scrubbing from logs.