Skip to content
Crow CI

Database

Database configuration variables for the Crow CI server.

  • Name: CROW_DATABASE_DRIVER
  • Description: Database driver.
  • Default: sqlite3

  • Name: CROW_DATABASE_DATASOURCE
  • Description: Database driver configuration string.
  • Default: /var/lib/crow/crow.sqlite, or uses an existing file if found in this order:
    1. crow.sqlite (current directory)
    2. woodpecker.sqlite (current directory)
    3. /var/lib/crow/crow.sqlite
    4. /var/lib/woodpecker/woodpecker.sqlite

  • Name: CROW_DATABASE_SCHEMA
  • Description: Database schema name. This allows running Crow in a specific PostgreSQL schema instead of the default public schema.
  • Default: none (uses database default, typically public for PostgreSQL)
  • Note: Only supported for PostgreSQL. Setting this for other database drivers will result in an error.

For PostgreSQL and MySQL, the server keeps a pool of up to CROW_DATABASE_MAX_CONNECTIONS connections and reuses them. By default an idle connection is closed after 5 minutes and every connection is replaced after 30 minutes. SQLite always uses a single connection, and these settings don’t apply to it.

The pool statistics are exported on the /metrics endpoint as go_sql_* metrics. A rising go_sql_wait_count_total means requests wait for a free connection, so the pool is too small.


  • Name: CROW_DATABASE_MAX_CONNECTIONS
  • Description: Maximum number of open connections to the database.
  • Default: 100

  • Name: CROW_DATABASE_IDLE_CONNECTIONS
  • Description: Maximum number of idle connections kept in the pool. A connection above this number is closed as soon as it is returned, so the next burst has to open it again.
  • Default: the value of CROW_DATABASE_MAX_CONNECTIONS

  • Name: CROW_DATABASE_CONNECTION_MAX_LIFETIME
  • Description: Maximum time a connection may be reused, busy or idle, before it is closed and replaced. 0 keeps connections forever.
  • Default: 30m
  • Note: Replaces CROW_DATABASE_CONNECTION_TIMEOUT, which still works as a deprecated alias and logs a warning. Earlier releases defaulted it to 3s, which reopened every connection every three seconds.

  • Name: CROW_DATABASE_CONNECTION_MAX_IDLE_TIME
  • Description: Maximum time a connection may stay idle before it is closed. This lets the pool shrink again after a burst. 0 keeps idle connections until their lifetime ends.
  • Default: 5m

  • Name: CROW_DATABASE_LOG
  • Description: Enable logging in database engine (currently xorm).
  • Default: false

  • Name: CROW_DATABASE_LOG_SQL
  • Description: Enable logging of SQL commands.
  • Default: false