Deploying Ottehr on Google Cloud Platform (GCP)

🚧
This documentation explains how to deploy Ottehr using Google Cloud Platform (GCP). We also have a guide for deploying using Amazon Web Services (AWS). If you want to deploy Ottehr on another provider, please open an issue on GitHub (opens in a new tab).

Deploying Ottehr to GCP involves four steps:

  1. Set up your Ottehr environment, following the instructions in the Ottehr repository (opens in a new tab).
  2. Configure your GCP Project and add it to your Ottehr config (opens in a new tab).
  3. Run the deploy script
  4. Configure domain name changes

If you want to experiment with Ottehr but don't want to deploy it, follow the steps in the Ottehr readme (opens in a new tab) to set it up on your computer.

ℹ️
Please read the guide Developing and Building Apps before storing patient health information on Oystehr

Deploying

Set up your Ottehr Environment

Follow the instructions in the Ottehr repository (opens in a new tab) to set up your Ottehr environment. You will need to fill in all of the configuration files as described in the instructions.

For example, to deploy to the staging environment, you will need:

deploy/backend.config
deploy/staging.tfvars
packages/zambdas/.env/staging.json

For GCP, you need to specify domains for the Patient Portal and EHR websites in your tfvars file. For example, in deploy/staging.tfvars:

ehr_domain = "staging-ehr.example.com"
patient_portal_domain = "staging-patient-portal.example.com"
ℹ️
Each Ottehr environment must have a separate Oystehr Project.

Configure GCP

  1. If you do not have a GCP account, create one.
  2. Install the gcloud CLI (opens in a new tab).
  3. Run gcloud auth application-default login and choose the account with access to the GCP Project.

Add your GCP project to the Ottehr configuration. For example, for a staging environment:

# In deploy/staging.tfvars
gcp_project = "ottehr-staging"
ehr_domain = "staging-ehr.example.com"
patient_portal_domain = "staging-patient-portal.example.com"

Run the deploy script

There are npm scripts for common environments included in the Ottehr repository. For example, to deploy to the staging environment, run:

# From deploy/ directory
npm run apply-staging

The script will take about 15 minutes to run and will deploy Ottehr to your GCP project.

Configure domain name changes

On the platform you use for managing your domain, add two CNAME records:

  • CNAME with the subdomain you chose for the Patient Portal website to staging-patient-portal.example.com.storage.googleapis.com. For example, a CNAME name staging-patient-portal.example.com to staging-patient-portal.example.com.storage.googleapis.com.
  • CNAME with the subdomain you chose for the EHR website to staging-ehr.example.com.storage.googleapis.com. For example, a CNAME name staging-ehr.example.com to staging-ehr.example.com.storage.googleapis.com.

Once the DNS changes are propagated, the deployed website should be available at each domain above.