Database Backends¶
PikoCI supports multiple database backends via the --db-system flag.
mem (default)¶
In-memory storage. All data is lost when the server stops. Useful for development and testing.
No additional flags required.
sqlite¶
Embedded SQLite database. Data persists in a single file. Good for single-node deployments.
| Flag | Description |
|---|---|
--db-name |
Path to the SQLite database file. Relative paths resolve against the working directory. The parent directory must already exist |
Without --db-name, the database is stored at pikoci/pikoci.db in the XDG data directory (~/.local/share/pikoci/pikoci.db by default on Linux).
Upgrading from 0.8.0 or earlier
Earlier versions ignored --db-name for SQLite and always used the XDG path. If you set --db-name (or DB_NAME) and the file it names holds no database, but a database exists at the XDG path, the server keeps using the XDG database and logs a warning. An empty file at the named path holds no database, so it is ignored rather than opened. If the named file exists but the server cannot write it, the server refuses to start with an error naming the file, instead of failing later during migrations. To switch to the path you set, stop the server and move the database together with its -wal and -shm files. The -wal file can hold most recent writes, so the server refuses to start if the main file was moved without it. See Upgrading for the commands.
PikoCI automatically enables WAL mode and a 5-second busy_timeout on file-backed SQLite connections. WAL allows concurrent reads during writes, and busy_timeout prevents immediate SQLITE_BUSY errors when multiple workers access the database simultaneously. In-memory databases (mem) only use busy_timeout since WAL requires a file on disk.
mysql¶
MySQL or MariaDB.
pikoci server \
--jwt-secret my-secret \
--db-system mysql \
--db-host 127.0.0.1 \
--db-port 3306 \
--db-user pikoci \
--db-password secret \
--db-name pikoci
| Flag | Description |
|---|---|
--db-host |
MySQL host |
--db-port |
MySQL port |
--db-user |
MySQL user |
--db-password |
MySQL password |
--db-name |
Database name |
postgresql¶
PostgreSQL.
pikoci server \
--jwt-secret my-secret \
--db-system postgresql \
--db-host 127.0.0.1 \
--db-port 5432 \
--db-user pikoci \
--db-password secret \
--db-name pikoci
| Flag | Description |
|---|---|
--db-host |
PostgreSQL host |
--db-port |
PostgreSQL port |
--db-user |
PostgreSQL user |
--db-password |
PostgreSQL password |
--db-name |
Database name |
Migrations¶
Migrations run automatically on startup by default. To disable:
The initial migration (V8) seeds the default user admin / admin123.