Deploying Ottehr on Google Cloud Platform (GCP)
Deploying Ottehr to GCP involves four steps:
- Set up your Ottehr environment, following the instructions in the Ottehr repository (opens in a new tab).
- Configure your GCP Project and add it to your Ottehr config (opens in a new tab).
- Run the deploy script
- 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.
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.jsonFor 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"Configure GCP
- If you do not have a GCP account, create one.
- Install the
gcloudCLI (opens in a new tab). - Run
gcloud auth application-default loginand 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-stagingThe 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 namestaging-patient-portal.example.comtostaging-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 namestaging-ehr.example.comtostaging-ehr.example.com.storage.googleapis.com.
Once the DNS changes are propagated, the deployed website should be available at each domain above.