FHIR Chat · fhir configuration · hapi

Stream: hapi

Topic: fhir configuration


view this post on Zulip Vasyl Herman (Jan 23 2021 at 14:28):

Hello, guys!
I am going to contribute a convenience docker-compose file which supports multistage build and contains some initial configuration via environment variables.
For example I found this document that describes how to enable FHIR Bulk export but I need help on how to use the Example Property module.[MODULE_ID].config.bulk_export.enabled = false via environment variables.
Also I don't understand how applocation.yml file's hapi.fhir.bulk_export_enabled property is related to the example mentioned above ( I mean module.[MODULE_ID].config.bulk_export.enabled = false)
Thanks!

view this post on Zulip Vasyl Herman (Jan 23 2021 at 14:29):

PS: what is [MODULE_ID]

view this post on Zulip Vasyl Herman (Jan 23 2021 at 14:32):

PS2: What PATH the application.yml file is located by default in the container

view this post on Zulip Vasyl Herman (Jan 23 2021 at 14:44):

version: '3.7'
services:
  hapi-fhir-jpaserver-startv2:
    build: .
    restart: on-failure
    ports:
      - "8081:8080"
    volumes:
      - hapi-data:/data/hapi
    environment:
      hapi.fhir.bulk_export_enabled: "true"
#      SPRING_CONFIG_LOCATION: 'file:///data/hapi/application.yaml'
volumes:
  hapi-data:

hapi.fhir.bulk_export_enabled: "true" value successfully applied.

view this post on Zulip Vasyl Herman (Jan 23 2021 at 14:48):

So, the main question is how to understand documentation and its examplemodule.[MODULE_ID].config.bulk_export.enabled = false

view this post on Zulip Lin Zhang (Jan 23 2021 at 15:30):

In the container I've built, the yml is located at tomcat…webapps…ROOT…WEB-INF…classes

view this post on Zulip Vasyl Herman (Jan 23 2021 at 15:39):

Thanks! Found /usr/local/tomcat/webapps/ROOT/WEB-INF/classes/application.yaml

view this post on Zulip Vasyl Herman (Jan 23 2021 at 16:28):

Do we need to rebuild the image if we decide to use MySQL instead of H2? or just change application.yml ?

view this post on Zulip Lin Zhang (Jan 24 2021 at 02:16):

Need to create the db and its user/owner first?

view this post on Zulip Vasyl Herman (Jan 24 2021 at 06:38):

Mysql container is fine. I have checked it with adminer, the db and its user are created. But hapi container responds with 404 as soon as I switch to use mysql in the application.yaml according to the documentation on github

view this post on Zulip Vasyl Herman (Jan 24 2021 at 06:41):

I am using master branch, strictly following the README.md

view this post on Zulip Lin Zhang (Jan 24 2021 at 06:54):

Does the db and app reside within the same network?

view this post on Zulip Lin Zhang (Jan 24 2021 at 06:58):

Maybe docker-compose.yml need to be configured accordingly.

view this post on Zulip Vasyl Herman (Jan 24 2021 at 07:09):

Yes! They are in the same network. The docker-compose.yml looks correct.

view this post on Zulip Lin Zhang (Jan 24 2021 at 07:12):

jpa:
properties:
hibernate.dialect: org.hibernate.dialect.MySQLDialect

view this post on Zulip Vasyl Herman (Jan 24 2021 at 07:13):

Yeah! Let me try it

view this post on Zulip Lin Zhang (Jan 24 2021 at 07:13):

Did you set the dialect in the app...yml?

view this post on Zulip Vasyl Herman (Jan 24 2021 at 07:14):

I tried it yesterday with MySQL8Dialect

view this post on Zulip Lin Zhang (Jan 24 2021 at 07:17):

No more hints here. I'm not an IT guy, sorry.

view this post on Zulip Kevin Mayfield (Jan 24 2021 at 07:48):

Is mysql in a container or separate. My gut feeling is the dB connection isn't working, either hapi user doesn't exist, wrong password, wrong/missing database or user has wrong permissions.

Hapi will normally generate table structures on start up.

view this post on Zulip Vasyl Herman (Jan 24 2021 at 08:00):

It's working now with the following config:

  1. docker-compose.yml
version: "3.7"
services:
  hapi-fhir-jpaserver-start:
    build: .
    restart: on-failure
    ports:
      - "8080:8080"
    volumes:
      - ./configs/application.yaml:/data/hapi/application.yaml
    environment:
      SPRING_CONFIG_LOCATION: 'file:///data/hapi/application.yaml'

  hapi-fhir-mysql:
    image: mysql:5
    container_name: hapi-fhir-mysql
    restart: always
    environment:
      MYSQL_DATABASE: 'hapi'
      MYSQL_USER: 'admin'
      MYSQL_PASSWORD: 'admin'
      MYSQL_ROOT_PASSWORD: 'admin'
  1. application.yml
spring:
  datasource:
    url: 'jdbc:mysql://hapi-fhir-mysql:3306/hapi'
    username: admin
    password: admin
    driverClassName: com.mysql.jdbc.Driver
  jpa:
    properties:
      hibernate.dialect: org.hibernate.dialect.MySQLDialect

view this post on Zulip Vasyl Herman (Jan 24 2021 at 08:02):

pay attention:
1.mysql:5 not mysql:latest in docker-compose yml

  1. hibernate.dialect needs to be set as org.hibernate.dialect.MySQLDialect

Thanks!

view this post on Zulip Patrick Werner (Jan 24 2021 at 08:05):

