Skip to content

metald: the daemon entrypoint ​

For Go code, follow the repository Go anti-pattern rules.

Metal specification · Behavior: Metal daemon and API

Purpose ​

Command metald is the composition root. It loads configuration, creates services, and starts the HTTPS servers.

Command ​

text
metald serve [--config path]

The default path is /var/lib/metal/metald.toml. A missing default file is permitted.

Types ​

TypeRole
optionsResolved runtime settings.
fileConfigTOML file sections.
tlsConfigurationsTLS for both servers and the node client.

Startup wiring ​

main.go starts services in this order:

  1. Configuration, TLS credentials, and the control and coordination listeners.
  2. Directories, patches, systemd, storage stores, and the WireGuard manager.
  3. WG Mesh and the optional traffic monitor.
  4. Firecracker runtime, SSH session recovery, record validation, and the VM manager.
  5. Host service and reconcilers.
  6. Atlas trusted keys, then the Atlas and coordination APIs.
  • Take listener-api and listener-coordination from the systemd descriptor store before console adoption. TakeFiles returns all remaining descriptors.
  • Startup sets systemd status to ready <version>; shutdown sets it to stopping. upgrade-metald.sh waits for ready status.
  • The mesh and traffic monitor services are optional and can be nil.
  • connectMesh runs on every start when wg_mesh.enabled is true.
  • wg_mesh.enabled = false does not disable managed WireGuard peers.
  • Both servers require a client certificate from the regional authority.
  • The Atlas API also pins tls.atlas_common_name, because node certificates are valid clients.
  • The snapshot listener uses the metald.coordination_listen host. That value must be one node IP address, not a wildcard.
  • wg_mesh.uplink must name the shared VLAN interface, never its parent.

Config keys ​

KeyDefaultMeaning
metald.base_dir/var/lib/metalHost state root.
metald.listen127.0.0.1:8080TCP address or unix:/path.
metald.coordination_listen127.0.0.1:9001Coordination address.
tls.ca_filenoneRegional authority. Required.
tls.certificate_filenoneNode certificate. Required.
tls.private_key_filenoneNode key. Required.
tls.atlas_common_namenoneAtlas client name. Required.
firecracker.binary_path/usr/bin/firecrackerFirecracker binary.
firecracker.sockets_dir/run/metalAPI socket links.
firecracker.cpu_template_filebuilt-in host profileExplicit CPU template JSON override. See CPU templates.
firecracker.cpu_template_disabledfalseBoot every VM without a CPU template. Atlas sets it from the Metal Server Disable CPU Template check. Cannot be set with cpu_template_file.
jailer.binary_path/usr/bin/jailerJailer binary.
zfs.poolmetalZFS pool name.
wireguard.interfacewg0Underlay interface.
wg_mesh.enabledtrueEnables WG Mesh setup.
wg_mesh.binary_path/usr/local/bin/atlas-wg-meshWG Mesh CLI.
wg_mesh.uplinknoneInterface for Atlas NDP. Required.
wg_mesh.controller_addressnoneAtlas tenant-0 mesh address on wg0. VMs of tenant 0 reach it.
traffic_monitor.enabledtrueEnables idle shutdown.
migration.final_delta_mib512Delta size that triggers the final snapshot.
migration.transfer_port9002Snapshot stream port. Same on every host.
migration.require_guest_sshfalseRequires a guest SSH handshake before memory snapshot migration source cleanup.

config.example.toml shows the full file.

Runtime loops ​

  • The daemon owns all reconcilers, source streams, and snapshot uploads.
  • SIGINT or SIGTERM starts a bounded graceful shutdown.
  • Shutdown never stops or destroys guest VMs.

AGPL-3.0