version: "3.7"

services:
  zookeeper:
    image: zookeeper

  kafka:
    image: ubuntu/kafka
    environment:
      - TZ=UTC
      - ZOOKEEPER_HOST=zookeeper
      - ZOOKEEPER_PORT=2181
    depends_on:
      zookeeper:
        condition: service_started
  db:
    image: postgres:14
    volumes:
      - db_data:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: changeme
      POSTGRES_DB: windmill
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      timeout: 5s
      retries: 5

  windmill_server:
    image: ghcr.io/windmill-labs/windmill:main
    deploy:
      replicas: 1
    ports:
      - 8000:8000
    environment:
      - DATABASE_URL=postgres://postgres:changeme@db/windmill?sslmode=disable
      - MODE=server
    depends_on:
      db:
        condition: service_healthy

  windmill_worker:
    image: ghcr.io/windmill-labs/windmill:main
    pull_policy: always
    deploy:
      replicas: 3
    restart: unless-stopped
    environment:
      - DATABASE_URL=postgres://postgres:changeme@db/windmill?sslmode=disable
      - MODE=worker
      - WORKER_GROUP=default
    depends_on:
      db:
        condition: service_healthy

volumes:
  db_data: null
