Install MockHub on your own host
Before you begin
- You need
- A Linux host with Docker Engine 25.0 or later and the Compose plugin 2.24 or later
- The release bundle and MockHub's release public key, received separately
- Four hostnames and a wildcard you can point at the host
- A mail relay the host can send through
A self-hosted installation is installed from a release bundle MockHub signs. You check the bundle, load it, fill in the settings, and the mockhub command starts and checks the stack and creates the first administrator.
Check the bundle
Section titled “Check the bundle”A release arrives as a directory, mockhub-<release>-<arch>/, or as that directory in one .tar with its SHA-256 beside it. MockHub gives you its release public key through another channel than the bundle, such as your contract’s annex, or read out on a call and compared by fingerprint. Check the bundle with OpenSSL alone before you use anything in it:
cd mockhub-v1.4.0-amd64base64 -d MANIFEST.sig > /tmp/manifest.sigopenssl dgst -sha256 -verify mockhub-release.pub -signature /tmp/manifest.sig MANIFEST # Verified OKawk '$1 == "file" { print $2 " " $3 }' MANIFEST | sha256sum --check --strict --quiet # silent when intactcosign verify-blob --key mockhub-release.pub --signature MANIFEST.sig --insecure-ignore-tlog MANIFEST checks the same signature. Once installed, ./mockhub verify BUNDLE makes both checks with the keys in keys/.
| In the bundle | What |
|---|---|
MANIFEST |
The release, its date, architecture and the releases it upgrades from; every image and file with its checksum |
MANIFEST.sig |
MockHub’s signature of MANIFEST |
dist/ |
What the installation directory holds |
images/ |
Each image, for a host that does not pull from a registry |
sbom/, NOTICES.md |
Each image’s software bill of materials, and the third-party notices |
Install
Section titled “Install”-
Copy the bundle’s
dist/into the installation directory, for example/opt/mockhub:Terminal window cp -a mockhub-v1.4.0-amd64/dist/. /opt/mockhub/ -
Load the bundle, from the installation directory:
Terminal window ./mockhub load /path/to/mockhub-v1.4.0-amd64It verifies the bundle again, checks that the directory holds its files unchanged, loads its images and records its signed manifest. For a bundle without images,
installpulls each missing one from its registry later and checks it. A bundle with images needs no registry at all. -
Point four DNS records and a wildcard at the host:
API_HOST,UI_HOST,DOCS_HOST,GATEWAY_HOSTand*.GATEWAY_HOST, such asapi.mockhub.example.com,mockhub.example.com,docs.mockhub.example.com,mock.example.comand*.mock.example.com. Every project answers on its own subdomain of the gateway host. Open the firewall for the features you will use; see Network requirements. -
Run
./mockhub install. It first checks the directory against the signed manifest, as every run does. The first run writes.envfromenv.template, with fresh secrets, and stops, listing the settings to fill in. If a secret cannot be made, the error names the setting; run./mockhub installagain once the cause is fixed, and it keeps the secrets already made. -
Fill them in
.env: the four hostnames, the support, abuse and security mailboxes, the mail relay, andTLS_MODE. See Configuration reference and Choose a TLS mode. Review the optional settings too, above allREGISTRATION_MODE,AI_GENERATION_POLICYandPASSWORD_BREACH_CHECK. -
Run
./mockhub installagain at a terminal, naming the first administrator:Terminal window ./mockhub install --admin-email admin@example.comIt asks for the administrator’s password twice, and creates the administrator before anyone can reach the installation. To pass the password from a script, add
--admin-password-stdinand send it on standard input; the first line is used. See Create the first administrator. -
Install the licence MockHub sent you.
-
Create a canary: a project with one mock whose body never changes. Set
CANARY_URLto its fullhttps://address andCANARY_BODYto its exact body in.env, so./mockhub statuschecks a real mock end to end.
Result
Section titled “Result”install ends with the address of the app, Installed v1.4.0: https://mockhub.example.com. On the way, it checked the host, that the files and images are the signed release’s and the edge’s configuration, then started the stack with ingress closed behind a maintenance page: the datastores, the database migrations, the installation’s plan, the WireMock registration, the first administrator, the services, a check from inside the edge, ingress opened, a check through the public listener, and the scheduler last.
Sign in at the UI_HOST address as the administrator. ./mockhub status checks the whole installation at any time. If the browser shows MockHub could not start instead, see The browser says MockHub could not start.
Before you rely on it
Section titled “Before you rely on it”- Back it up. Add a recovery key holder and take a first backup; see Back up and restore an installation.
- Keep
.envsafe. It holds the secrets that decrypt stored credentials and authenticator secrets, and nothing recovers them if it is lost. Every backup carries an encrypted copy. Never commit it or send it to anyone.
Change a setting later
Section titled “Change a setting later”Edit .env and run ./mockhub install again. It changes no secret: it applies the settings, closing ingress behind the maintenance page while it restarts what changed, and checks the stack before it reopens. The same command reopens a stack a failed maintenance window left closed, once the cause is fixed.
Limits
Section titled “Limits”installrefuses a directory with no recorded signed manifest.--unverifiedinstalls one anyway, with a warning thatstatusrepeats, for a build MockHub tests before bundling it.- Ingress stays closed until the installation has an administrator. Without
--admin-email,installasks for the address at a terminal, and otherwise stops with the command to run. - An image comes only from where the manifest says. An image the bundle carries comes only from
./mockhub load; when it is missing,installnames its archive and refuses. An image from a registry is pulled only when it is missing, and never with--no-pull. An image on the host under the release’s name but with another ID is refused, not replaced: remove that tag withdocker image rmand run the command again. - The host needs a kernel MongoDB can run on: not upstream 6.19 to 7.0.13.
install,status,restoreandupgradecheck it, and the Docker versions, because the host may be patched between maintenance windows. - A newer major Docker Engine or Compose line than a release was tested with is warned about, not refused.
installandbackuprefuse while a restore or an upgrade is unfinished; finish or roll it back first.