Deploying Ottehr on Google Cloud Platform (GCP)
Deploying Ottehr takes about 30 minutes, and involves four steps:
- Configure your GCP Project
- Set up your Oystehr Project
- 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
Configure GCP
- If you do not have a GCP account, create one
- Install the Terraform Command-Line Interface (opens in a new tab)
- Run
gcloud auth application-default login
and choose the account with access to the GCP Project
Set up your Oystehr Project
- 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).
- 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
) - In your local Ottehr code, navigate to the
scripts/deploy
directory, and create a file calleddeploy-config.json
. - 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" }
- Fill out the values.
google_project
- The ID of your Google Cloud projectproject_id
- The ID of your Oystehr project, found in the Oystehr Developer Consoleaccess_token
- The access token for your Oystehr project, found in the Oystehr Developer Consoleprovider_email
- The email address of a provider you want to use for the project. You will need access to this emailintake_domain
- The domain for the intake website. An example isintake.example.com
ehr_domain
- The domain for the EHR website. An example isehr.example.com
environment
- The name of the environment you are deploying to (e.g.development
,testing
,production
)
- 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
, replacingintake_domain
with the intake domain that was configured earlier. For exmaple, a CNAME nameintake
tointake.example.com.storage.googleapis.com
. - CNAME with the subdomain you chose for the EHR website to
ehr_domain.storage.googleapis.com
, replacingehr_domain
with the ehr domain that was configured earlier. For exmaple, a CNAME nameehr
toehr.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.