Databases
When an app needs somewhere to keep its data, teflon db create gives it its own database.
Teflon runs a Postgres, MySQL, or Redis server for the app, in its own pod on its own persistent disk, and hands the app its connection URL as an environment variable.
Only your app can reach it: other apps cannot, and neither can anything outside the platform.
Teflon enforces this twice, once by network rules and once by the identity your app presents to the platform, so a mistake in one does not open the database.
One database of each engine
An app can have one database of each engine: Postgres and Redis together, for example, or all three. Each is its own pod on its own disk, and each hands the app its own variable.
A second database of an engine the app already has is refused, because both would claim the same variable (PSQL_URL for two Postgres), and the refusal points at the existing one.
Two databases of one engine would need a naming scheme for that variable first, which does not exist yet.
To replace a database, remove it with teflon db remove my-app --engine postgres and then create the new one.
Removing a database deletes its data, so move anything you need first.
A database's disk is separate from the app's own persistent volume.
teflon volume never shows, changes, or removes it, and a deploy that grows the app's volume leaves the database's disk alone; only teflon db changes a database.
What you get
| Engine | Version | Environment variable your app receives |
|---|---|---|
postgres | 18 | PSQL_URL |
mysql | 8.4 | MYSQL_URL |
redis | 8 | REDIS_URL |
Each database hands your app one variable: its connection URL, named for the engine and never DATABASE_URL.
Each engine's name is its own, so an app with several databases never receives the same variable twice.
Here is exactly what your app receives.
<id> is the database's id, <namespace> is the namespace Teflon runs databases in, and <password> is generated for the database.
PSQL_URL=postgresql://app:<password>@db-<id>.<namespace>.svc:5432/app?sslmode=disable
MYSQL_URL=mysql://app:<password>@db-<id>.<namespace>.svc:3306/app
REDIS_URL=redis://:<password>@db-<id>.<namespace>.svc:6379/0
Most drivers take the URL as it is. If yours wants the host, user, or password apart, parse them out of the URL; the password is letters and digits only, so it needs no decoding.
Teflon picks the version, and a database stays on its major version for as long as it exists: a database created on Postgres 18 keeps running Postgres 18, even after Teflon starts offering a newer major to new databases.
teflon db status shows it as the series, the part of the version a database stays on (18, or 8.4 for MySQL), and a major version upgrade of an existing database is not offered yet; it is planned.
Teflon pins the image behind each version and replaces it deliberately, never automatically: a security fix to the database server reaches your database with a Teflon release, which restarts it, and does not arrive by itself.
In Postgres and MySQL the user and the database are both named app.
That user is an ordinary one, never a superuser: it owns the Postgres database and has full rights on the MySQL one, and the trusted Postgres extensions (pgcrypto, uuid-ossp, citext, pg_trgm) work.
Your app gets the user app only, and MySQL's root user is not reachable from it.
Redis has no users or databases, only a password.
The URLs carry the password, so treat the variable like any other secret and keep it out of your logs. Teflon keeps each URL in a Kubernetes Secret beside your app, and only your app's own pods are given it.
Teflon never displays a database's URL or password: not in teflon db status, teflon app get, the console, or any other response.
teflon env list shows only the variables you set yourself, and an alias such as DATABASE_URL shows as the text you typed, $(PSQL_URL), never what it expands to.
teflon logs returns your app's output as it printed it, so an app that prints its URL or password puts it in front of everyone who can read its logs: the app's owner and admins, and any agent they let run teflon logs over MCP.
Anyone who can deploy code to the app can read the variable from inside the container, GitHub Actions deployers included.
The connection stays inside the platform's encrypted network, so the Postgres URL tells the driver not to negotiate TLS of its own.
It uses the postgresql:// scheme and ends in ?sslmode=disable.
Each database runs with fixed ceilings, whatever disk size you choose:
| Engine | CPU | Memory |
|---|---|---|
postgres | up to 1 core | up to 1 GiB |
mysql | up to 1 core | up to 1 GiB |
redis | up to 1 core | up to 512 MiB, of which Redis uses 384 MiB before it refuses writes |
Temporary files and logs are held to 5 GiB per database, apart from the disk. A database that outgrows its memory or that limit is stopped and restarted.
Redis keeps its whole dataset in memory and saves it to disk. The size you choose sets the disk; the memory is fixed, so the dataset has to fit in it. A bigger disk does not change a Redis database's memory, only the room for its saved files. When memory is full Redis refuses writes with an error rather than dropping keys.
Creating one
--engine is always required.
--size is the database's disk, from 1 GiB to 30 GiB, and defaults to 5 GiB.
A disk can be grown later with teflon db resize (see below), but never shrunk, so pick a size you will not regret.
The command waits until the database is available, then prints the name of the environment variable your app now receives - never its value. Your app restarts to pick it up. Starting a database for the first time can take a few minutes on a cold node. An app that has never been deployed has nothing running for a database to start with, so the command stores the database, says it starts with the app's first deploy, and returns without waiting.
The wait gives up after 5 minutes with an error saying so.
That does not stop or remove the database: it keeps starting.
Check on it with teflon db status my-app --engine postgres rather than running db create again, which would be refused because the app already has a postgres database.
Growing the disk
--engine names the database and --size is the new disk, from 1 GiB to 30 GiB.
The database keeps running while the disk grows, and your app does not restart; the extra space appears within a few minutes.
- A disk only grows. A size that is not larger than the current one is refused, because EBS volumes cannot shrink.
- A disk can be resized once every 6 hours, which keeps it inside the limit AWS sets of four changes per disk per day. A second resize inside the window is refused, and the refusal says how long until you can try again.
- Redis keeps its dataset in memory, so a bigger disk does not give a Redis database more memory.
teflon db status shows each database's disk size, so you can see the resize has taken.
Connecting from your app
Read the connection string from the environment and connect with your usual driver: PSQL_URL for Postgres, MYSQL_URL for MySQL, REDIS_URL for Redis.
Apps usually set up their own schema on boot, with whatever migration tool they already use.
Teflon has no shell or console for the database.
Your app has to retry its connections. Two things make a refused connection ordinary rather than a bug:
- The app restarts as soon as the database is created, so it can start before the database is ready.
- The database restarts whenever its node is drained or replaced, which routine maintenance does without warning.
A database is one pod on one disk, with no replica, so each restart is a short outage. Open connections drop; a pool that reconnects with backoff recovers on its own, and an app that exits on the first failed connection does not.
Frameworks that read DATABASE_URL
Some frameworks only look at DATABASE_URL.
Teflon never sets that name, so it is yours to set, and an environment variable can refer to the database's URL above with $(NAME).
References between your own variables resolve in name order: a variable can refer only to one whose name sorts earlier.
Point DATABASE_URL at the URL:
Use $(MYSQL_URL) for MySQL.
Keep the single quotes.
With double quotes your shell runs $(PSQL_URL) itself, finds no such command, and the variable is stored empty.
Teflon stores the text as typed, and the platform fills in the real URL when the app starts.
teflon env list my-app shows what was stored: it should read $(PSQL_URL), not the URL and not an empty value.
If DATABASE_URL is already bound to a secret, teflon env set refuses it, because one name cannot be both.
teflon secret bind replaces the app's whole set of bindings, so unbind it by listing the ones to keep, for example teflon secret bind my-app API_KEY=PROD_API_KEY.
teflon secret bind my-app --clear removes every binding.
Like any env var change, this restarts the app, so there is nothing to redeploy.
teflon deploy my-app --set-env DATABASE_URL='$(PSQL_URL)' does the same during a deploy.
The alias outlives the database.
After teflon db remove, DATABASE_URL still holds the text $(PSQL_URL), which no longer fills in.
Unset it with teflon env unset my-app DATABASE_URL, or point it at the new engine's URL if you create a different one.
Checking on it
Shows every database the app has, or only the one of --engine.
For each it shows the engine, its series, the disk size (which a resize changes), and whether the database is available, starting, or failed.
A starting database says what it is waiting for when Teflon knows: its disk, a node to run on, or the app's first deploy.
A failed database says why and exits non-zero, including when Teflon could not set it up at all, for instance because Teflon no longer supports its series.
Teflon sets up an app's databases one after another, so while one cannot be set up, any that are not running yet wait behind it and show the same reason.
unknown means Teflon could not reach the cluster to ask, which says nothing about the database itself.
teflon app get my-app lists the databases too.
Deploys and rollbacks
Deploys, rollbacks, and quarantine never touch the database. Rolling an app back rolls back its code, not its data: if a newer version changed the schema, the older code now meets the newer schema. Write migrations so the previous release can still run against them.
Backups and restores
Every database is backed up daily, and any backup already taken is kept for up to 7 days. A database less than a day old may have no backup yet. Restoring is a request to a Teflon admin; there is no command for it yet.
A backup is a snapshot of the disk, so restoring one behaves like the database restarting after a power cut. Up to 24 hours of writes can be lost: everything since the last daily backup.
Removing a database
This permanently deletes the database of that engine and everything in it.
--engine is always required, so a command that destroys data never has to guess which database you mean; the app's other databases are untouched.
You are asked to type the application's name to confirm; --force skips that prompt, for scripts.
The one exception is any backup already taken: it stays for up to 7 days after the removal, and a Teflon admin can restore it on request. After that the data is gone for good.
Deleting an app deletes all of its databases too, and a backup of each exists for up to 7 days as well. Restoring that backup after the app is deleted needs help from the Teflon engineers, not only an admin: ask in the teflon support Slack channel soon, before the 7 days run out.
Your app restarts without that database's environment variable.
An app that requires them may crash-loop until you redeploy it without them.
If you aliased DATABASE_URL to the URL, remove or repoint that too.
Limits
- One database of each engine per app, so a second
teflon db createof an engine the app already has is refused. Two databases of one engine would need a naming scheme for their variable first. - A disk from 1 GiB to 30 GiB that only grows, and only once every 6 hours.
teflon logsshows your app's logs only, not the database's.teflon db createwaits up to 5 minutes. If that runs out the database keeps starting, so checkteflon db statusrather than creating it again.- No extra users or roles, no extensions beyond the trusted ones, no tuning knobs, and no replicas or high availability.
- A Redis in cluster mode, or with an eviction policy, is not available.
Reserved environment variable names
While an app has a database, the variable that database provides (the table above) belongs to it.
--set-env, teflon env set, --set-secret, --secret-literal, and teflon secret bind refuse it for that app, and the refusal names it and the database that provides it.
An app without a database keeps accepting them.
Only the variables of the engines the app has a database of are reserved, so an app with Redis alone may still set PSQL_URL, and DATABASE_URL is no engine's name, so any app may set it.
teflon db create makes the same check the other way round: if the app already sets its engine's variable, the command fails and names it.
A deploy that is still in progress counts, because it would set the name when it finishes: wait for it, then try again.
Remove it first with teflon env unset my-app PSQL_URL, or rebind the secret under another name with teflon secret bind, then create the database again.
Names are matched exactly, so database_url in lower case is just another variable.
See Secrets and environment for how the rest of an app's configuration reaches it.