# Upgrades

An upgrade replaces the `almad` binary or container image on one control-plane replica at a time while the remaining replicas keep serving. Existing state remains in place, though a release can update stored schemas or configuration defaults. Read the [Changelog](https://almaforge.com/news.md) and snapshot the state backend before upgrading.

In the standard deployment, each control-plane replica runs Auth and Proxy in one process. Upgrade every control-plane replica first, then upgrade workstation clients and target agents.

## Version scheme and compatibility[​](#version-scheme-and-compatibility "Direct link to Version scheme and compatibility")

AlmaForge uses calendar versioning in `YYYY.N.PATCH` format (for example `2026.2.0`, `2026.2.1`, and `2026.3.0`):

* **Feature releases (`YYYY.N.0`):** ship new capabilities and operational improvements. Read the [Changelog](https://almaforge.com/news.md) for any configuration or storage changes before upgrading.
* **Patch releases (`YYYY.N.PATCH`):** ship compatible bug fixes and security updates. Apply patch releases promptly, and treat security fixes as same-day updates when an advisory calls for it.

### Compatibility rules[​](#compatibility-rules "Direct link to Compatibility rules")

During a rolling upgrade, replicas, agents, and workstations run mixed versions temporarily. Follow these rules to keep the cluster available:

* **Upgrade the control plane before clients and agents.** Finish every `almad` replica before upgrading `alma` workstations or target agents. An agent compares its release year against Auth on startup and refuses to join a cluster running an older release year.
* **Upgrade one feature release at a time.** Move sequentially between feature releases (for example `2026.2` to `2026.3`) and bring clients and agents up to date before starting the next feature release. A cluster supports its own release and the previous feature release's clients and agents during the rollout window.
* **Replace one replica at a time.** Wait for each restarted replica to pass `/readyz` and stabilize before touching the next. With three replicas and a load balancer, new connections route to the replicas that remain in service. On Linux, `SIGHUP` supports a [zero-downtime reload](https://almaforge.com/reference/signals.md#zero-downtime-upgrade). For a full restart, [drain active sessions](https://almaforge.com/reference/signals.md#graceful-shutdown-during-maintenance) first.
* **Upgrade state backends separately.** Do not combine an etcd, PostgreSQL, DynamoDB, or Firestore upgrade with an AlmaForge upgrade in the same maintenance window.

## Pre-flight[​](#pre-flight "Direct link to Pre-flight")

Complete these checks before changing any production binary or image:

1. **Snapshot and verify the state backend.** Use the command that matches your backend (see [Backups](https://almaforge.com/backups.md) for restore steps):

   ******Terminal

   ```bash
   # etcd
   etcdctl snapshot save almaforge-<timestamp>.db
   etcdutl snapshot status almaforge-<timestamp>.db

   # PostgreSQL
   pg_dump -Fc -f almaforge-<timestamp>.dump <database-name>
   pg_restore -l almaforge-<timestamp>.dump >/dev/null

   # DynamoDB
   aws dynamodb create-backup --table-name <table-name> --backup-name almaforge-<timestamp>
   aws dynamodb describe-backup --backup-arn <backup-arn>

   # Firestore
   gcloud firestore export gs://<bucket>/almaforge-<timestamp>
   ```

2. **Review the [Changelog](https://almaforge.com/news.md)** for every release between your current version and the target version.

3. **Validate in staging** and run the checks in [Verification](#verification) before touching production.

4. **Confirm alerting** on `/readyz`, daemon restarts, and audit write errors.

5. **Freeze configuration changes** (roles, connectors, target joins) during the window and agree on rollback criteria before starting.

## Upgrade on Linux[​](#upgrade-on-linux "Direct link to Upgrade on Linux")

On package installs, the DEB and RPM maintainer scripts run `systemctl daemon-reload` and restart `almad.service` if it is already active. Drain the host from your load balancer before installing the package if you want to stop new sessions first. Tarball installs require a manual restart after replacing the binary.

### Control-plane replicas[​](#control-plane-replicas "Direct link to Control-plane replicas")

Repeat these steps on each control-plane host, one at a time:

******Terminal

```bash
sudo apt install almaforge=2026.2.30     # Debian/Ubuntu
# or
sudo dnf install almaforge-2026.2.30     # RHEL/Rocky/Fedora
```

For a tarball install, replace the binary and restart the service:

******Terminal

```bash
sudo install -m 0755 almad /usr/local/bin/almad
sudo systemctl restart almad
```

Verify the restarted host before moving to the next replica:

******Terminal

```bash
sudo systemctl is-active --quiet almad && echo active
sudo journalctl -u almad -n 30 | grep -Ei 'started|joined|ready'
curl -sf http://localhost:3000/readyz && echo ready
alma get auth
alma get proxy
```

Wait for the host to pass `/readyz` and stabilize (60 seconds is a reasonable baseline) before advancing to the next replica. Every control-plane replica must report the target version before you upgrade agents.

### Agent fleet[​](#agent-fleet "Direct link to Agent fleet")

Once all control-plane replicas are on the target version, upgrade target agents on their own schedule using the same package or tarball procedure. Verify agents reconnect on the new version:

******Terminal

```bash
alma get server
alma get kube
alma get db
```

If hosts run unattended upgrades, hold the package between planned windows:

******Terminal

```bash
sudo apt-mark hold almaforge
```

## Upgrade on Kubernetes[​](#upgrade-on-kubernetes "Direct link to Upgrade on Kubernetes")

The `almaforge` Helm chart deploys a three-replica `almad` StatefulSet by default. Upgrading the chart advances the server version unless you pin `image.tag`.

warning

Never deploy `:latest` in production. Leave `image.tag` unset so the chart version pins the image, or set an exact version tag during the upgrade window.

Back up the state backend and each replica's `<pod-name>-state` Secret per [Backups](https://almaforge.com/backups.md), then upgrade the release with the same values file used at install time (or `--reuse-values` if installed with `--set`):

******Terminal

```bash
helm repo update almaforge
helm upgrade almaforge almaforge/almaforge --version 2026.2.30 \
    --namespace almaforge -f values.yaml --wait
```

The StatefulSet uses `RollingUpdate`, replacing one pod at a time and waiting for `/readyz` before proceeding. Watch the rollout in a separate terminal:

******Terminal

```bash
kubectl rollout status statefulset/almaforge -n almaforge
kubectl -n almaforge get pods -l app.kubernetes.io/name=almaforge --watch
```

Verify the cluster once all pods are ready:

******Terminal

```bash
kubectl get pods -n almaforge
alma get auth
alma get proxy
```

After the control plane finishes, upgrade any `almaforge-agent` Helm releases or external Linux agents.

## Verification[​](#verification "Direct link to Verification")

Confirm that the CLI, every control-plane replica, and every `/readyz` endpoint report healthy on the target version:

******Terminal

```bash
alma version
alma status | grep Version
alma get auth -o yaml | grep version
alma get proxy -o yaml | grep version
curl -sf http://almaforge-1.almaforge.example.com:3000/readyz && echo ok
```

Upgrade workstation `alma` installations to match the cluster release once the rollout completes.

## Rollback[​](#rollback "Direct link to Rollback")

Rollback runs in reverse order: agents first, then control-plane replicas one at a time.

On Linux, install the previous package version on one host at a time and verify `/readyz` after each restart.

On Kubernetes, roll back the Helm release so values and image tags stay in sync:

******Terminal

```bash
helm -n almaforge history almaforge
helm -n almaforge rollback almaforge --wait
kubectl rollout status statefulset/almaforge -n almaforge
```

Prefer `helm rollback` over `kubectl rollout undo`, which reverts only the pod template and leaves Helm metadata out of sync. If a failing pod blocks StatefulSet rollback, revert the release and delete only the stuck pod so the controller recreates it.

note

Rolling back the binary does not roll back state written to the backend. If the target release changed stored state in a way the previous binary cannot read, stop every replica, restore the pre-upgrade snapshot from [Pre-flight](#pre-flight), and start the previous version. Changes made after the snapshot are lost.

## Troubleshooting[​](#troubleshooting "Direct link to Troubleshooting")

### Partial upgrade left in mixed state[​](#partial-upgrade-left-in-mixed-state "Direct link to Partial upgrade left in mixed state")

If an upgrade stops midway, diagnose the cause before touching another replica. If the new version is healthy and the stop was operational, resume one replica at a time. If the new version is failing, follow [Rollback](#rollback). Keep agents on the previous version until every control-plane replica matches.

### Agent rejected as too new for the cluster[​](#agent-rejected-as-too-new-for-the-cluster "Direct link to Agent rejected as too new for the cluster")

If an upgraded agent fails to join with a version-check error, confirm every control-plane replica is on the target version:

******Terminal

```bash
alma get auth
alma get proxy
```

A single replica still running an older release can cause intermittent join failures when the load balancer routes to it.

### Kubernetes pod stuck or in CrashLoopBackOff[​](#kubernetes-pod-stuck-or-in-crashloopbackoff "Direct link to Kubernetes pod stuck or in CrashLoopBackOff")

Inspect the failing pod before rolling back:

******Terminal

```bash
kubectl -n almaforge describe pod almaforge-0
kubectl -n almaforge logs almaforge-0 --previous
kubectl -n almaforge get events --field-selector involvedObject.name=almaforge-0
```

If the failure is caused by a transient external dependency, hold the rollout and fix the dependency. If it fails on configuration, missing secrets, or image pulls, roll back the Helm release.

### Daemon fails to start after an upgrade[​](#daemon-fails-to-start-after-an-upgrade "Direct link to Daemon fails to start after an upgrade")

A feature release can reject deprecated fields in drop-in manifests under `/etc/almaforge/almad.d/` (commonly `OIDCConnector` or `StorageConfig`) or require an updated environment variable. Check the daemon logs for the exact error:

******Terminal

```bash
sudo journalctl -u almad -n 80 | grep -Ei 'error|unknown|invalid|schema'
```

Fix the manifest or environment variable and restart that replica. Restore a state snapshot only when stored backend data requires recovery, not for a configuration file error.

## Further reading[​](#further-reading "Direct link to Further reading")

* [Changelog](https://almaforge.com/news.md): release features and upgrade notes.
* [Cluster on Linux](https://almaforge.com/deployment/linux.md): Linux host installation and operations.
* [Cluster on Kubernetes](https://almaforge.com/deployment/kubernetes.md#upgrades): Helm chart upgrades and StatefulSet rollout mechanics.
* [High Availability](https://almaforge.com/high-availability.md): how rolling restarts keep the cluster serving.
* [Backups](https://almaforge.com/backups.md): state snapshots and restore procedures.
