This guide explains each component of the docker-compose.yml configuration for setting up Kestra workflow orchestration platform with PostgreSQL.
# Volume Configuration
# Persistent data storage definitions for both PostgreSQL and Kestra
volumes:
# PostgreSQL data volume for storing database files
postgres-data:
driver: local # Uses local storage driver for persistence
# Kestra data volume for storing workflow files and artifacts
kestra-data:
driver: local # Uses local storage driver for persistence
# Service Definitions
services:
# PostgreSQL Database Service Configuration
postgres:
image: postgres # Uses official PostgreSQL Docker image
volumes:
# Mounts postgres-data volume to PostgreSQL's data directory
- postgres-data:/var/lib/postgresql/data
environment:
# Database configuration environment variables
POSTGRES_DB: kestra # Sets database name
POSTGRES_USER: kestra # Sets database user
POSTGRES_PASSWORD: k3str4 # Sets database password
# Health check configuration to ensure database availability
healthcheck:
# Checks if PostgreSQL is ready to accept connections
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
interval: 30s # Performs check every 30 seconds
timeout: 10s # Sets timeout for health check
retries: 10 # Number of retries before marking unhealthy
# Kestra Service Configuration
kestra:
image: kestra/kestra:latest # Uses latest Kestra image
pull_policy: always # Always pulls latest image on restart
user: "root" # Runs container as root user
command: server standalone # Runs Kestra in standalone server mode
volumes:
# Mounts for persistent storage and working directories
- kestra-data:/app/storage # Persistent storage for Kestra
- /var/run/docker.sock:/var/run/docker.sock # Docker socket for container management
- /tmp/kestra-wd:/tmp/kestra-wd # Working directory for temporary files
environment:
# Kestra configuration in YAML format
KESTRA_CONFIGURATION: |
datasources:
postgres:
# PostgreSQL connection configuration
url: jdbc:postgresql://postgres:5432/kestra
driverClassName: org.postgresql.Driver
username: kestra
password: k3str4
kestra:
server:
basicAuth:
enabled: false # Disables basic authentication
username: "[email protected]" # Admin email (required format)
password: kestra # Admin password
repository:
type: postgres # Uses PostgreSQL for repository storage
storage:
type: local # Uses local storage type
local:
basePath: "/app/storage" # Base path for storage
queue:
type: postgres # Uses PostgreSQL for task queue
tasks:
tmpDir:
path: /tmp/kestra-wd/tmp # Directory for temporary files
url: <http://localhost:8080/> # Web interface URL
ports:
- "8080:8080" # Maps web interface port
- "8081:8081" # Maps internal API port
depends_on:
# Ensures PostgreSQL service starts first
postgres:
condition: service_started
Save Configuration
docker-compose.yml
Start Services
docker-compose up -d
d
flag runs services in detached mode (background)Access Kestra
http://localhost:8080
postgres-data
: Stores PostgreSQL database fileskestra-data
: Stores Kestra workflow data and artifacts