Offline InstallInstall stages

§ 05 · OFFLINE INSTALL · STAGES

Install stages

Ten numbered scripts. Seven run from the orchestrator, one runs every time, two only run if you type them.

Configure the site first

Everything downstream is fingerprinted against this file, so get it right before the first run.

cd /srv/hivecfm-offline-kit
cp config/site.example.json config/site.json
nano config/site.json
python3 helpers/validate-site.py config/site.json ; echo "rc=$?"

The seventeen keys, and the four worth arguing about:

FieldMeaning
container_runtimepodman default. Set docker only before installation, and read the caveats on stages 07 and 10 first
server_ipStatic IPv4 of this server on the offline LAN
core_host, superset_host, n8n_hostThree distinct internal DNS hostnames. Identical values fail validation
allowed_client_cidrsLAN clients nginx will admit. A universal allowlist is rejected
docker_subnetLegacy field name for the private container /24. Applies to Podman too. Must not overlap LAN, VPN, or hypervisor networks
tls_modelocal-ca generates a site CA and certificate; provided imports files you supply
local_ntp_serverAn internal NTP address, or empty. Empty is dangerous — see below
webhook_allowed_cidrsApplication SSRF allowlist. Not a network route
backup_destinationA separate, already-mounted filesystem
⚠️

Judge validate-site.py on its exit code, never on its output. It prints Offline site configuration is valid. before its final assertion runs, so a bad container_runtime prints “valid” and then exits non-zero. Two more traps: run it on the target or in WSL, because on Windows Path('/mnt/hivecfm-backup').is_absolute() is False and backup_destination fails for no real reason; and an AssertionError with no message is one of the unlabelled checks, usually the three-distinct-hostnames rule or https_port != http_port.

Leaving local_ntp_server empty is not a neutral default. Stage 02 renames the OS chrony configuration away and writes a replacement with no time source at all, on a host where clock drift breaks TLS, tokens, scheduled workflows and licence validation. Decide deliberately: either give it a server, or accept that time is now a manual operational task and write that into the handover.

Run it

sudo bash install-offline.sh

That wrapper is nine lines, and its shape explains most of the surprises:

bash "$kit/scripts/01-verify-offline-bundle.sh"
for step in 02-install-host-packages 03-load-images 04-configure-runtime \
            05-start-data-services 06-migrate-start-applications \
            07-enable-local-https 08-test-offline-installation; do
  if test -f "/opt/hivecfm-offline/.state/$step.done"; then
    echo "Completed earlier: $step"
  else
    bash "$kit/scripts/$step.sh"
  fi
done

Three consequences worth internalising. Stage 01 sits outside the loop, so every resume re-hashes about 5 GB before doing anything. Stages 09 and 10 are never named at all — they only happen because an operator types them. And the loop is a skip-on-marker resume, not an idempotent re-run: a stage that already left its marker is not re-executed, and several of them would do damage if it were.

The ten stages

OrchestratedEvery runManual only

