Database and Data Directory
Ciaren keeps its data in two places:
- the database holds metadata: flows, runs, schedules, connections, and dataset records;
- the data directory holds the files: uploads, run outputs, and previews.
Back up both. A database without its data directory has records that point at missing files.
Choose a database
SQLite is the default and needs no setup. Ciaren uses async SQLAlchemy, so the URL must name an async driver.
| Database | CIAREN_DATABASE_URL | Driver |
|---|---|---|
| SQLite (default) | sqlite+aiosqlite:///./ciaren.db | bundled |
| PostgreSQL | postgresql+asyncpg://user:pass@host:5432/dbname | pip install "ciaren[postgres]" |
| MySQL or MariaDB | mysql+aiomysql://user:pass@host:3306/dbname | pip install aiomysql |
The mysql extra installs pymysql for the SQL Input and Output nodes. It does
not install the async driver for Ciaren's own database.
Set the URL in .env, in the environment, or with ciaren serve --db-url:
# .env
CIAREN_DATABASE_URL=postgresql+asyncpg://ciaren:secret@localhost:5432/ciarenAsync driver required
A plain sqlite://, postgresql://, or mysql:// URL fails to connect. Use the
+aiosqlite, +asyncpg, or +aiomysql form.
Create and upgrade the schema
On startup, Ciaren creates any missing tables, so a new database needs no setup.
For a database you keep, run ciaren db upgrade before you start a new version.
It applies the Alembic migrations, and the startup path then leaves the schema to
them. The Docker image runs it on every start. See
ciaren db for the subcommands.
ciaren db upgrade
ciaren check # confirms the driver is async and the database is reachableData directory
CIAREN_DATA_DIR (default .data, relative to the directory you start Ciaren
from) is where uploaded files, run outputs, and previews are written. In
production, point it at a persistent, writable volume. ciaren check confirms
that it is writable.
By default, file: secret references may read the secrets/ folder under it.
See Connection secrets.
Next steps
- Configuration Reference: every variable
- Production deployment: run it as a service
- Docker: where the volume is mounted