I think its caused because the dialect gets never set because of this bug: https://github.com/hapifhir/hapi-fhir-jpaserver-starter/issues/199

view this post on Zulip Patrick Werner (Jan 24 2021 at 08:05):

Dirty workaround: change the default dialect in the java class

view this post on Zulip Jens Villadsen (Jan 24 2021 at 08:20):

Dialect is automatically deduced

view this post on Zulip Jens Villadsen (Jan 24 2021 at 08:21):

See https://github.com/hapifhir/hapi-fhir-jpaserver-starter/blob/master/src/main/java/ca/uhn/fhir/jpa/starter/JpaHibernateDialectProvider.java

view this post on Zulip Patrick Werner (Jan 24 2021 at 08:22):

Oh, right. Had a similar issue but the reason wasn‘t the dialect, but the lucene folder.

view this post on Zulip Vasyl Herman (Jan 24 2021 at 08:23):

@Jens Villadsen yeah, you are right!

view this post on Zulip Lin Zhang (Jan 24 2021 at 09:22):

@Vasyl Herman Congrats!

view this post on Zulip Vasyl Herman (Jan 24 2021 at 09:22):

@Lin Zhang Thank you !!!

view this post on Zulip Vasyl Herman (Jan 24 2021 at 09:23):

I am not sure why, it's working with mysql:5

view this post on Zulip Vasyl Herman (Jan 24 2021 at 09:24):

no other options need to be changed

view this post on Zulip Lin Zhang (Jan 24 2021 at 09:26):

The db init was configed/executed when using PostgreSQL.

view this post on Zulip Vasyl Herman (Jan 24 2021 at 09:27):

so, you think it's better to use PostgreSQL ?

view this post on Zulip Lin Zhang (Jan 24 2021 at 09:29):

I mean it might also related to the issue.

view this post on Zulip Vasyl Herman (Jan 24 2021 at 09:30):

@Lin Zhang
Also, do you think it's worth to change docker-compose.yml? image: mysql:latest --> image: mysql:5 ?

view this post on Zulip Lin Zhang (Jan 24 2021 at 09:32):

I haven't tried MySQL, i.e., no experience with MySQL.

view this post on Zulip Vasyl Herman (Jan 24 2021 at 09:50):

@Lin Zhang
Also, let me ask you another question:
I have seeded two patients but when I refresh the page it doesn't show summary next to Patient resource as shown here on global server
summary.png
Can you please help with that?

view this post on Zulip Lin Zhang (Jan 24 2021 at 09:58):

It's a time lag I think. But it's also bothering to me. Maybe it's related to indexing config such as frequency.

In the meantime, the count would include the (logically) deleted resources.

view this post on Zulip Vasyl Herman (Jan 24 2021 at 10:08):

Great, I have elasticsearch enabled, now summary is shown

view this post on Zulip Vasyl Herman (Jan 24 2021 at 10:10):

no, I might be wrong. I have disabled it now, summary is shown anyway

view this post on Zulip Lin Zhang (Jan 24 2021 at 10:26):

Only I know it laggs.

view this post on Zulip Vasyl Herman (Jan 24 2021 at 11:25):

Lin Zhang said:

Maybe it's related to indexing config such as frequency.

Can you please tell me where this config located? it's been more then an hour since I put a new Patient but the count hasn't been updated yet.

view this post on Zulip Lin Zhang (Jan 24 2021 at 12:18):

Sorry, I don't know the config. But the Web UI might be related to:

https://github.com/hapifhir/hapi-fhir/tree/master/hapi-fhir-testpage-overlay

view this post on Zulip dsh (Apr 16 2021 at 15:37):

Vasil Herman said:

It's working now with the following config:

  1. docker-compose.yml
version: "3.7"
services:
  hapi-fhir-jpaserver-start:
    build: .
    restart: on-failure
    ports:
      - "8080:8080"
    volumes:
      - ./configs/application.yaml:/data/hapi/application.yaml
    environment:
      SPRING_CONFIG_LOCATION: 'file:///data/hapi/application.yaml'

  hapi-fhir-mysql:
    image: mysql:5
    container_name: hapi-fhir-mysql
    restart: always
    environment:
      MYSQL_DATABASE: 'hapi'
      MYSQL_USER: 'admin'
      MYSQL_PASSWORD: 'admin'
      MYSQL_ROOT_PASSWORD: 'admin'
  1. application.yml

spring:
  datasource:
    url: 'jdbc:mysql://hapi-fhir-mysql:3306/hapi'
    username: admin
    password: admin
    driverClassName: com.mysql.jdbc.Driver
  jpa:
    properties:
      hibernate.dialect: org.hibernate.dialect.MySQLDialect

@Vasil Herman @Jens Villadsen I am trying to run HAPI 5.3 in AWS Fargate (its like a Kubernetes blackbox) is it possible to override application.yml settings using environment variables like MYSQL_PASS etc

view this post on Zulip Vasyl Herman (Apr 16 2021 at 18:09):

Hi @dsh !
I think so, It's possible. I didn't try.

view this post on Zulip dsh (Apr 16 2021 at 20:13):

@James Agnew any idea ?

view this post on Zulip Jame Dang (Apr 20 2021 at 08:43):

Hi @dsh : I try to config Starter project with mysql but it always use H2. Do you have the same problem ? My config
datasource:
url: 'jdbc:mysql://localhost:3307/hapi_dstu4'
username: root
password: xxxxx
driverClassName: com.mysql.jdbc.Driver
max-active: 15

I found the problem, thanks


Last updated: Apr 12 2022 at 19:14 UTC