Summary
A site whose database is SQLite writes that file inside the release directory. A release is a fresh directory, so the next deploy leaves the data behind and the app starts from empty. Nothing warns.
This is not hypothetical. It is the current state of a production box.
Evidence
On a live server running a Stacks app with DB_CONNECTION="sqlite":
$ ls -la /var/www/<site>/shared/
-rw------- 1 root root 1744 .env <- only .env is shared
$ ls -la /var/www/<site>/current/database/
-rw-r--r-- 1 1001 1001 901120 stacks.sqlite <- a regular file, not a symlink
$ ls /var/www/<site>/releases
11dc6e3 4b973ff 5b6c870 8feacde <- 4 releases retainedThe database lives in current/, which is a symlink into releases/<sha>. Deploy again and current points somewhere else, at a directory with no database, or with whatever shipped in the tarball. 900 KB of production data is one deploy from being orphaned.
Why the existing mechanism does not catch it
sharedPaths exists and works, and its documentation describes this exact case:
A release is a fresh directory, so anything the app WRITES and must keep has to be listed here or the next deploy silently starts it from empty.
But it defaults to ['.env'] for server-app sites. A SQLite file is precisely "something the app writes and must keep", and it is the one case ts-cloud can infer without being told: the engine is in the config it already reads.
Suggested fix
When the resolved database engine is SQLite, either:
- Default it in. Add the database file to
sharedPathsautomatically, the way.envalready is. - Refuse, or warn loudly. If inference is too magic, fail the deploy with the
sharedPathsentry the operator should add. Silence is the worst option, because the failure is invisible until data is already gone.
A warning alone would have been enough here: nobody deploying this app knows their database is disposable.
Note on multi-site apps
An app and its API sharing one SQLite file need an absolute target, since each site installs under its own base and a plain relative entry gives each of them a separate database. That is documented on SharedPathSpec and works well; it is only the default that is missing.
Environment
@stacksjs/ts-cloud0.9.4,@stacksjs/buddy0.72.34- Hetzner, attach mode, server-app sites with
start