Skip to content

Operations

Deploy

Kubernetes and Fly.io deployments.

Kubernetes

The quickest path is the Helm chart, which can also register your annotated Services in Atlas. See docs/KUBERNETES.md.

helm install atlas oci://ghcr.io/manziosee/charts/atlas -n atlas --create-namespace   --set k8sSync.enabled=true
kubectl annotate service payments atlas.io/register=true atlas.io/health=/healthz

Or apply the Kustomize overlays directly:

cp deploy/k8s/overlays/dev/secrets.env.example deploy/k8s/overlays/dev/secrets.env
# fill it with: atlas-cli keygen / atlas-cli tokengen
docker build -t atlas:dev .
kubectl apply -k deploy/k8s/overlays/dev
kubectl -n atlas get pods -w
kubectl -n atlas exec atlas-0 -- atlas-cli members --token "$TOKEN"

The production overlay adds cert-manager TLS, 5 replicas, a pinned image and HTTPS probes. It needs cert-manager and a ClusterIssuer named atlas-ca-issuer.

The Helm chart can optionally scale the StatefulSet on CPU and run scheduled off-cluster snapshots plus a weekly restore check. Autoscaling requires the cluster metrics API; it keeps at least three Atlas members. Backup jobs need an S3 bucket and workload identity or an existing Secret with object-store credentials. See the chart's backup and scaling guide.

The atlas ClusterIP service exposes Atlas DNS on port 5353 over UDP and TCP. It serves registry records under atlas.; clients can query it directly or configure a private CoreDNS forward rule. The NetworkPolicy limits DNS access to the Atlas namespace and namespaces labeled atlas.io/api-access: "true". This publishes Atlas registrations to Kubernetes clients; it does not import Kubernetes Services into Atlas.

Clusters using Prometheus Operator can install the optional scrape and alert resources after its CRDs are available:

kubectl apply -k deploy/k8s/monitoring

SQLite snapshots: atlas-cli db-backup -output ./atlas-backup.db creates a consistent snapshot while the node is running. Restore to a new path with atlas-cli db-restore -input ./atlas-backup.db -db ./atlas-restored.db. The restore command checks SQLite integrity and refuses to overwrite an existing file. Stop the node before replacing its active database, and move the live database plus any -wal/-shm files aside before restoring to the original path.

Fly.io (multi-region)

The root fly.toml runs the live demo: two Machines in cdg, each with its own atlas_data volume. A node refuses to start without a gossip key and at least one API credential, and Fly will not create volumes for an existing app. So set the secrets and create one volume per Machine before the first deploy:

fly secrets set -a atlas-edge ATLAS_GOSSIP_KEY="$(atlas-cli keygen)" \
  ATLAS_API_CREDENTIALS='[{"token":"<admin token>","scopes":["admin"],"expires_at":"2027-10-23T00:00:00Z"}]'
fly volumes create atlas_data -a atlas-edge --region cdg --size 1 --count 2
fly deploy --build-arg VERSION="$(git describe --tags --always)" --build-arg COMMIT="$(git rev-parse HEAD)"

Writes that reach the wrong Machine are forwarded to the owner over Fly's private network (each node advertises http://[<private IP>]:8080). Node IDs default to the hostname, which on Fly is the Machine ID, so if forwarding is unavailable a node falls back to answering with a Fly-Replay header. Either way, clients behind the public load balancer never see not_owner. Successful CI runs on main deploy through .github/workflows/fly-deploy.yml (it can also be started by hand). When the FLY_STAGING_API_TOKEN secret exists, the workflow first deploys the same revision to the isolated public atlas-staging.fly.dev environment and smoke-tests it, and only then deploys production; without it, production is deployed directly. FLY_API_TOKEN can live in the repository or the production GitHub environment; add required reviewers to that environment to gate production. To turn staging on, provision the staging app, persistent volume and unique secrets once:

fly apps create atlas-staging
fly volumes create atlas_staging_data -a atlas-staging --region cdg --size 1
fly secrets set -a atlas-staging ATLAS_GOSSIP_KEY="$(atlas-cli keygen)" \
  ATLAS_API_TOKENS="$(atlas-cli tokengen)"

Staging is a separate one-node cluster with its own database and credentials; do not reuse production keys or data. Add the FLY_STAGING_API_TOKEN secret only after the app exists, since its presence switches staging on.

The multi-region example below uses deploy/fly/fly.toml instead:

fly apps create atlas-edge
fly secrets set -a atlas-edge ATLAS_GOSSIP_KEY="$(atlas-cli keygen)" ATLAS_API_TOKENS="$(atlas-cli tokengen)"
# Create one same-named, region-local volume for every Machine before deploy.
fly volumes create atlas_data --region jnb --size 1
fly volumes create atlas_data --region fra --size 1
fly volumes create atlas_data --region sin --size 1
fly volumes create atlas_data --region iad --size 1
fly deploy --config deploy/fly/fly.toml --dockerfile Dockerfile
fly scale count 4 --region jnb,fra,sin,iad -a atlas-edge

Nodes discover each other through atlas-edge.internal DNS over Fly's private WireGuard network. Gossip is never exposed to the internet. Each Machine mounts its own /data volume; Atlas replicates registry records between nodes. Volumes are local to a Machine and do not replicate by themselves. Create additional atlas_data volumes in a region before scaling that region beyond one Machine, and keep independent database backups.

Improve this pageSource: README.md