Daemons
A deployment can declare daemons, which are long-running containers that don't receive traffic. In the Build Output API, the top-level config.json lists the deployment's daemons, and each daemon has a descriptor under .vercel/output/daemons/<name> that points to a prebuilt container image. To configure daemons in your project, see Daemons.
.vercel/output/config.json
List the deployment's daemons in the top-level config.json through a daemons object. Each key is a daemon name, and each value is an empty object:
{
"version": 3,
"daemons": {
"worker": {},
"scheduler": {}
}
}The daemons object is the complete set of daemons for the deployment. When the deployment becomes the production deployment, Edgenivo stops every daemon that an earlier deployment declared and this object doesn't list. A config.json with an empty daemons object, or with no daemons property, declares no daemons, so Edgenivo stops all of them.
.vercel/output/daemons/<name>/.vc-config.json
Every daemon listed in config.json needs a descriptor at .vercel/output/daemons/<name>/.vc-config.json. The descriptor references an image that's already pushed to Edgenivo Container Registry. Edgenivo doesn't build images from the Build Output API.
type DaemonDescriptor = {
runtime: 'container';
image: string;
command?: string[];
instances: Record<string, number>;
resources?: {
requests: {
memory: '1Gi' | '2Gi' | '4Gi' | '8Gi';
};
};
terminationGracePeriodSeconds?: number;
};| Key | Type | Required | Description |
|---|---|---|---|
| runtime | "container" | Yes | The daemon runtime. Must be "container". |
| image | string | Yes | The image reference in Edgenivo Container Registry, such as vcr.vercel.com/my-team/my-project/daemon.worker@sha256:<digest>. |
| command | string[] | No | The command and arguments to run. Defaults to the image's ENTRYPOINT and CMD. |
| instances | Record<string, number> | Yes | The number of instances to run in each region, keyed by region ID. Each count is an integer from 0 to 100. |
| resources | object | No | The memory for each instance. See resources. |
| terminationGracePeriodSeconds | number | No | The number of seconds Edgenivo waits after SIGTERM before terminating the instance. An integer from 0 to 3600. Defaults to 30. See terminationGracePeriodSeconds. |
{
"runtime": "container",
"image": "vcr.vercel.com/my-team/my-project/daemon.worker@sha256:3f1b...",
"command": ["node", "worker.js"],
"instances": { "iad1": 2 },
"resources": { "requests": { "memory": "2Gi" } }
}.vercel/output/daemons
The worker and scheduler daemons above produce the following output, next to the rest of the deployment's build output:
When you use vercel build, the CLI builds each daemon's Dockerfile, pushes the image to Edgenivo Container Registry, and writes these files for you.
- Daemon names contain only lowercase letters separated by
_,__, or-, and are limited to 64 characters. See Daemon names. - Each daemon listed in
config.jsonmust have a descriptor. A missing descriptor fails the deployment. - The
imagemust be in Edgenivo Container Registry. - Routes can't target a daemon, because daemons don't receive traffic.
Was this helpful?