Skip to content
Operate

Install in your cloud

Install the engine in your own Google Cloud project from a release bundle, or run it from an air-gapped bundle or Docker Compose.

On this page

Each MedHook release ships as a bundle. You mirror the release into your own Google Cloud project, then deploy it to a private GKE cluster with Cloud SQL, all from Cloud Build in your project. Nothing at runtime pulls from MedHook. The engine verifies its signed license offline, and its only outbound call to medhook.dev is the optional revocation check. This page covers that path, the air-gapped bundle and Docker Compose for evaluation.

Here is the flow for the GKE path.

sequenceDiagram
    participant You as Your operator
    participant Contact as Your MedHook contact
    participant Release as Release registry
    participant Project as Your Google Cloud project
    You->>Contact: Ask for access
    Contact->>Release: Grant your project read access
    You->>Project: Terraform builds cluster, database, secrets
    You->>Project: Cloud Build runs mirror.sh
    Release-->>Project: Images, chart and bundle copied
    You->>Project: Cloud Build runs deploy.sh
    Project-->>You: Engine healthy at your host name

Choose a path

PathUse it whenWhat you run
GKE and Cloud Buildproduction in your own Google Cloud projectthe release bundle
Air-gapped bundlethe host has no internet accessapps/engine/scripts/bundle-airgap.sh
Docker Composeevaluation on one machineapps/engine/scripts/bootstrap.sh

For the other Kubernetes and cloud options, see Deploy.

Before you start

  • A Google Cloud project with billing on, and the Google Cloud BAA accepted for your organization. Do not send PHI through the engine before that.
  • The installer permissions for the parts you install, not roles/owner. See Least privilege; the preflight checks them before the first apply.
  • Your choice of what you bring yourself: VPC, GKE cluster, Postgres, secret names, monitoring, or the chart only through Argo CD. See Bring your own infrastructure.
  • The license key issued by 1Putt under your contract (mdh_lic_v1.…). Your portal on medhook.dev lists it read-only.
  • Access to the release registry. You get it through your MedHook contact.
  • A DNS name for the engine in a zone you control, such as engine.example.test.
  • Two network ranges that overlap no healthcare organization network you connect to: one for the node subnet (default 10.250.0.0/24) and one for the Cloud SQL private range (default 10.251.0.0/20).
  • A shell with gcloud (Cloud Shell works), and terraform.

Set these variables for the commands below.

bash
export PROJECT_ID=your-project
export REGION=us-central1
export ENV=production
export VERSION=1.0.0-rc.19

Steps

1. Get the bundle

Your MedHook contact grants your project read access to the release registry and gives you the download command for your version. Unpack it.

bash
tar -xzf "medhook-bundle-${VERSION}.tgz"
cd "medhook-bundle-${VERSION}"

The bundle holds the Terraform module, the chart source, the deploy scripts and the operator guide for that release.

2. Create the infrastructure

bash
gcloud config set project "$PROJECT_ID"
gcloud services enable compute.googleapis.com container.googleapis.com cloudbuild.googleapis.com
gcloud storage buckets create "gs://${PROJECT_ID}-tfstate" --location="$REGION" \
  --uniform-bucket-level-access --public-access-prevention
gcloud storage buckets update "gs://${PROJECT_ID}-tfstate" --versioning

cd terraform/gke
cp terraform.tfvars.example terraform.tfvars
terraform init -backend-config="bucket=${PROJECT_ID}-tfstate" -backend-config="prefix=medhook/gke/${ENV}"
terraform plan -out=install.tfplan
terraform apply install.tfplan
gcloud storage cp terraform.tfvars "gs://${PROJECT_ID}-tfstate/medhook/gke/${ENV}/terraform.tfvars"

Set project_id, region, environment, your two ranges and the alert settings in terraform.tfvars first. Keep that file in the state bucket, as the last command does. Every upgrade replaces the bundle, and the bundle never contains your variables.