Collapsed, this is the shape of the pipeline. Open a stage for the command, the observable that closes its gate, the caveat, and the evidence file it leaves behind.

  1. Stage 01verify-offline-bundleEvery runRe-hashes all 300 manifest entries, asserts the OS, fingerprints site.json, checks capacity
    Closes on

    All bundled file hashes PASS: 300, then Target: Ubuntu24.04 amd64. Site settings fingerprint and capacity PASS.

    Caveat

    Sits outside the orchestrator's marker loop, so it runs on every invocation — each resume re-hashes about 5 GB before anything else happens. It also asserts ubuntu:24.04:x86_64, MemTotal at least 15 GiB, and at least 30 GiB free.

    Marker

    /opt/hivecfm-offline/.state/01-verify-offline-bundle.done

  2. Stage 02install-host-packagesOrchestratedInstalls 191 local debs from a file:// repo inside a network namespace with no interfaces
    Closes on

    docker version and docker compose version both answer over the Podman socket; podman info reports the netavark backend

    Caveat

    Refuses any host that already has containers (exit 2) and there is no documented recovery — prune and marker deletion are both forbidden elsewhere in the docs. Re-running copies its own generated files over the pristine .before-hivecfm-offline backups. If local_ntp_server is empty it replaces the OS chrony config with one that has no time source at all.

    Marker

    /opt/hivecfm-offline/.state/02-install-host-packages.done

  3. Stage 03load-imagesOrchestratedLoads the six-image archive locally and verifies each image against the manifest
    Command
    podman load -i images/hivecfm-images-amd64.tar.gz
    Closes on

    verify-images.py passes for all six images (linux/amd64 plus rootFS layer diffIDs)

    Caveat

    configSha256 is compared only when container_runtime is docker. On the shipped Podman default the image config is never checked — only Os, Architecture, and the rootFS layers.

    Marker

    /opt/hivecfm-offline/.state/03-load-images.done

  4. Stage 04configure-runtimeOrchestratedAir gapGenerates the site's secrets, local CA and certificate, database bootstrap SQL, nginx vhosts, and the runnable compose file
    Closes on

    dc config --quiet exits 0, and the rendered compose.yaml parses with networks.backend.internal true (read it with python3 + PyYAML; the file is YAML, so jq cannot)

    Boundary

    This is where the air gap is created. configure-offline.py rewrites every service onto a single internal: true bridge and pops every ports: mapping. The checked-in compose.source.yaml declares a second, egress-capable network and attaches it to seven services — that template is not what runs.

    Caveat

    The server certificate is issued for 365 days and regenerated only if pki/server.crt is absent, but openssl x509 -checkend 1209600 runs unconditionally. Inside the last 14 days of year one, the only stage that could reissue the certificate aborts on the expiring one. The remedy (remove server.crt and server.key, then re-run) appears in no script and no document.

    Marker

    /opt/hivecfm-offline/.state/04-configure-runtime.done

    Evidence

    offline-configuration.json

  5. Stage 05start-data-servicesOrchestratedStarts PostgreSQL/pgvector and Valkey, with no image pulls
    Command
    # 'dc' is a helper function defined in scripts/common.sh, not a command on PATH.
    # The stage runs: dc up -d --no-recreate --pull never --wait --wait-timeout 300 postgres redis
    sudo bash /opt/hivecfm-offline/scripts/hivecfm-compose.sh ps postgres redis
    Closes on

    Both containers report healthy inside the 300-second wait

    Marker

    /opt/hivecfm-offline/.state/05-start-data-services.done

  6. Stage 06migrate-start-applicationsOrchestratedApplies 200 Prisma migrations, creates 15 analytics views and their grants, initialises Superset and n8n, bootstraps the admin
    Closes on

    core-migration-verification.json reads expected 200, missing [], extra [], failed 0

    Caveat

    This is schema migration and application bootstrap. It is not the MSSQL to PostgreSQL data migration — @hivecfm/migrator appears nowhere in this kit. The stage also creates a permanent owner account, offline-admin@example.invalid, holding an API key with read, write and manage on the organization plus write on every environment. Nothing removes it.

    Marker

    /opt/hivecfm-offline/.state/06-migrate-start-applications.done

    Evidence

    core-migration-verification.json · uat-bootstrap.json

  7. Stage 07enable-local-httpsOrchestratedInstalls the nginx vhosts, host name mappings and CA trust, the stack systemd unit, and the health timer
    Closes on

    nginx -t passes and systemctl is-enabled hivecfm-offline-stack.service returns enabled

    Caveat

    The stack unit and the nginx ordering drop-in are created only in Podman mode. Under docker they do not exist, so the status command the kit README gives every operator fails there and nginx can start before the containers do.

    Marker

    /opt/hivecfm-offline/.state/07-enable-local-https.done

  8. Stage 08test-offline-installationOrchestratedRe-verifies images and migrations, then runs the functional acceptance suite and a health probe
    Closes on

    offline-health.json reports status PASS

    Caveat

    The suite hard-asserts that the count of rows in pg_policies for schema public is exactly 0. The day anyone remediates the known multi-tenant isolation gap, this stage fails and the acceptance checklist can no longer be completed.

    Marker

    /opt/hivecfm-offline/.state/08-test-offline-installation.done

    Evidence

    offline-application-tests.json · superset-integration.json · offline-health.json

  9. Stage 09backup-and-restore-testManual onlyEncrypted backup of five databases plus volumes and config, then an isolated restore drill
    Command
    sudo bash scripts/09-backup-and-restore-test.sh
    Closes on

    Every recorded per-table row count matches after restoring into a separate network-disabled container

    Caveat

    Never called by install-offline.sh. Requires a genuinely separate mounted destination — a drill onto the same disk proves nothing. The archive includes secrets/ and pki/, so one backup plus the recovery key is total site compromise, and that key currently lives on the host it protects.

    Marker

    /opt/hivecfm-offline/.state/09-backup-and-restore-test.done

    Evidence

    latest-offline-backup.json · restore-test.json

  10. Stage 10reboot-and-verifyManual onlyReboots the target, then proves the stack came back
    Command
    sudo bash scripts/10-reboot-and-verify.sh --reboot-now
    # reconnect, then:
    sudo bash scripts/10-reboot-and-verify.sh --verify-after-reboot
    Closes on

    Only the second invocation can close this gate: --reboot-now records boot_id and reboots without reaching done_step, so the marker and the health probe come from --verify-after-reboot

    Caveat

    Never called by install-offline.sh. As written it runs only the health probe — no application check and no mount assertion, both of which the acceptance checklist requires. And the probe exits 0 writing no evidence at all when the backup lock is held, so this stage can pass having verified nothing. Judge it on the timestamp inside offline-health.json, not on the exit code.

    Marker

    /opt/hivecfm-offline/.state/10-reboot-and-verify.done

