Database

This section contains information on the database component for the Vela server.

This component is responsible for integrating with a database system based off the configuration provided.

The database system is used by Vela for storing application data at rest.

This data is an organized collection of information necessary for the platform to operate.

Configuration

The following options are used to configure the component:

NameDescriptionRequiredDefaultEnvironment Variables
database.addrfull connection string to the databasetruesqlite3DATABASE_ADDR
VELA_DATABASE_ADDR
database.drivertype of client to control and operate the databasetruevela.sqliteDATABASE_DRIVER
VELA_DATABASE_DRIVER
database.compression.levellevel of compression for logs stored in the databasetrue3DATABASE_COMPRESSION_LEVEL
VELA_DATABASE_COMPRESSION_LEVEL
database.connection.idlemaximum number of idle connections to the databasetrue2DATABASE_CONNECTION_IDLE
VELA_DATABASE_CONNECTION_IDLE
database.connection.lifeduration of time a connection is reusabletrue30mDATABASE_CONNECTION_LIFE
VELA_DATABASE_CONNECTION_LIFE
database.connection.openmaximum number of open connections to the databasetrue0DATABASE_CONNECTION_OPEN
VELA_DATABASE_CONNECTION_OPEN
database.encryption.keyAES-256 key for encrypting/decrypting values in the databasetrueN/ADATABASE_ENCRYPTION_KEY
VELA_DATABASE_ENCRYPTION_KEY
database.skip_creationskips the creation of tables and indexes in the databasefalsefalseDATABASE_SKIP_CREATION
VELA_DATABASE_SKIP_CREATION
database.log.levellog level for databasefalsewarnDATABASE_LOG_LEVEL
VELA_DATABASE_LOG_LEVEL
database.log.show_sqlshow sql query in logsfalsefalseDATABASE_LOG_SHOW_SQL
VELA_DATABASE_LOG_SHOW_SQL
database.log.skip_notfoundskip logging not found errorsfalsetrueDATABASE_LOG_SKIP_NOTFOUND
VELA_DATABASE_LOG_SKIP_NOTFOUND
database.log.slow_thresholdqueries higher than this value are considered slow and loggedfalse200msDATABASE_LOG_SLOW_THRESHOLD
VELA_DATABASE_LOG_SLOW_THRESHOLD

Drivers

The following drivers are available to configure the component:

NameDescriptionDocumentation
postgresuses a PostgreSQL database for storing data at resthttps://www.postgresql.org/
sqlite3uses a SQLite database for storing data at resthttps://www.sqlite.org/

Postgres

From the PostgreSQL official website:

PostgreSQL is a powerful, open source object-relational database system with over 30 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance.

The below configuration displays an example of starting the Vela server that will connect to a Postgres database:

$ docker run \
  --detach=true \
  --env=VELA_ADDR=https://vela-server.example.com \
+ --env=VELA_DATABASE_DRIVER=postgres \
+ --env=VELA_DATABASE_ADDR=postgres://<username>:<password>@<hostname>:<port>/<database> \
  --env=VELA_DATABASE_ENCRYPTION_KEY=<encryption-key> \
  --env=VELA_QUEUE_DRIVER=redis \
  --env=VELA_QUEUE_ADDR=redis://<password>@<hostname>:<port>/<database> \
  --env=VELA_PORT=443 \
  --env=VELA_SECRET=<shared-secret> \
  --env=VELA_SERVER_PRIVATE_KEY=<private_key> \
  --env=VELA_SCM_CLIENT=<oauth-client-id> \
  --env=VELA_SCM_SECRET=<oauth-client-secret> \
  --env=VELA_WEBUI_ADDR=https://vela.example.com \
  --name=server \
  --publish=80:80 \
  --publish=443:443 \
  --restart=always \
  target/vela-server:latest

Sqlite3

From the Sqlite official website:

SQLite is a C-language library that implements a small, fast, self-contained, high-reliability, full-featured, SQL database engine. SQLite is the most used database engine in the world. SQLite is built into all mobile phones and most computers and comes bundled inside countless other applications that people use every day.

The below configuration displays an example of starting the Vela server that will connect to a Sqlite database:

$ docker run \
  --detach=true \
  --env=VELA_ADDR=https://vela-server.example.com \
+ --env=VELA_DATABASE_DRIVER=sqlite3 \
+ --env=VELA_DATABASE_ADDR=vela.sqlite \
  --env=VELA_DATABASE_ENCRYPTION_KEY=<encryption-key> \
  --env=VELA_QUEUE_DRIVER=redis \
  --env=VELA_QUEUE_ADDR=redis://<password>@<hostname>:<port>/<database> \
  --env=VELA_PORT=443 \
  --env=VELA_SECRET=<shared-secret> \
  --env=VELA_SERVER_PRIVATE_KEY=<private_key> \
  --env=VELA_SCM_CLIENT=<oauth-client-id> \
  --env=VELA_SCM_SECRET=<oauth-client-secret> \
  --env=VELA_WEBUI_ADDR=https://vela.example.com \
  --name=server \
  --publish=80:80 \
  --publish=443:443 \
  --restart=always \
  target/vela-server:latest
Last modified October 2, 2024: feat: otel tracing (#427) (9623a0f1)