Skip to content

Workers

Workers are background processes — they run as Deployments without an HTTP port or Service.

Defining a Worker

components:
  celery:
    type: worker
    image: myapp:latest
    command: ["celery", "-A", "tasks", "worker", "--loglevel=info"]
    replicas: 2
    env:
      BROKER_URL: "redis://cache:6379/0"
from helm_me import worker, image

celery = worker(
    image=image("myapp:latest"),
    command=["celery", "-A", "tasks", "worker", "--loglevel=info"],
    replicas=2,
    env={"BROKER_URL": "redis://cache:6379/0"},
)

Workers with Secret References

Workers can reference secrets from other components:

components:
  db:
    type: postgresql
    version: "16"
    database: myapp

  task-worker:
    type: worker
    image: myapp:latest
    command: ["python", "-m", "worker"]
    secretEnv:
      DATABASE_URL:
        component: db
        key: DATABASE_URL

Workers with Storage

components:
  processor:
    type: worker
    image: processor:latest
    command: ["python", "process.py"]
    sqlite:
      mount_path: "/data"
      file_name: "jobs.db"
      volume:
        size: "10Gi"