Database
Termix uses SQLite by default. There is nothing to set up, and it is the right pick for one Termix server.
Use PostgreSQL or MySQL when you want the data on a database server you already run and back up, or when you run more than one Termix server against the same data.
Plugins keep their tables in the same database, so this one setting covers everything.
Settings
| Variable | Default | What it does |
|---|---|---|
DATABASE_DIALECT | sqlite | sqlite, postgres or mysql. |
DATABASE_URL | Connection URL for postgres or mysql, like postgres://user:pass@db:5432/termix. | |
DATABASE_POOL_MAX | 10 | Most connections Termix opens to postgres or mysql. |
DATABASE_SSL | TLS for postgres or mysql: require, no-verify or disable. | |
DB_FILE_ENCRYPTION | true | Encrypt the SQLite file at rest. Set false only if something else already encrypts the disk. |
DB_FILE_KEY | Only used to open SQLite files encrypted by very old versions. You almost never need it. | |
DATABASE_LAYER_SKIP_PREUPGRADE_BACKUP | false | Skip the backup Termix takes of the data folder before an upgrade changes the database. |
DATABASE_LAYER_PREUPGRADE_BACKUP_KEEP | 3 | How many of those upgrade backups to keep. |
PostgreSQL
services:
termix:
image: ghcr.io/termix-ssh/termix:latest
container_name: termix
restart: unless-stopped
ports:
- "8080:8080"
volumes:
- termix-data:/app/data
environment:
PORT: "8080"
DATABASE_DIALECT: "postgres"
DATABASE_URL: "postgres://termix:change-me@postgres:5432/termix"
depends_on:
- postgres
postgres:
image: postgres:17
restart: unless-stopped
environment:
POSTGRES_USER: termix
POSTGRES_PASSWORD: change-me
POSTGRES_DB: termix
volumes:
- postgres-data:/var/lib/postgresql/data
volumes:
termix-data:
postgres-data:
DATABASE_URL takes postgres:// or postgresql://. Termix makes and updates its tables itself, so the user needs rights to create tables in its database.
If you use a database server you already have:
CREATE DATABASE termix;
CREATE USER termix WITH PASSWORD 'change-me';
GRANT ALL PRIVILEGES ON DATABASE termix TO termix;
MySQL and MariaDB
services:
termix:
image: ghcr.io/termix-ssh/termix:latest
container_name: termix
restart: unless-stopped
ports:
- "8080:8080"
volumes:
- termix-data:/app/data
environment:
PORT: "8080"
DATABASE_DIALECT: "mysql"
DATABASE_URL: "mysql://termix:change-me@mysql:3306/termix"
depends_on:
- mysql
mysql:
image: mysql:8.4
restart: unless-stopped
environment:
MYSQL_USER: termix
MYSQL_PASSWORD: change-me
MYSQL_DATABASE: termix
MYSQL_ROOT_PASSWORD: change-me-too
volumes:
- mysql-data:/var/lib/mysql
volumes:
termix-data:
mysql-data:
DATABASE_URL takes mysql:// or mariadb://.
CREATE DATABASE termix;
CREATE USER 'termix'@'%' IDENTIFIED BY 'change-me';
GRANT ALL PRIVILEGES ON termix.* TO 'termix'@'%';
TLS to the database
DATABASE_SSL is off unless you set it.
| Value | What it does |
|---|---|
require | Encrypt and check the server's certificate. |
no-verify | Encrypt, but don't check the certificate. For a self-signed one on a private network. |
disable | No TLS. Same as not setting it. |
Any other value stops Termix at startup, so a typo can't quietly turn TLS off.
Keep the data volume
Even on PostgreSQL or MySQL, keep the /app/data volume. It holds the keys that decrypt your passwords and SSH keys, plus plugins, certificates and recordings.
Move an existing install
- On the old install, open Settings, Database and press Export Database. You get a portable
.sqlitefile. - Start a new install on the new database.
- Make the admin account, open Settings, Database and import the file.
The export has your secrets in it, decrypted. Delete it when you are done.
Encryption
Passwords, keys and other secrets are encrypted before they are written, on every database.
DB_FILE_ENCRYPTION is extra. It encrypts the whole SQLite file on disk, so it only applies to SQLite. On PostgreSQL or MySQL, keep the server on a private network, give Termix its own user, and use DATABASE_SSL if the network isn't yours.
The desktop app
The desktop app's own server always uses SQLite. It can still link to a server that uses PostgreSQL or MySQL. See desktop sync.