Terraform builds:

  • a private GKE cluster
  • Cloud SQL for PostgreSQL 16 (regional high availability, daily backups, point-in-time recovery, private IP only, TLS required, deletion protection in production)
  • Cloud NAT with a fixed egress IP, and a Cloud VPN gateway
  • Artifact Registry repositories and Secret Manager secrets
  • the deployer service account that Cloud Build runs as

The first apply takes 20 to 30 minutes. If it stops with a Kubernetes provider error, the cluster was not ready: run terraform apply again.

3. Add the secrets only you hold

Terraform generates the encryption key, the auth secret and the database password. You add the license key: the signed license issued by 1Putt under your contract. Do it from a terminal, never from chat or a ticket.

bash
printf '%s' 'mdh_lic_v1.…' | gcloud secrets versions add medhook-license-key --data-file=-

AI features stay off until you turn them on. See Security.

4. Mirror the release

Cloud Build runs mirror.sh in your project. It copies the engine, MLLP and DICOM listener images, the third-party images the chart runs (pinned by digest), the Helm chart and the bundle into your Artifact Registry.

bash
cd ../..
DEPLOYER=$(cd terraform/gke && terraform output -raw deployer_service_account)
gcloud builds submit deploy --config=deploy/cloudbuild-mirror.json \
  --service-account="projects/${PROJECT_ID}/serviceAccounts/${DEPLOYER}" \
  --gcs-source-staging-dir="$(cd terraform/gke && terraform output -raw build_source_staging_dir)" \
  $(cd terraform/gke && terraform output -raw cloudbuild_pool_flags) \
  --substitutions=_MEDHOOK_VERSION="$VERSION",_REGION="$REGION",_DOCKER_REPO="$(cd terraform/gke && terraform output -raw docker_repository)",_FILES_REPO="$(cd terraform/gke && terraform output -raw files_repository)"

Image tags in your registry are immutable. The mirror refuses to overwrite a tag that holds a different image, so a version always runs the same code. If a run fails partway, run it again: it skips what is already copied.

5. Point DNS at the engine

Create an A record for your engine name that points at terraform output -raw ingress_ip. Keep it DNS-only, with no CDN or proxy in front. Google issues the managed certificate once the name resolves, which takes 15 to 60 minutes.

6. Deploy

bash
gcloud builds submit . --config=deploy/cloudbuild-deploy.json \
  --service-account="projects/${PROJECT_ID}/serviceAccounts/${DEPLOYER}" \
  --gcs-source-staging-dir="$(cd terraform/gke && terraform output -raw build_source_staging_dir)" \
  $(cd terraform/gke && terraform output -raw cloudbuild_pool_flags) \
  --substitutions=_MEDHOOK_VERSION="$VERSION",_REGION="$REGION",_CLUSTER="$(cd terraform/gke && terraform output -raw cluster_name)",_CLUSTER_LOCATION="$(cd terraform/gke && terraform output -raw cluster_location)",_ENGINE_URL="https://engine.example.test",_DOCKER_REPO="$(cd terraform/gke && terraform output -raw docker_repository)",_HELM_ENV="$ENV",_CLOUDSQL_INSTANCE="$(cd terraform/gke && terraform output -raw cloudsql_instance)"

_ENGINE_URL is https:// plus the host only: no path and no port. The deploy also sets it as the ingress host for the certificate and every link the engine sends. A green build means the engine answered /api/health with HTTP 200. See Upgrade and roll back for what the build does along the way.

7. Create the first admin

There is no sign-up page. The first admin comes from inside the engine container.

bash
gcloud container clusters get-credentials "$(cd terraform/gke && terraform output -raw cluster_name)" \
  --location="$(cd terraform/gke && terraform output -raw cluster_location)" --dns-endpoint
kubectl exec -n medhook deploy/medhook-engine -- create-engine-user admin@example.test --role admin --name "Test Admin"

An admin is a member of every workspace, so this account needs no --workspace. It prints a one-time set-password link that is valid for 24 hours. The admin opens it, chooses a password and signs in. Set up sign-in email first if you can, so the link is also emailed. See Authentication.

