EhrBase: Implementation with remote databases available?

Hey I’m looking to implement the openEHR server. From what I understand it’s a docker image that I can deploy on something like a Kuberentes cluster. However, after reading through the documentation I can’t see how to define the database URL. Is there a way in which I can point to an RDS on AWS or Cloud SQL for Google cloud for instance? I’d like to have snapshots and I don’t want to trust persistent data to a Docker container. All we need is that compute instance to go and everything will be wiped.


@Paulmiller is this something that NES have looked at? @birger.haarbrandt - any experience?

It’s a Spring Boot app. See this docker compose file: ehrbase/docker-compose.yml at develop · ehrbase/ehrbase · GitHub
see that db url on line 13? point that to your RDS instance and the spring boot app should run against it.
Getting the db up and running on RDS is some manual work for you to do, but if you want to be pragmatic, get the postgres image running. take a backup and restore to RDS. that’d be my first attempt for shotgun surgery.

You’ll have to re-create the config in the db image on RDS to do it properly though. Ehrbase was using Flyway the last time I checked, so I cannot see how you can avoid some code exploration.


I will ask! Beyond my ken…

Our team recommend @Seref 's reply above!

1 Like

That would be ‘Ken’ then? :wink:

1 Like

Just to add to what Seref has already said. The alternative to taking a backup from the postgres image is to use the provided SQL scripts here.

IIRC you will need to

  • run createdb.sql first to create the database
  • then run up the EHRbase application pointing to that DB so that the flyway migrations will run and create all the necessary tables etc
  • lastly run the migrate_to_cloud_db_setup.sql to ensure you have the necessary triggers created.

Thanks for these answers they are very helpful. Will start working on this. Also, is there an option for using surrealDB? Or is it only PostgreSQL that we can use?

Not for EhrBase (the particular implementation we’re talking about here) as far as I know.

Implementing the persistence of data for openEHR (or for any representation of clinical data for that matter) in a performant and robust way is very, very hard. That’s why there are not many persistence systems to choose from. (just don’t listen to that voice at the back of your head that says “surely it cannot be that hard” when you read this)


My understanding is that there is an EhrBase roadmap to allow other SQLdbs to be used as long as they support the emerging SQL JSON handling standard.

Partly off topic, but: could Cockroach DB be used as (potentially very distributed and fault tolerant) backend for EHRbase? “CockroachDB supports the PostgreSQL wire protocol and the majority of PostgreSQL syntax”.

See PostgreSQL Compatibility | CockroachDB Docs for details - are any of the listed as “not yet supported” features needed for EHRbase to run?