Introduction

ActivePieces is a powerful automation tool that can be deployed using Docker Compose. In this guide, I’ll walk through my custom deployment configuration and provide helpful notes for setup, troubleshooting, and future improvements.

This guide assumes you are experienced with Docker troubleshooting and have a preferred reverse proxy setup. Configuring the reverse proxy is beyond the scope of this article. I personally use and endorse Traefik.

Docker Compose Configuration

Here is the docker-compose.yml file I use to deploy ActivePieces:

---
services:

  activepieces:
    image: ghcr.io/activepieces/activepieces:0.39.7 # https://github.com/activepieces/activepieces/pkgs/container/activepieces/versions?filters%5Bversion_type%5D=tagged
    restart: always
    ports:
      - '7887:80'
    environment:
      - AP_POSTGRES_DATABASE
      - AP_POSTGRES_PASSWORD
      - AP_POSTGRES_USERNAME
      - AP_POSTGRES_HOST
      - AP_POSTGRES_PORT
      - AP_REDIS_HOST
      - AP_REDIS_PORT
      - AP_ENCRYPTION_KEY
      - AP_FRONTEND_URL
      - AP_JWT_SECRET
    depends_on:
      postgres:
        condition: service_healthy      
      redis:
        condition: service_healthy
      mail:
        condition: service_started
    volumes:
      - cache:/usr/src/app/cache
    networks:
      - activepieces
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"      

  postgres:
    image: 'postgres:17.2' # https://hub.docker.com/_/postgres
    restart: always
    environment:
      - 'POSTGRES_DB=${AP_POSTGRES_DATABASE}'
      - 'POSTGRES_PASSWORD=${AP_POSTGRES_PASSWORD}'
      - 'POSTGRES_USER=${AP_POSTGRES_USERNAME}'
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready"]
      interval: 10s
      timeout: 5s
      retries: 5      
    networks:
      - activepieces
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"

  redis:
    image: 'redis:7.4' # https://hub.docker.com/_/redis/
    restart: unless-stopped
    volumes:
      - 'redis_data:/data'
    healthcheck:
      test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
    networks:
      - activepieces
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"

  mail:
    image: bytemark/smtp:latest # https://hub.docker.com/r/bytemark/smtp/tags
    restart: always
    networks:
      - activepieces
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"
   
volumes:
  cache:
  postgres_data:
  redis_data:
  
networks:
  activepieces:

Key Improvements

  • Updated Images: Using more recent versions of redis and postgres. Links are provided to check for updates.
  • Mail Relay: Added the bytemark/smtp mail relay.
  • Health Checks: Added health checks for postgres and redis to ensure services are ready before starting activepieces.
  • Environment Variables: Clearly defined all required environment variables.
  • Bind Mount: Replaced with a volume for the activepieces cache.
  • Logging: JSON-formatted logs with automatic rotation.
The bytemark/smtp service currently lacks a health check. This is noted for future improvement.

Environment Variables

Create an .env file with the following variables.

Change all of the passwords… don’t use my defaults)
# ActivePieces environment variables
AP_POSTGRES_DATABASE=activepieces
AP_POSTGRES_PASSWORD=41b049f6-dcdc-11ef-9990-3f856c357ecf
AP_POSTGRES_USERNAME=ap
AP_POSTGRES_HOST=postgres
AP_POSTGRES_PORT=5432
AP_REDIS_HOST=redis
AP_REDIS_PORT=6379
AP_ENCRYPTION_KEY=074038d0008feb81670852f3b1254fa6
AP_FRONTEND_URL=http://activepieces.example.com
AP_JWT_SECRET=e6e1e415c640042425774fc268ea75677ed25d870b1c4d535f4c3c50125cbed0

The command openssl rand -hex 16 can be used for creating values for AP_POSTGRES_PASSWORD, AP_ENCRYPTION_KEY.

For AP_JWT_SECRET use the output of openssl rand -hex 32

First-Time Setup

  1. Deploy the stack:

    docker compose up -d
    
  2. Wait a few minutes for services to initialize.

  3. Open the web portal and create an admin account.

  4. Configure your preferred AI provider under the Platform Admin section.

Future Improvements

  • Health Check for Mail Service: Implement a reliable health check for the bytemark/smtp service.
  • Redis Replacement: Consider replacing redis with valkey2 for a more open-source-friendly solution.

Final Thoughts

ActivePieces is quick to deploy and offers a user-friendly web portal. However, many features are locked behind enterprise subscriptions, which limits its utility for personal use. I’ll continue testing to evaluate its value for self-hosting.