Mirrors hivecfm-offline release 2026.9.7. Stage numbers are the script filenames under offline-kit/scripts/.

Where the air gap comes from

This is the single most important thing on the page, and you cannot see it by reading the config.

The checked-in config/compose.source.yaml declares two networks: backend, marked internal: true, and egress, which is not internal. It attaches egress to seven of nine services. Read that file on its own and you would conclude the stack has outbound network.

It does not, because stage 04 rewrites it. helpers/configure-offline.py forces every service onto backend alone, deletes every ports: mapping, and replaces the whole network map with a single bridge:

service['networks'] = ['backend']          # egress attachment dropped
service.pop('ports', None)                 # nothing published to the host
compose['networks'] = {'backend': {'internal': True, ...}}
🚫

The air gap is produced by a transformation at install time, not declared in a file you can read. compose.source.yaml is a template, not a runnable artifact. Anyone — human or agent — reasoning about this stack from the checked-in YAML will be wrong about its single most important property.

Verify the outcome rather than trusting the intent:

sudo python3 -c "import yaml; \
print(yaml.safe_load(open('/opt/hivecfm-offline/compose/compose.yaml'))['networks']['backend']['internal'])"
# True

The rendered composeDocker ComposeThe YAML file and CLI that spin up Postgres, Redis, MinIO, MailHog locally with one command. file is YAML, so jq cannot read it. PyYAML is present on the target because configure-offline.py itself imports it.

The same rewrite is why no host port is published at all. psql -h localhost -p 5432 cannot work here. Reach the database through the container:

sudo podman exec -i hivecfm-offline-postgres-1 \
  psql -U hivecfm_core -d hivecfm -Atc 'select current_database(), current_user'
# hivecfm|hivecfm_core

Use podman exec, not docker exec. A fresh sudo resets the environment and drops the DOCKER_HOST export that the kit’s own scripts set, so a bare sudo docker exec looks for /var/run/docker.sock, which does not exist on a Podman install.

The only LAN listeners are nginx on <bind_address>:<http_port>, which redirects, and <bind_address>:<https_port>, which proxies to the fixed container addresses at subnet offsets 10, 11 and 12 behind a client CIDR allowlist.

Resuming after a failure

