Docs

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.

MethodTypeDefaultNotes
.code(code)DaemonCoderequiredImage or source build. Same values as Worker toolchains.
.cluster(id)stringnoneComputeCluster id. Required on AWS, Google Cloud, and Azure. On Kubernetes, with .pool(), picks the node pool.
.pool(name)stringevery poolRuns only on machines or nodes of this pool.
.cpu(value)number | { min, desired }0.1vCPUs per instance.
.memory(size)string"128Mi"Memory per instance.
.permissions(profile)stringnonePermission profile. Without it, the daemon gets no cloud identity.
.command(args)string[]image defaultOverrides the image command.
.stopGracePeriod(sec)numberbackend default1 to 86,400 seconds.
.runtime(cfg)DaemonRuntimenoneHost-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? }noneSame 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 })noneShorthand for .healthCheck() with timeout 1 and failure threshold 3.
.environment(vars)Record<string, string>{}Replaces the whole map.
.link(resource)ResourcenoneRepeatable.
.commandsEnabled(on)booleanfalseInjects ALIEN_COMMANDS_*. Your app runs createCommandReceiver() itself.
.enabled(input)boolean inputalwaysCreates 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

FieldTypeNotes
privilegedbooleanElevated host capabilities.
networkMode"host" | "appnet"host shares the machine's network.
pidNamespace"host" | "private"host sees the machine's processes.
userstringNumeric 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.

VariableValue
ALIEN_DAEMON_PRIVATE_ADDRESSThis instance's private address.
ALIEN_DAEMON_PRIVATE_ADDRESSESPrivate addresses of every machine in the cluster, comma-separated.
ALIEN_DAEMON_POOL_PRIVATE_ADDRESSESPrivate addresses of the machines in this instance's pool, comma-separated.
ALIEN_DAEMON_NODE_ORDINALThis machine's ordinal. You can set it yourself with .environment().
ALIEN_DAEMON_NODE_COUNTNumber of machines in the cluster. You can set it yourself with .environment().

Outputs

FieldNotes
daemonNameRuntime daemon name.
runningWhether the daemon is running.
publicEndpointsPublic endpoints by name.

On this page