Docker Compose provides a complete production-ready deployment of Activepieces with all required services (PostgreSQL and Redis) in a single configuration file.
Quick Start
Create docker-compose.yml
Download the official Docker Compose configuration: curl -O https://raw.githubusercontent.com/activepieces/activepieces/main/docker-compose.yml
Create .env file
Copy the example environment file: curl -O https://raw.githubusercontent.com/activepieces/activepieces/main/.env.example
cp .env.example .env
Configure environment
Edit .env and set required values: # Generate secure keys
AP_ENCRYPTION_KEY = $( openssl rand -hex 32 )
AP_JWT_SECRET = $( openssl rand -hex 32 )
AP_POSTGRES_PASSWORD = $( openssl rand -hex 16 )
Docker Compose Configuration
Here’s the official docker-compose.yml from the Activepieces repository:
services :
activepieces :
image : ghcr.io/activepieces/activepieces:0.79.0
container_name : activepieces
restart : unless-stopped
## Enable the following line if you already use AP_EXECUTION_MODE with SANDBOX_PROCESS or old activepieces, checking the breaking change documentation for more info.
## privileged: true
ports :
- '8080:80'
depends_on :
- postgres
- redis
env_file : .env
volumes :
- ./cache:/usr/src/app/cache
networks :
- activepieces
postgres :
image : 'postgres:14.4'
container_name : postgres
restart : unless-stopped
env_file : .env
environment :
- 'POSTGRES_DB=${AP_POSTGRES_DATABASE}'
- 'POSTGRES_PASSWORD=${AP_POSTGRES_PASSWORD}'
- 'POSTGRES_USER=${AP_POSTGRES_USERNAME}'
volumes :
- postgres_data:/var/lib/postgresql/data
networks :
- activepieces
redis :
image : 'redis:7.0.7'
container_name : redis
restart : unless-stopped
volumes :
- 'redis_data:/data'
networks :
- activepieces
volumes :
postgres_data :
redis_data :
networks :
activepieces :
Service Breakdown
Activepieces Service
Main application container Configuration:
Image : ghcr.io/activepieces/activepieces:0.79.0
Ports : 8080 (host) → 80 (container)
Restart Policy : unless-stopped (auto-restart on failure)
Dependencies : Waits for PostgreSQL and Redis
Volumes : ./cache for temporary files
activepieces :
image : ghcr.io/activepieces/activepieces:0.79.0
container_name : activepieces
restart : unless-stopped
ports :
- '8080:80'
depends_on :
- postgres
- redis
env_file : .env
volumes :
- ./cache:/usr/src/app/cache
networks :
- activepieces
The depends_on directive ensures PostgreSQL and Redis start before Activepieces, but doesn’t wait for them to be ready. The application will retry connections on startup.
PostgreSQL Service
Database for storing workflows, executions, and user data Configuration:
Image : postgres:14.4
Volume : Named volume postgres_data for persistence
Environment : Database credentials from .env file
postgres :
image : 'postgres:14.4'
container_name : postgres
restart : unless-stopped
env_file : .env
environment :
- 'POSTGRES_DB=${AP_POSTGRES_DATABASE}'
- 'POSTGRES_PASSWORD=${AP_POSTGRES_PASSWORD}'
- 'POSTGRES_USER=${AP_POSTGRES_USERNAME}'
volumes :
- postgres_data:/var/lib/postgresql/data
networks :
- activepieces
PostgreSQL data is stored in a Docker named volume. Removing this volume will delete all your data. Always backup before major changes.
Redis Service
Job queue for background processing using BullMQ Configuration:
Image : redis:7.0.7
Volume : Named volume redis_data for persistence
Port : 6379 (internal only, not exposed to host)
redis :
image : 'redis:7.0.7'
container_name : redis
restart : unless-stopped
volumes :
- 'redis_data:/data'
networks :
- activepieces
Environment Configuration
Create a .env file with the following minimum configuration:
## Engine executable path
AP_ENGINE_EXECUTABLE_PATH = dist/packages/engine/main.js
## Security Keys (Generate with: openssl rand -hex 32)
AP_ENCRYPTION_KEY = your_32_char_hex_encryption_key
AP_JWT_SECRET = your_jwt_secret_key
## Environment
AP_ENVIRONMENT = prod
AP_FRONTEND_URL = http://localhost:8080
## Database Configuration
AP_POSTGRES_DATABASE = activepieces
AP_POSTGRES_HOST = postgres
AP_POSTGRES_PORT = 5432
AP_POSTGRES_USERNAME = postgres
AP_POSTGRES_PASSWORD = your_secure_postgres_password
## Redis Configuration
AP_REDIS_HOST = redis
AP_REDIS_PORT = 6379
## Execution
AP_EXECUTION_MODE = UNSANDBOXED
AP_FLOW_TIMEOUT_SECONDS = 600
AP_WEBHOOK_TIMEOUT_SECONDS = 30
AP_TRIGGER_DEFAULT_POLL_INTERVAL = 5
## Telemetry
AP_TELEMETRY_ENABLED = true
AP_TEMPLATES_SOURCE_URL = "https://cloud.activepieces.com/api/v1/flow-templates"
See Environment Variables for all available options.
Managing Services
Starting Services
Start All
Start Specific Service
Rebuild and Start
# Start in detached mode
docker compose up -d
# Start with logs
docker compose up
# Start only Activepieces
docker compose up -d activepieces
# Start only database
docker compose up -d postgres
# Rebuild images before starting
docker compose up -d --build
# Pull latest images
docker compose pull
docker compose up -d
Stopping Services
Stop All
Stop Specific Service
Stop and Remove Volumes
# Stop services (keep containers)
docker compose stop
# Stop and remove containers
docker compose down
docker compose stop activepieces
# WARNING: This deletes all data!
docker compose down -v
Viewing Logs
# All services
docker compose logs -f
# Specific service
docker compose logs -f activepieces
# Last 100 lines
docker compose logs --tail 100 activepieces
Networking
Docker Compose creates a private network for service communication:
Service Discovery:
Activepieces connects to PostgreSQL using hostname postgres
Activepieces connects to Redis using hostname redis
Services communicate internally without exposing ports to host
Data Persistence
Three types of volumes are used:
Named Volumes
Bind Mounts
Docker-managed volumes for database data: volumes :
postgres_data : # PostgreSQL data
redis_data : # Redis persistence
Location : /var/lib/docker/volumes/List volumes :Inspect volume :docker volume inspect activepieces_postgres_data
Host directory mounted into container: volumes :
- ./cache:/usr/src/app/cache
Location : Current directory ./cacheCreate directory before starting: mkdir -p cache
chmod 755 cache
Backup and Restore
Database Backup
Backup PostgreSQL
# Create backup
docker compose exec postgres pg_dump -U postgres activepieces > backup.sql
# Or with timestamp
docker compose exec postgres pg_dump -U postgres activepieces > backup- $( date +%Y%m%d-%H%M%S ) .sql
Restore PostgreSQL
# Stop Activepieces first
docker compose stop activepieces
# Drop and recreate database
docker compose exec postgres psql -U postgres -c "DROP DATABASE activepieces;"
docker compose exec postgres psql -U postgres -c "CREATE DATABASE activepieces;"
# Restore backup
docker compose exec -T postgres psql -U postgres activepieces < backup.sql
# Restart Activepieces
docker compose start activepieces
Volume Backup
# Backup PostgreSQL volume
docker run --rm \
-v activepieces_postgres_data:/data \
-v $( pwd ) :/backup \
ubuntu tar czf /backup/postgres-backup.tar.gz /data
# Backup Redis volume
docker run --rm \
-v activepieces_redis_data:/data \
-v $( pwd ) :/backup \
ubuntu tar czf /backup/redis-backup.tar.gz /data
Production Optimizations
Resource Limits
Add resource constraints to prevent containers from using too much memory/CPU:
services :
activepieces :
# ... existing config ...
deploy :
resources :
limits :
cpus : '2'
memory : 4G
reservations :
cpus : '1'
memory : 2G
postgres :
# ... existing config ...
deploy :
resources :
limits :
cpus : '2'
memory : 2G
reservations :
cpus : '0.5'
memory : 1G
Health Checks
Add health checks to ensure services are running correctly:
services :
activepieces :
# ... existing config ...
healthcheck :
test : [ "CMD" , "curl" , "-f" , "http://localhost:80/v1/health" ]
interval : 30s
timeout : 10s
retries : 3
start_period : 40s
postgres :
# ... existing config ...
healthcheck :
test : [ "CMD-SHELL" , "pg_isready -U postgres" ]
interval : 10s
timeout : 5s
retries : 5
Logging Configuration
Limit log file size to prevent disk issues:
services :
activepieces :
# ... existing config ...
logging :
driver : "json-file"
options :
max-size : "10m"
max-file : "3"
Updating Activepieces
Backup database
docker compose exec postgres pg_dump -U postgres activepieces > backup-before-update.sql
Restart with new images
Docker Compose will recreate containers with new images while preserving volumes.
Verify update
docker compose logs -f activepieces
Check for successful startup and database migrations.
Troubleshooting
Check service status: View logs for errors: Common issues:
Port 8080 already in use
Missing or invalid .env file
Insufficient disk space for volumes
Cannot connect to database
Verify PostgreSQL is running: docker compose ps postgres
Check database logs: docker compose logs postgres
Test connection: docker compose exec postgres psql -U postgres -d activepieces -c "SELECT 1;"
Verify Redis is running: Test Redis connection: docker compose exec redis redis-cli ping
Should return: PONG
Check disk usage: Clean up unused resources: Check volume sizes:
Advanced Configuration
Using External PostgreSQL
If you have an existing PostgreSQL server:
services :
activepieces :
# ... existing config ...
# Remove depends_on postgres
environment :
AP_POSTGRES_HOST : external-postgres.example.com
AP_POSTGRES_PORT : 5432
AP_POSTGRES_DATABASE : activepieces
AP_POSTGRES_USERNAME : activepieces_user
AP_POSTGRES_PASSWORD : secure_password
AP_POSTGRES_USE_SSL : "true"
# Remove postgres service entirely
Using External Redis
If you have an existing Redis server:
services :
activepieces :
# ... existing config ...
# Remove depends_on redis
environment :
AP_REDIS_HOST : external-redis.example.com
AP_REDIS_PORT : 6379
AP_REDIS_PASSWORD : redis_password
AP_REDIS_USE_SSL : "true"
# Remove redis service entirely
Multiple Activepieces Instances
Scale the Activepieces service for high availability:
services :
activepieces :
# ... existing config ...
deploy :
replicas : 3
# Add a load balancer
nginx :
image : nginx:alpine
ports :
- "8080:80"
volumes :
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on :
- activepieces
Next Steps
Environment Variables Configure all available options
Database Setup Advanced PostgreSQL configuration
Scaling Scale your deployment
Storage Configure S3 storage