The wrapper stops at the first failing step and logs under /opt/hivecfm-offline/logs/<step>.log. Fix the specific cause and run the wrapper again; completed stages are skipped and the failed one resumes.

Two rules that are not optional:

Never re-render site.json cosmetically. Stage 01 fingerprints the file’s bytes into .state/site.sha256. A CRLF round-trip through a Windows editor is enough to abort every later resume with Site settings changed: do not reuse old step markers for a different target. When you must ship it from Windows, strip carriage returns on the way in and record the hash:

scp site.json <box>:/tmp/site.json
ssh <box> 'tr -d "\r" < /tmp/site.json | sudo tee /srv/hivecfm-offline-kit/config/site.json >/dev/null
           rm /tmp/site.json && sha256sum /srv/hivecfm-offline-kit/config/site.json'

Running a single stage skips the guard. sudo bash scripts/06-*.sh avoids the 5 GB re-hash, but it also bypasses the site-change check that only stage 01 performs. If you resume stage by stage, diff the hash yourself first:

sudo sha256sum /srv/hivecfm-offline-kit/config/site.json
sudo cat /opt/hivecfm-offline/.state/site.sha256
⚠️

Do not delete markers to force a different site onto an existing installation, and do not re-run first-install scripts to rotate credentials or upgrade. Stage 02 in particular overwrites its own .before-hivecfm-offline backups on a second run, so the pristine originals are gone after it.

Before you move 5 GB to a customer site

Stage 02 refuses any host that already has containers, exits 2, and there is no documented recovery: podman system prune --volumes and marker deletion are both forbidden elsewhere in the kit’s own documentation. Establishing that on arrival is expensive. Probe first, read-only, over SSH:

ssh <box> '. /etc/os-release; echo "OS=$ID:$VERSION_ID:$(uname -m)"
  grep MemTotal /proc/meminfo
  df -B1 --output=avail,target /opt/hivecfm-offline 2>/dev/null || df -B1 --output=avail,target /opt
  command -v python3 || echo NO_PYTHON3
  sudo -n true && echo SUDO_OK || echo SUDO_PROMPTS
  if command -v podman >/dev/null; then sudo podman ps -aq > /tmp/p.$$ && \
    echo "PODMAN_CONTAINERS=$(wc -l < /tmp/p.$$)" || echo PODMAN_QUERY_FAILED; fi
  if command -v docker >/dev/null; then sudo docker ps -aq > /tmp/d.$$ && \
    echo "DOCKER_CONTAINERS=$(wc -l < /tmp/d.$$)" || echo DOCKER_QUERY_FAILED; fi'

Five conditions, each mapped to the exact refusal it prevents:

Must holdOr else
OS=ubuntu:24.04:x86_64stage 01 fails on a bare test with no explanatory message, only common.sh’s generic FAILED 01-verify-offline-bundle trap line
MemTotal ≥ 15728640 kBstage 01: Minimum 16GB memory; recommended 32GB.
/opt available ≥ 32212254720stage 01: Need at least 30GiB free
PODMAN_CONTAINERS=0 and DOCKER_CONTAINERS=0stage 02 exit 2, no recovery path — refuse the box here. A *_QUERY_FAILED line is not a zero: treat it as unknown and resolve it before shipping media
SUDO_OKevery stage runs under sudo; a prompt hangs an unattended run

Client DNS, trust, and first login

Clients need DNS and trust before anyone can log in. Create three A records pointing at server_ip, or distribute the line from /opt/hivecfm-offline/config/hosts.snippet — the installer edits the server’s own hosts file only. Copy only /opt/hivecfm-offline/pki/ca.crt to clients. Never distribute ca.key, server.key, or anything from the secrets directory.

Bootstrap logins are offline-admin@example.invalid for Core and n8n, offline-admin for Superset, with per-site passwords in /opt/hivecfm-offline/secrets/generated-secrets.json under the keys uat_admin, n8n_admin and superset_admin. Move them into your credential vault, plan rotation, and never paste that file into a support ticket.

Continue to Reading the evidence before you tell anyone the install passed.


HiveCFM Developer Hub — internal team guide