> For the complete documentation index, see [llms.txt](https://docs.hardpoint.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hardpoint.dev/guides/invar/operations/compute.md). Agents can also search and read this documentation through its [MCP server](https://docs.hardpoint.dev/~gitbook/mcp).

# Compute

Invar is single-writer by design: exactly one process holds the write lock for a given dataset, and SlateDB fences off any previous writer that tries to keep going after a new one takes over. That single fact shapes every deployment pattern below — you're not looking for the usual "N replicas behind a load balancer" story, you're looking for "exactly one instance, restarted safely."

This page also assumes Invar stays internal to your infrastructure. Whether you're running one shared instance or one per tenant, treat it the way you'd treat a database, not a public-facing service — reachable from the systems that talk RESP to it, not from the internet. Nothing below allocates a public IP or opens an ingress.

## Kubernetes

A `Deployment` with `replicas: 1` and the `Recreate` strategy is the right shape — `Recreate` tears down the old pod before starting the new one, so you never have two writers racing for the lock during a rollout. (You'd survive a brief overlap anyway, thanks to fencing — the old pod would just start erroring on writes rather than corrupting anything — but there's no reason to rely on that when avoiding it costs nothing.)

Since Invar speaks RESP over a plain TCP socket rather than HTTP, use `tcpSocket` probes rather than HTTP health checks:

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: invar
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: invar
  template:
    metadata:
      labels:
        app: invar
    spec:
      containers:
        - name: invar
          image: ghcr.io/hardpointlabs/invar:latest
          args: ["--redis"]
          env:
            - name: INVAR_BACKEND
              value: slate
            - name: INVAR_S3_BUCKET
              value: my-bucket-name
            - name: INVAR_BUCKET_PREFIX
              value: /invar/prod
          envFrom:
            - secretRef:
                name: invar-s3-credentials
          ports:
            - containerPort: 6379
              name: resp
          readinessProbe:
            tcpSocket:
              port: 6379
            initialDelaySeconds: 2
            periodSeconds: 5
          livenessProbe:
            tcpSocket:
              port: 6379
            initialDelaySeconds: 5
            periodSeconds: 10
---
apiVersion: v1
kind: Service
metadata:
  name: invar
spec:
  type: ClusterIP
  selector:
    app: invar
  ports:
    - port: 6379
      targetPort: 6379
      name: resp
```

`invar-s3-credentials` is a `Secret` holding `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` (and `AWS_REGION`, if it's not baked into the image or IMDS). If you're on EKS, prefer IAM Roles for Service Accounts over static keys — annotate the pod's `ServiceAccount` and drop the `Secret` entirely; Invar picks up credentials through the standard AWS SDK chain either way.

The `ClusterIP` `Service` above is deliberately not a `LoadBalancer` or behind an `Ingress` — other workloads in the cluster reach it at `invar.<namespace>.svc.cluster.local:6379`, and nothing outside the cluster can.

## Fly.io

Fly Machines are a good fit here specifically because they expose raw TCP rather than assuming everything's HTTP, and a Fly Machine maps naturally onto "exactly one instance" — there's no separate orchestration layer trying to run several. This also lines up well with the instance-per-tenant model: one Machine (and one `--prefix`) per tenant, private by default.

```toml
# fly.toml
app = "invar-tenant-123"
primary_region = "iad"

[env]
  INVAR_BACKEND = "slate"
  INVAR_S3_BUCKET = "my-bucket-name"
  INVAR_BUCKET_PREFIX = "/invar/tenant-123"

[[services]]
  internal_port = 6379
  protocol = "tcp"
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 0

  [[services.ports]]
    port = 6379
```

Set credentials as secrets rather than plaintext env vars:

```bash
fly secrets set AWS_ACCESS_KEY_ID=... AWS_SECRET_ACCESS_KEY=... AWS_REGION=us-east-1
```

Deliberately don't run `fly ips allocate-v4` here. Without a public IP, the Machine is reachable only over Fly's private WireGuard network (6PN), at `invar-tenant-123.internal:6379`, from other apps in the same Fly org — the direct equivalent of the `ClusterIP` pattern above. Whatever's issuing RESP commands to this instance should be another Fly app in your org, not an end user's browser.

`auto_stop_machines` / `auto_start_machines` with `min_machines_running = 0` gets you real scale-to-zero: idle tenants cost nothing, and the Fly Proxy wakes the Machine on the next incoming connection. Skip `fly scale count` beyond 1 — more Machines for the same dataset means more writers, which is exactly what you don't want.

## Serverless platforms

Classic FaaS platforms such as AWS App Runner, Lambda, e.t.c, are built around request-scoped invocation over HTTP, not a long-lived process holding open a raw TCP socket. The RESP server described on this page doesn't fit that shape, so none of these are a realistic target for it today, regardless of how the flags are configured.

If what you actually want is "pay only while a tenant's instance is active," Fly Machines' scale-to-zero-over-TCP above already gets you that. This page covers the RESP server specifically — if Invar ever speaks a protocol better suited to request/response platforms, that would change the calculus, but that's not part of the setup documented here.

## Up next

[Configuring object storage and caching](broken://pages/03642c24df9d662e56fdf2f7f6d8252a504893cb) covers the `--backend slate` side of things in more depth: bucket/prefix layout for multi-tenant setups, credentials, and what's tunable today versus what's still coming.
