Skip to content

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.

The Ciaren server stores metadata in a database and files in the data directory

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.

DatabaseCIAREN_DATABASE_URLDriver
SQLite (default)sqlite+aiosqlite:///./ciaren.dbbundled
PostgreSQLpostgresql+asyncpg://user:pass@host:5432/dbnamepip install "ciaren[postgres]"
MySQL or MariaDBmysql+aiomysql://user:pass@host:3306/dbnamepip 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:

bash
# .env
CIAREN_DATABASE_URL=postgresql+asyncpg://ciaren:secret@localhost:5432/ciaren

Async 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.

bash
ciaren db upgrade
ciaren check      # confirms the driver is async and the database is reachable

Data 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