Daemon API reference
Every option of the Daemon builder in alien.ts, the environment variables each instance receives, and its outputs.
Builder
new alien.Daemon(id) from @alienplatform/core. The id uses lowercase letters, digits, and hyphens.
| Method | Type | Default | Notes |
|---|---|---|---|
.code(code) | DaemonCode | required | Image or source build. Same values as Worker toolchains. |
.cluster(id) | string | none | ComputeCluster id. Required on AWS, Google Cloud, and Azure. On Kubernetes, with .pool(), picks the node pool. |
.pool(name) | string | every pool | Runs only on machines or nodes of this pool. |
.cpu(value) | number | { min, desired } | 0.1 | vCPUs per instance. |
.memory(size) | string | "128Mi" | Memory per instance. |
.permissions(profile) | string | none | Permission profile. Without it, the daemon gets no cloud identity. |
.command(args) | string[] | image default | Overrides the image command. |
.stopGracePeriod(sec) | number | backend default | 1 to 86,400 seconds. |
.runtime(cfg) | DaemonRuntime | none | Host-level access. AWS, Google Cloud, and Azure. |
.publicEndpoint(name, port, opts?) | "http" | { protocol: "http", hostLabel?, wildcardSubdomains? } | "http" | HTTP only. Same options as Container public endpoints. |
.healthCheck(cfg) | { path?, method?, port?, timeoutSeconds?, failureThreshold?, startupTimeoutSeconds? } | none | Same fields and defaults as Container health checks. startupTimeoutSeconds (daemons on machines only, default 600, at most 86400) is how long a new process may run without passing the check before the update fails. |
.readinessProbe({ method, path }) | none | Shorthand for .healthCheck() with timeout 1 and failure threshold 3. | |
.environment(vars) | Record<string, string> | {} | Replaces the whole map. |
.link(resource) | Resource | none | Repeatable. |
.commandsEnabled(on) | boolean | false | Injects ALIEN_COMMANDS_*. Your app runs createCommandReceiver() itself. |
.enabled(input) | boolean input | always | Creates the resource only when the input is true. |
.environment() on a Daemon replaces the map, unlike on a Container, where it merges. Call it once with every variable.
Runtime
| Field | Type | Notes |
|---|---|---|
privileged | boolean | Elevated host capabilities. |
networkMode | "host" | "appnet" | host shares the machine's network. |
pidNamespace | "host" | "private" | host sees the machine's processes. |
user | string | Numeric uid, or uid:gid. |
mounts | { source, target, options? }[] | Host paths mounted into the daemon. source and target must be absolute paths. |
Environment
On AWS, Google Cloud, and Azure, each instance also gets its place in the cluster. The address variables are set when the cluster's private network is up.
| Variable | Value |
|---|---|
ALIEN_DAEMON_PRIVATE_ADDRESS | This instance's private address. |
ALIEN_DAEMON_PRIVATE_ADDRESSES | Private addresses of every machine in the cluster, comma-separated. |
ALIEN_DAEMON_POOL_PRIVATE_ADDRESSES | Private addresses of the machines in this instance's pool, comma-separated. |
ALIEN_DAEMON_NODE_ORDINAL | This machine's ordinal. You can set it yourself with .environment(). |
ALIEN_DAEMON_NODE_COUNT | Number of machines in the cluster. You can set it yourself with .environment(). |
Outputs
| Field | Notes |
|---|---|
daemonName | Runtime daemon name. |
running | Whether the daemon is running. |
publicEndpoints | Public endpoints by name. |