when using the given default docker-compose.yml and set SERVICES_PSQL_ENABLED false, the start of the container fails, because of an setting in the application.yml.
start up log.
....
gateway-1 | 2023-12-01 12:08:08.939 INFO --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
gateway-1 | 2023-12-01 12:08:09.116 INFO --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection conn0: url=jdbc:h2:mem:05d8e72e-3558-4220-9d9a-75b79f6835f0 user=SA
gateway-1 | 2023-12-01 12:08:09.118 INFO --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
gateway-1 | 2023-12-01 12:08:09.138 WARN --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fhirController' defined in file [/opt/fhir-gateway/BOOT-INF/classes/org/miracum/etl/fhirgateway/controllers/FhirController.class]: Unsatisfied dependency expressed through constructor parameter 1: Error creating bean with name 'resourcePipeline' defined in file [/opt/fhir-gateway/BOOT-INF/classes/org/miracum/etl/fhirgateway/processors/ResourcePipeline.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'postgresFhirResourceRepository' defined in file [/opt/fhir-gateway/BOOT-INF/classes/org/miracum/etl/fhirgateway/stores/PostgresFhirResourceRepository.class]: Unsatisfied dependency expressed through constructor parameter 1: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Failed to execute SQL script statement #1 of class path resource [schema.sql]: CREATE TABLE IF NOT EXISTS resources ( id bigserial PRIMARY KEY, fhir_id varchar(64) NOT NULL, type varchar(64) NOT NULL, data jsonb NOT NULL, created_at timestamp NOT NULL DEFAULT NOW(), last_updated_at timestamp NOT NULL DEFAULT NOW(), is_deleted boolean NOT NULL DEFAULT FALSE, CONSTRAINT fhir_id_unique UNIQUE (fhir_id, type) )
gateway-1 | 2023-12-01 12:08:09.138 INFO --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
gateway-1 | 2023-12-01 12:08:09.145 INFO --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
gateway-1 | 2023-12-01 12:08:09.148 INFO --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
gateway-1 | 2023-12-01 12:08:09.166 INFO --- [ main] .s.b.a.l.ConditionEvaluationReportLogger :
gateway-1 |
gateway-1 | Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
gateway-1 | 2023-12-01 12:08:09.181 ERROR --- [ main] o.s.boot.SpringApplication : Application run failed
gateway-1 |
gateway-1 | org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fhirController' defined in file [/opt/fhir-gateway/BOOT-INF/classes/org/miracum/etl/fhirgateway/controllers/FhirController.class]: Unsatisfied dependency expressed through constructor parameter 1: Error creating bean with name 'resourcePipeline' defined in file [/opt/fhir-gateway/BOOT-INF/classes/org/miracum/etl/fhirgateway/processors/ResourcePipeline.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'postgresFhirResourceRepository' defined in file [/opt/fhir-gateway/BOOT-INF/classes/org/miracum/etl/fhirgateway/stores/PostgresFhirResourceRepository.class]: Unsatisfied dependency expressed through constructor parameter 1: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Failed to execute SQL script statement #1 of class path resource [schema.sql]: CREATE TABLE IF NOT EXISTS resources ( id bigserial PRIMARY KEY, fhir_id varchar(64) NOT NULL, type varchar(64) NOT NULL, data jsonb NOT NULL, created_at timestamp NOT NULL DEFAULT NOW(), last_updated_at timestamp NOT NULL DEFAULT NOW(), is_deleted boolean NOT NULL DEFAULT FALSE, CONSTRAINT fhir_id_unique UNIQUE (fhir_id, type) )
gateway-1 | at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:801) ~[spring-beans-6.0.13.jar:6.0.13]
Set SPRING_SQL_INIT_MODE to never, so the SQL script is disabled, when wanting to deactivate the DB output.
Maybe you have a better solution to it, but the setting used to be on never in previous versions.
I would add to the SPRING_SERVICE_PSQL_ENABLED config in the docu, that the second attribute has to be set addtionally if the DB is to be deactivated.
Hi,
Error description
when using the given default docker-compose.yml and set
SERVICES_PSQL_ENABLED
false, the start of the container fails, because of an setting in the application.yml.start up log.
Cause:
https://github.com/miracum/fhir-gateway/blob/002dcfa629245b2eb4c5049e8ac863f1b0d95a8d/src/main/resources/application.yml#L79 The
SPRING_SQL_INIT_MODE
variable or rather spring app setting is set toalways
which causes the startup of the gateway trying to execute a SQL schema init script, on a none existing DB as far as I understand.Solution
Set
SPRING_SQL_INIT_MODE
tonever
, so the SQL script is disabled, when wanting to deactivate the DB output. Maybe you have a better solution to it, but the setting used to be onnever
in previous versions.I would add to the
SPRING_SERVICE_PSQL_ENABLED
config in the docu, that the second attribute has to be set addtionally if the DB is to be deactivated.