Skip to main content

Docker Deployment

Running TaskDaemon with Docker and Docker Compose.

Basic Docker Run

docker run -d \
  -p 8080:8080 -p 50051:50051 \
  -v ./handlers.toml:/app/handlers.toml \
  -v /var/run/docker.sock:/var/run/docker.sock \
  mshelia/taskdaemon

Required Volumes

VolumePurpose
handlers.toml:/app/handlers.tomlHandler configuration
/var/run/docker.sock:/var/run/docker.sockDocker socket for spawning handler containers

Ports

PortProtocolDescription
8080HTTPREST API, metrics, health checks
50051gRPCgRPC API

Docker Compose

services:
  taskdaemon:
    image: mshelia/taskdaemon
    ports:
      - "8080:8080"
      - "50051:50051"
    volumes:
      - ./handlers.toml:/app/handlers.toml
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - DAEMON_WORKERS=4
      - DAEMON_LOG_LEVEL=info

With Monitoring

services:
  taskdaemon:
    image: mshelia/taskdaemon
    ports:
      - "8080:8080"
    volumes:
      - ./handlers.toml:/app/handlers.toml
      - /var/run/docker.sock:/var/run/docker.sock

  prometheus:
    image: prom/prometheus:latest
    profiles: ["monitoring"]
    ports:
      - "9090:9090"
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml
    depends_on:
      - taskdaemon

  grafana:
    image: grafana/grafana:latest
    profiles: ["monitoring"]
    ports:
      - "3001:3000"
    environment:
      - GF_SECURITY_ADMIN_PASSWORD=admin
    depends_on:
      - prometheus
Run with monitoring:
docker compose --profile monitoring up

Building Handler Images

Handler images must be available to the Docker daemon. Build them before starting TaskDaemon:
services:
  taskdaemon:
    image: mshelia/taskdaemon
    depends_on:
      - my-handler

  my-handler:
    build: ./handlers/my-handler
    image: my-handler:latest
    command: ["echo", "Handler built"]  # Just builds, doesn't run

Health Checks

services:
  taskdaemon:
    image: mshelia/taskdaemon
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
      interval: 30s
      timeout: 10s
      retries: 3

Resource Limits

services:
  taskdaemon:
    image: mshelia/taskdaemon
    deploy:
      resources:
        limits:
          cpus: '2'
          memory: 1G