OpenEHR: Creating a Local Instance Using EHRbase and Docker

Getting started with an open source OpenEHR standard repository

Introduction

This guide will walk you through setting up a local instance of OpenEHR using EHR Base and Docker Compose.

Prerequisites

Before we begin, ensure you have the following:

  • Docker and Docker Compose installed on your machine

    • Docker Compose simplifies the process of managing multiple containers and their configurations.

Step 1: Create a Docker Compose File

Create a docker-compose.yml file in the root directory of your project with the following content:

version: '3.8'
services:
  ehrbase-postgres:
    image: ehrbase/ehrbase-v2-postgres:16.2
    networks:
      - ehrbase-net
    environment:
      POSTGRES_USER: postgres
      PASSWORD: postgres
      EHRBASE_USER: ehrbase_restricted
      EHRBASE_PASSWORD: ehrbase_restricted
      EHRBASE_USER_ADMIN: ehrbase
      EHRBASE_PASSWORD_ADMIN: ehrbase
    ports:
      - "5432:5432"
    volumes:
      - postgresdata:/var/lib/postgresql/data

  ehrbase:
    image: ehrbase/ehrbase
    depends_on:
      - ehrbase-postgres
    networks:
      - ehrbase-net
    environment:
      DB_URL: jdbc:postgresql://ehrbase-postgres:5432/ehrbase
      DB_USER: ehrbase_restricted
      DB_PASS: ehrbase_restricted
      DB_USER_ADMIN: ehrbase
      DB_PASS_ADMIN: ehrbase
      SERVER_NODENAME: local.ehrbase.org
      SPRING_PROFILES_ACTIVE: local
      SECURITY_AUTHTYPE: NONE
    ports:
      - "8080:8080"

networks:
  ehrbase-net:

volumes:
  postgresdata:
    name: dependencies_postgresdata

This Docker Compose file sets up both the PostgreSQL database and the EHRbase application, linking them together through the ehrbase-net network.

Step 2: Running Docker Compose

Using your preferred CLI, navigate to the directory containing your docker-compose.yml file and run:

docker-compose up -d

This command starts the services defined in the docker-compose.yml file.

Step 3: Verifying the Setup

To verify that EHR Base is running correctly, open your web browser and navigate to http://localhost:8080/ehrbase. You should see the welcome page indicating that EHR Base is up and running.

Conclusion

You have now successfully set up a local instance of OpenEHR using EHR Base and Docker Compose. This environment can be used for development, testing, and exploring the capabilities of the OpenEHR framework.

Next Steps

Now that we have a base to work from, we can look into getting started with EHRbase and what APIs are available to us.