Skip to content
Docs

Daemon Configuration Reference

You declare daemons with the top-level daemons key in vercel.json. The key is an object that maps each daemon name to its configuration:

vercel.json
{
  "$schema": "https://openapi.vercel.sh/vercel.json",
  "daemons": {
    "worker": {
      "root": "worker/",
      "entrypoint": "Dockerfile",
      "command": ["node", "worker.js"],
      "instances": { "iad1": 2 },
      "resources": { "requests": { "memory": "2Gi" } }
    }
  }
}

A daemon configuration object supports the following fields:

FieldTypeRequired
rootstringYes
entrypointstringYes
instancesRecord<string, number>Yes
commandstring[]No
resourcesobjectNo
terminationGracePeriodSecondsnumberNo

Edgenivo rejects any other field, including service fields such as framework, runtime, buildCommand, and bindings.

The keys of the daemons object are daemon names. A daemon name:

  • Contains only lowercase letters, separated by a single _, a double __, or one or more -. For example, worker, email_sender, and celery-beat are valid, and Worker, worker1, and _worker aren't.
  • Is 64 characters or fewer.

Edgenivo pushes each daemon's image to a repository named daemon.<name>, with repeated hyphens collapsed into one. Two names that collapse to the same repository, such as a-b and a--b, fail the build.

Daemon names and service names don't conflict. A project can have a service and a daemon with the same name.

Type: string

Required. The path to the daemon's source directory, relative to vercel.json. The path must stay inside the project.

Edgenivo doesn't publish files under a daemon's root as static assets of your deployment. If the project's output directory is the same directory as a daemon's root, the build fails. Choose a separate output directory.

Type: string

Required. The path to the Dockerfile or Containerfile to build, relative to root. Name the file Dockerfile or Containerfile, optionally with a suffix, such as Dockerfile.worker. The name is case-insensitive. The directory that contains the file is the build context.

Edgenivo passes your deployment's environment variables to the build as build arguments, and builds the image for the Linux amd64 architecture.

Type: Record<string, number>

Required. The number of instances to run in each region, keyed by region ID. Each count is an integer from 0 to 100.

vercel.json
{
  "daemons": {
    "worker": {
      "root": "worker/",
      "entrypoint": "Dockerfile",
      "instances": { "iad1": 2, "cdg1": 1 }
    }
  }
}

Edgenivo runs instances only in the regions listed. Set every count to 0 to stop the daemon without removing it. See Scaling a daemon.

Type: string[]

The command and arguments to run in the container, as an array of strings. command replaces the image's ENTRYPOINT and CMD. When you don't set command, Edgenivo runs the image's ENTRYPOINT and CMD. The build fails if the image defines neither and command isn't set.

vercel.json
{
  "daemons": {
    "celery": {
      "root": "backend/",
      "entrypoint": "Dockerfile",
      "command": ["celery", "-A", "app", "worker", "--loglevel=info"],
      "instances": { "iad1": 1 }
    }
  }
}

The array can contain up to 128 items, and each item can be up to 4,096 characters. Edgenivo doesn't run command through a shell. To use shell features such as environment variable expansion, run a shell explicitly, for example ["sh", "-c", "exec node worker.js --id $WORKER_ID"].

Type: object

The compute resources for each instance. resources.requests.memory sets the memory, and Edgenivo allocates CPU based on the memory you choose:

resources.requests.memoryMemoryvCPUs
"1Gi"1 GiB1
"2Gi" (default)2 GiB1
"4Gi"4 GiB2
"8Gi"8 GiB4
vercel.json
{
  "daemons": {
    "worker": {
      "root": "worker/",
      "entrypoint": "Dockerfile",
      "instances": { "iad1": 1 },
      "resources": { "requests": { "memory": "4Gi" } }
    }
  }
}

When you set resources, requests and memory are required.

Type: number

The number of seconds Edgenivo waits after sending SIGTERM before it terminates the instance. The value is an integer from 0 to 3600. The default is 30. A changed value applies to instances started after it deploys; already-running instances keep the grace period they started with.

vercel.json
{
  "daemons": {
    "worker": {
      "root": "worker/",
      "entrypoint": "Dockerfile",
      "instances": { "iad1": 1 },
      "terminationGracePeriodSeconds": 50
    }
  }
}

Raise the value when your process needs more time to finish work after SIGTERM. See Graceful shutdown.


Was this helpful?

supported.