Workloads
On bare metal and on-prem machines, your workloads are the daemons and containers in your alien.ts. This page covers what each can do on a machine, what the build refuses, and how a daemon serves a public domain.
import * as alien from "@alienplatform/core"
const runtime = new alien.ComputeCluster("runtime")
.pool("general", {
requirements: {
cpu: 8,
memory: "32Gi",
ephemeralStorage: "100Gi",
dataDisk: { size: "500Gi" },
},
scale: { type: "fixed", machines: 3 },
})
.build()
// A privileged agent on every machine, with the machine's network,
// processes, and filesystem.
const agent = new alien.Daemon("agent")
.code({ type: "image", image: "ghcr.io/acme/agent:2.1.0" })
.cluster("runtime")
.cpu(2)
.memory("4Gi")
.runtime({
privileged: true,
pidNamespace: "host",
networkMode: "host",
mounts: [{ source: "/", target: "/host" }],
user: "0",
})
.healthCheck({ path: "/health", port: 9090 })
.stopGracePeriod(3600) // up to an hour to finish running work
.publicEndpoint("api", 443)
.build()
export default new alien.Stack("acme-runtime")
.platforms(["machines"])
.add(runtime, "frozen")
.add(agent, "live")
.build()Run one process on every machine
A Daemon runs one copy on every machine of its pool. Use it for agents, collectors, hypervisors, and anything that needs the machine itself.
.runtime() gives a daemon host access, meaning the machine's own network, processes, and files:
| Field | Values | Effect |
|---|---|---|
privileged | true | Elevated capabilities on the machine |
networkMode | host, appnet | host uses the machine's network directly |
pidNamespace | host, private | host sees every process on the machine |
mounts | { source, target, options? } | Directories from the machine, mounted in the daemon, as absolute paths |
user | A uid, or uid:gid | The user the process runs as |
On bare metal and on-prem machines, a daemon gets no cloud identity. On AWS, Google Cloud, and Azure, the build refuses host access combined with .permissions().
Run replicated containers
A stateless Container runs replicas that Alien places across the machines. Alien replaces them one at a time on each release.
const worker = new alien.Container("worker")
.code({ type: "image", image: "ghcr.io/acme/worker:2.1.0" })
.cluster("runtime")
.cpu(1)
.memory("2Gi")
.permissions("worker")
.build()A Container on these machines can't have a public endpoint. Serve public traffic from a daemon with networkMode: "host" instead.
Group machines by hardware with pools
A pool in a ComputeCluster names the hardware a machine must have. Here, a pool is a label: each machine picks one when it joins, with --capacity-group, and Alien never adds or removes machines.
requirementsis checked at join: CPU, memory, and free space under/var/lib/containerdforephemeralStorage(default20Gi).dataDiskrequires an extra empty, unmounted disk on every machine.joinrefuses a machine without one..pool()on a daemon keeps it to the machines of that pool.
What the build refuses
The build refuses these for machines with MACHINES_UNSUPPORTED_RESOURCE, before anything reaches a machine:
- Workers, Builds, and ServiceAccounts. Use a Container or a Daemon.
- Stateful containers. Use a stateless Container, and keep state in a service the machine can reach.
It also refuses public endpoints on Containers, and on daemons without networkMode: "host", with MACHINES_CONTAINER_PUBLIC_ENDPOINT and MACHINES_DAEMON_PUBLIC_ENDPOINT.
GPUs and Sandboxes aren't supported on these machines today either.
Connect storage, databases, and queues
Alien doesn't create Storage, Kv, Queue, Vault, or Postgres on these machines. Each points at a service that already exists, such as MinIO or the customer's PostgreSQL, through an external binding set in the deployment's settings. These resources must be "frozen". See Platforms.
Serve a public domain over HTTPS
Each deployment gets its own domain, and each public endpoint is a host on it: api.<deployment-domain> here. See Networking.
The daemon serves HTTPS on port 443 of the machine itself. Alien issues the certificate for the deployment's domain and renews it. The daemon reads it from these files:
| Environment variable | File |
|---|---|
ALIEN_MANAGED_TLS_CERT_FILE | The certificate chain, tls.crt |
ALIEN_MANAGED_TLS_KEY_FILE | The private key, tls.key |
Alien replaces the files when it renews the certificate. Reload them when they change.
DNS for the endpoint points at the machines' IP addresses. Each machine advertises the address you pass with join --public-ip, which can be a private address your users reach over a VPN.
Next
- Releases and operations: how changes to these workloads roll out
- Daemon and Container: every option
- Platform reference: join flags and machine requirements
Add to your product
Give a customer the join command for their own on-prem machines through the deployment portal, then show their machines in your product.
Releases and operations
How releases roll out to your machines, how drain and upgrades protect running work, and how to watch health, read logs, and remove machines.