FHIR Chat · Config in env vars for JPA - Docker · hapi

Stream: hapi

Topic: Config in env vars for JPA - Docker


view this post on Zulip Richard Stanley (Apr 17 2021 at 03:12):

Hi folks. On HAPI JPA Server I'm trying to set environment variables for docker-compose files. I can confirm that this works with db configs, e.g. spring.datasource.url: 'jdbc:postgresql://db:5432/hapi' in docker-compose.yml files. But, what does not appear to work are configs in application.yml that are commented out, so hapi.fhir.cql_enabled: "true" does not work. Thoughts? (For the close observer, bools are enclosed in quotes in yml.)

Update: Doh, single quotes for the bool value worked. :)
Update: How does one enable partitioning, e.g. hapi.fhir.partitioning because multitenancy_enabled has been removed from application.yaml?

view this post on Zulip Richard Stanley (Apr 17 2021 at 21:50):

After some attempts, I'm not sure how multitenancy is enabled. Neither hapi.fhir.partitioning.multitenancy_enabled or hapi.fhir.partitioning_multitenancy_enabled are in 5.3 and master application.yaml

view this post on Zulip Jame Dang (Apr 19 2021 at 08:07):

Hi all,
I try to run the starter project with SpringBoot and the Rest Server is OK but for the Web Testpage UI (cannot run the hapi-fhir-testpage-overlay with SpringBoot). I don't know how to config the path then it throws exception : Could not open ServletContext resource [/WEB-INF/templates/home.html (when I run with Jetty it is OK). Could you help me ?

view this post on Zulip Richard Stanley (Apr 19 2021 at 14:19):

@Sean McIlvenna I'm going through PRs and it seems you may be the expert on application.yaml. Can I ask for your help on starting HAPI JPA in multitenancy mode?

view this post on Zulip Sean McIlvenna (Apr 19 2021 at 15:26):

Heh... Well, that's something I haven't done, yet. It's something that I would also like to know how to do, though.

view this post on Zulip Sean McIlvenna (Apr 19 2021 at 15:27):

Let me take a look at and see if I can figure out a general direction to point you in...

view this post on Zulip Sean McIlvenna (Apr 19 2021 at 15:29):

At first glance, it looks like partitioning is enabled by default

view this post on Zulip Sean McIlvenna (Apr 19 2021 at 15:30):

(which is the same as multi-tenancy)

view this post on Zulip Sean McIlvenna (Apr 19 2021 at 15:30):

And there are two configurable properties for partitioning:

  • allow_references_across_partitions
  • partitioning_include_in_search_hashes

view this post on Zulip Sean McIlvenna (Apr 19 2021 at 15:32):

HAPI can be configured to have a pre-defined set of tenants... but, in the case of hapi-fhir-jpaserver-starter, it looks like it allows any tenant ID

view this post on Zulip Sean McIlvenna (Apr 19 2021 at 15:33):

so, theoretically, you should just be able to GET/POST/PUT/DELETE with /fhir/<tenantID>/<resourceType>/<resourceId>

view this post on Zulip Sean McIlvenna (Apr 19 2021 at 15:33):

I'm going to test this out, now

view this post on Zulip Sean McIlvenna (Apr 19 2021 at 15:40):

oh... partitioning is not on by default

view this post on Zulip Sean McIlvenna (Apr 19 2021 at 15:40):

it is activated when the partitioning: property is present in the application.yml property

view this post on Zulip Sean McIlvenna (Apr 19 2021 at 15:40):

i.e.

    partitioning:
      allow_references_across_partitions: false
      partitioning_include_in_search_hashes: false

view this post on Zulip Sean McIlvenna (Apr 19 2021 at 15:40):

if that block is commented out, then partitioning is disabled

view this post on Zulip Sean McIlvenna (Apr 19 2021 at 15:47):

Once partitioning is enabled, you can create partitions with the custom operation $partition-management-create-partition, as documented here:
https://hapifhir.io/hapi-fhir/docs/server_jpa_partitioning/partitioning_management_operations.html

view this post on Zulip Sean McIlvenna (Apr 19 2021 at 15:47):

This should be done against the DEFAULT partition

view this post on Zulip Sean McIlvenna (Apr 19 2021 at 15:48):

i.e.: POST http://localhost:8080/fhir/DEFAULT/$partition-management-create-partition

view this post on Zulip Sean McIlvenna (Apr 19 2021 at 15:48):

After the partition is created, you can do whatever you want with it, like a normal FHIR server

view this post on Zulip Sean McIlvenna (Apr 19 2021 at 15:48):

under a partition/tenant in the path of the url

view this post on Zulip Sean McIlvenna (Apr 19 2021 at 15:48):

Hope that helps!

view this post on Zulip Richard Stanley (Apr 19 2021 at 16:01):

Ok, interesting. I tried it with env vars and there's no way to toggle just partitioning on/off. This seems to be an anti-pattern for automated E2E/QA because the only solution is to hand edit the file and it is not explicit (See https://12factor.net/config).


Last updated: Apr 12 2022 at 19:14 UTC