Start with a fresh folder and copy a hapi.properties into it. It will be mounted into the container.
Carefully make sure your hapi.properties looks like this:
# add postgres
datasource.driver=org.postgresql.Driver
datasource.url=jdbc:postgresql://db:5432/hapi
hibernate.dialect=org.hibernate.dialect.PostgreSQL95Dialect
datasource.username=admin
datasource.password=admin
# comment out derby
# datasource.driver=org.h2.Driver
# datasource.url=jdbc:h2:file:./target/database/h2
# datasource.username=
# datasource.password=
...
###################################################
# Database Settings
###################################################
# comment this out
# hibernate.dialect=org.hibernate.dialect.H2Dialect
Add the docker-compose below, and docker-compose up. Visit: http://localhost:8080/hapi-fhir-jpaserver/
To troubleshoot:
- Database stuff: Connect to the database at localhost:5432 using your tool of choice with user
admin, passadmin, and to dbhapi. Obviously, don't use the same settings in production. - HAPI: Run
docker psto get your container id. Then run commands you need to in the running container like:docker exec <containerid> /bin/bash -c 'cat /usr/local/tomcat/conf/hapi.properties
For those coming to this gist, it has been superseded in HAPI v5.1 by the application.yml file, and no longer uses hapi.properties
This works for v5.1. There is no need to edit any file or mount it. The environment vars work fine.