8. Check the install

  1. curl https://engine.example.test/api/health returns "status": "healthy".
  2. Create API clients for your integrations. See Keys and secrets.
  3. Put the escrow copy of the master key in place. See Keys and secrets.
  4. Send yourself a test alert. See Monitoring.
  5. Run a restore drill once. See Back up and restore.

Healthcare organizations connect HL7v2 senders to the MLLP listener's internal address on port 2575, the default listener, and point site-to-site tunnels at terraform output -raw vpn_gateway_ip. To give a sender its own port, TLS or commit ACKs, add a listener as in MLLP listeners.

MLLP listeners

mllp.port (2575) is the listener named default. Helm mllp.listeners adds more, for example one port per sending system, or a TLS port. An MLLP trigger picks a listener by name under Listener. A workflow save that names a listener the deployment does not declare is refused with 400.

yaml
mllp:
  port: 2575
  listeners:
    - name: labs
      port: 6661
    - name: adt-tls
      port: 6662
      ackMode: original
      tls:
        secretName: medhook-mllp-adt-tls
        requireClientCert: false
  • Name and port. A name is 1 to 30 of a-z, 0-9 and -. Names and ports must be unique, mllp.port included, or the chart refuses to render.
  • Network. Each listener adds a Service port, a container port and a NetworkPolicy port. Add the port to the load balancer source ranges (mllp.service.loadBalancerSourceRanges) and to the tunnel's traffic selectors.
  • TLS. The Secret holds tls.crt and tls.key, and ca.crt when requireClientCert is true. The listener serves TLS 1.2 or later and never falls back to plaintext: a listener whose files cannot be read does not start. After you rotate the Secret, restart the listener (kubectl rollout restart -n medhook deploy/medhook-mllp). If the listener pod crash-loops, kubectl logs -n medhook deploy/medhook-mllp names the listener whose TLS files it cannot read.
  • ackMode. original (default) answers AA, AE or AR whatever MSH-15 says, which Epic and most senders expect. msh15 answers a message that sets MSH-15 with a commit ACK (CA, CE, CR), sent only as MSH-15 asks. See MLLP and ACKs.
  • Metrics. Every MLLP series carries a listener label.

Air-gapped hosts

apps/engine/scripts/bundle-airgap.sh builds one archive on a machine with internet access: every Docker image, the engine source and a checksums file.

bash
./engine/scripts/bundle-airgap.sh 1.0.0-rc.19 --include-ipsec

It writes medhook-airgap-<version>-images.tar, medhook-airgap-<version>-source.tar.gz and SHA256SUMS-<version>.txt to the current directory. Copy them to the host, check the checksums, load the images with docker load and start the stack as in the Compose steps below. --skip-build uses images you already have. The signed license is verified offline, so the engine runs without reaching medhook.dev. Leave LICENSE_REVOCATION_URL unset on a host with no egress. See License validation.

Docker Compose for evaluation

Compose runs the whole stack on one machine: the engine, PostgreSQL, Redis, Medplum, the MLLP listener, Prometheus and Grafana.

bash
cd apps/engine
bash scripts/bootstrap.sh
bash scripts/smoke-test.sh

bootstrap.sh generates the secrets, writes .env, starts the stack and waits for the health check. The Quick start walks through it. For a production Compose host, layer docker-compose.prod.yml, as Deploy describes.

Troubleshooting

The deploy stops before changing anything. The preflight found a cluster operation still running (for example Terraform still applying), the GCS FUSE CSI driver not enabled yet, or a permission the deployer lacks. Its message names the fix. Usually you apply this bundle's Terraform, wait for it to finish, and deploy again.

The deploy says an image has not been mirrored. Run step 4 again for the same version. The deploy pulls every image from your registry by digest.

cannot create resource "roles" in the deploy log. Your infrastructure is from an older bundle. Apply this bundle's Terraform, then deploy again.

The mirror says a tag already exists with a different image. Do not delete the tag. Contact your MedHook contact.

The certificate stays pending. The A record must point at the ingress IP and must be DNS-only. Check it resolves from outside, then wait up to an hour.

Reference