Skip to content

Upgrading Safely

Sam Bent edited this page Nov 17, 2026 · 13 revisions

Upgrading Safely

Moving to a new version of HiddenForge keeps your .onion address, as long as you keep your key folder. The upgrade never touches existing keys. Here's the safe way to do it.

Before you start

Back up your key folder if you haven't lately. An upgrade shouldn't lose it, but a backup costs nothing and the address is irreplaceable. See Backing Up Your Onion Address.

Upgrading from 2.1.x or 3.0.x

From any 2.1.x or 3.0.x release nothing else is needed: pull the new image and recreate the container with the same compose file, the same key folder and the same *_TOR_SERVICE_HOSTS lines. The address stays the same, and the healthcheck your compose file already declares keeps working. Upgrading a 2.1.6 volume and rolling it back were both tested with the same key.

What changed is inside the image: it has no shell, no Python and no cat. Every command inside the container is hiddenforge <command>. If a script of yours reads the address with cat inside the container, change it to hiddenforge show --name <service>, or read <service>.onion in your key folder on the host. Anything else, such as docker exec <container> sh, is refused with a message pointing to hiddenforge <command>. The 3.0 options (setup --no-root, setup --encrypt-keys, client-auth, full vanguards) are all off until you turn them on. See The hiddenforge CLI. If you are on 2.0.4, read the README's section on upgrading from 2.0.4 first.

The upgrade

  1. Check what changed. Read the release notes / changelog for the new version, especially anything under "Security" or "Changed." Occasionally a new version changes a default worth knowing about.

  2. Pull the new image and verify it. Don't skip verification just because it's an upgrade. See Verifying the Image.

docker pull sambent.dev/sam/hiddenforge:<new-version>
  1. Update the tag in your docker-compose.yml if you pin a specific version (recommended over latest, so upgrades are a deliberate choice).

  2. Recreate the container:

docker compose up -d

Your key folder is a mounted volume, so the new container starts with the same keys and serves the same address. You should see the same .onion when you check:

hiddenforge show --keys ./tor-keys --name mysite
  1. Wait until it reports ready, then confirm the address loads in Tor Browser. Tor starts from scratch on every restart (its state is not kept), so allow from tens of seconds to a few minutes; hiddenforge status --container tor --keys ./tor-keys says when it is ready and, if not, why.

Why your address survives

On every start, HiddenForge creates the service folder only if it's missing and leaves any existing key exactly as it found it. It never regenerates or overwrites a key. So a new image with a newer Tor version reuses the key you already have.

Upgrading your backend

You don't need to touch the tor container when you upgrade or recreate your backend. Tor itself only accepts IP addresses, so HiddenForge looks the backend's name up at startup, then re-checks it every 30 seconds. When the backend comes back on a different internal IP, HiddenForge restarts itself to follow it, typically within a minute, and the address answers again after the usual restart time; your .onion doesn't change. The same happens if the backend was not up yet when HiddenForge started, as after a host reboot. This relies on the restart policy the shipped compose files set (restart: unless-stopped for Docker, always for Podman); keep it.

Rolling back

If a new version misbehaves, roll back by setting the image tag to the previous version and running docker compose up -d again. Because your keys are untouched, the older version comes back with the same address. This is another reason to pin an explicit version rather than latest: you always have a known-good tag to return to.

Sealed keys cannot be rolled back as they are. If you turned on key encryption at rest (setup --encrypt-keys), 2.1.6 cannot read the sealed key. Before rolling back, stop the service and turn encryption off:

hiddenforge unseal-keys --keys ./tor-keys --name myapp --passphrase-file ./key-passphrase.txt

unseal-keys puts the plaintext key back, checks it matches the sealed one, and only then removes the sealed copy. Remove HIDDENFORGE_KEY_PASSPHRASE_FILE and the passphrase secret from the compose file as well, or a 3.0 start would seal the key again.

Clone this wiki locally