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.

Deploying Ottehr takes about 30 minutes, and involves four steps:

  1. Configure your GCP Project
  2. Set up your Oystehr Project
  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

Configure GCP

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

Set up your Oystehr Project

  1. If you haven't already, follow the steps in the Ottehr repository (opens in a new tab) for creating an Oystehr Account (opens in a new tab) and forking Ottehr (opens in a new tab).
  2. Create a new project in the Oystehr Developer Console (opens in a new tab). We recommend you name this project after the environment you are deploying to (e.g. development, testing, production)
  3. In your local Ottehr code, navigate to the scripts/deploy directory, and create a file called deploy-config.json.
  4. Paste the following JSON into deploy-config.json:
    {
        "google_project": "your_google_project",
        "project_id": "your_project_id",
        "access_token": "your_access_token",
        "provider_email": "your_provider_email",
        "intake_domain": "your_intake_domain",
        "ehr_domain": "your_ehr_domain",
        "environment": "your_environment"
    }
  5. Fill out the values.
    • google_project - The ID of your Google Cloud project
    • project_id - The ID of your Oystehr project, found in the Oystehr Developer Console
    • access_token - The access token for your Oystehr project, found in the Oystehr Developer Console
    • provider_email - The email address of a provider you want to use for the project. You will need access to this email
    • intake_domain - The domain for the intake website. An example is intake.example.com
    • ehr_domain - The domain for the EHR website. An example is ehr.example.com
    • environment - The name of the environment you are deploying to (e.g. development, testing, production)
  6. Save the file

Run the deploy.sh script

Run the following command in your terminal:

sh scripts/deploy/gcp/deploy.sh

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

You may get a message:

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value:

Type yes if you are ok with the changes and hit Enter.

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 intake website to intake_domain.storage.googleapis.com, replacing intake_domain with the intake domain that was configured earlier. For exmaple, a CNAME name intake to intake.example.com.storage.googleapis.com.
  • CNAME with the subdomain you chose for the EHR website to ehr_domain.storage.googleapis.com, replacing ehr_domain with the ehr domain that was configured earlier. For exmaple, a CNAME name ehr to ehr.example.com.storage.googleapis.com.

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

Environments

We recommend having a separate Oystehr Project for each of your environments.

For example, you may want to have different intake websites on development.ottehr-intake.example.com and testing.ottehr-intake.example.com and each will have its own Oystehr Project so the resources from one project are not connected to another.