Skip to main content
Lemline requires a database to store workflow state and related data. PostgreSQL, MySQL, and H2 are supported.

Selecting a Database

Set the database type using lemline.database.type:
lemline:
  database:
    type: postgresql
H2 is for testing only. Use PostgreSQL or MySQL in production.

PostgreSQL Configuration

Configure PostgreSQL connection settings:
lemline:
  database:
    type: postgresql
    postgresql:
      host: ${LEMLINE_PG_HOST:localhost}
      port: ${LEMLINE_PG_PORT:5432}
      username: ${LEMLINE_PG_USER:postgres}
      password: ${LEMLINE_PG_PASSWORD:postgres}
      database: ${LEMLINE_PG_DB_NAME:lemline}

PostgreSQL Parameters

lemline.database.postgresql.host
string
default:"localhost"
required
PostgreSQL server hostname or IP address
lemline.database.postgresql.port
number
default:"5432"
required
PostgreSQL server port
lemline.database.postgresql.username
string
default:"postgres"
required
Database username
lemline.database.postgresql.password
string
default:"postgres"
required
Database password. Use environment variables for security.
lemline.database.postgresql.database
string
default:"lemline"
required
Database name
Always set passwords via environment variables: ${LEMLINE_PG_PASSWORD}

PostgreSQL Example

lemline:
  database:
    type: postgresql
    postgresql:
      host: prod-db.example.com
      port: 5432
      username: lemline_user
      password: ${LEMLINE_PG_PASSWORD}
      database: lemline_production

MySQL Configuration

Configure MySQL connection settings:
lemline:
  database:
    type: mysql
    mysql:
      host: ${LEMLINE_MYSQL_HOST:localhost}
      port: ${LEMLINE_MYSQL_PORT:3306}
      username: ${LEMLINE_MYSQL_USER:root}
      password: ${LEMLINE_MYSQL_PASSWORD:password}
      database: ${LEMLINE_MYSQL_DB_NAME:lemline}

MySQL Parameters

lemline.database.mysql.host
string
default:"localhost"
required
MySQL server hostname or IP address
lemline.database.mysql.port
number
default:"3306"
required
MySQL server port
lemline.database.mysql.username
string
default:"root"
required
Database username
lemline.database.mysql.password
string
default:"password"
required
Database password. Use environment variables for security.
lemline.database.mysql.database
string
default:"lemline"
required
Database name

MySQL Example

lemline:
  database:
    type: mysql
    mysql:
      host: mysql.internal.example.com
      port: 3306
      username: lemline_app
      password: ${LEMLINE_MYSQL_PASSWORD}
      database: workflows

Database Migrations

Lemline includes Flyway migrations that are applied based on the configured database type.

Migration Configuration

lemline.database.migrate-at-start
boolean
default:"false"
Apply database migrations automatically on startup
lemline.database.baseline-on-migrate
boolean
default:"false"
Create the schema history table if it doesn’t exist

Enabling Migrations

lemline:
  database:
    type: postgresql
    migrate-at-start: true
    baseline-on-migrate: true
    postgresql:
      host: localhost
      port: 5432
      username: postgres
      password: postgres
      database: lemline
Migrations are versioned and applied in order. Enable baseline-on-migrate for existing databases.

Migration Behavior

1

Schema Detection

Flyway checks for the schema history table
2

Baseline Creation

If baseline-on-migrate: true, creates the history table
3

Version Check

Compares applied migrations with available migrations
4

Migration Execution

Applies pending migrations in version order

Environment-Specific Configuration

Use Quarkus profiles for different environments:
lemline:
  database:
    type: postgresql
    postgresql:
      host: localhost
      port: 5432
      username: postgres
      password: dev-password
      database: lemline_dev

'%prod':
  lemline:
    database:
      postgresql:
        host: ${LEMLINE_PROD_DB_HOST}
        username: ${LEMLINE_PROD_DB_USER}
        password: ${LEMLINE_PROD_DB_PASSWORD}
        database: lemline_production
Activate with:
java -Dquarkus.profile=prod -jar lemline-runner.jar

Docker Compose Examples

For local development, start a database using Docker Compose:
docker compose -f ./examples/docker-compose.yml --profile kafka-pg up -d

Default Credentials

PostgreSQL:
  • Username: postgres
  • Password: postgres
  • Database: lemline
MySQL:
  • Username: lemline
  • Password: lemline
  • Database: lemline
  • Root password: root
These credentials are for development only. Use strong passwords in production.

Connection Pooling

Lemline uses Quarkus Agroal for connection pooling. Advanced settings can be configured via Quarkus properties:
quarkus:
  datasource:
    jdbc:
      min-size: 5
      max-size: 20
      acquisition-timeout: 10s

Troubleshooting

  • Verify database is running: docker compose ps
  • Check host and port settings match your database
  • Ensure network connectivity between Lemline and database
  • Verify username and password are correct
  • Check database grants for the user
  • Ensure password environment variable is set
  • Check database user has DDL permissions
  • Review Flyway logs for specific errors
  • For existing databases, enable baseline-on-migrate
  • Verify database name exists
  • Create database manually if needed
  • Check database parameter matches actual database name

Next Steps

Messaging Configuration

Configure Kafka, RabbitMQ, or PGMQ for workflow orchestration

Build docs developers (and LLMs) love