OHDSI Home | Forums | Wiki | Github

Trouble installing OHDSI WebAPI/Atlas using BroadSea

Hi,

I am following the instruction here to install OHDSI stack in docker container, and Atlas is not starting because of Unable to obtain Jdbc connection from DataSource:

and here is part of my log file:

	Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flyway' defined in class path resource 
[org/ohdsi/webapi/FlywayConfig.class]: Invocation of init method failed; nested exception is org.flywaydb.core.internal.dbsupport.FlywaySqlExcepti
on: 
Unable to obtain Jdbc connection from DataSource
------------------------------------------------
SQL State  : 28000
Error Code : 0
Message    : FATAL: no pg_hba.conf entry for host "192.168.1.153", user "ohdsi_admin_user", database "OHDSI", SSL off

		at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.
java:1630)
		at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.ja
va:553)
		at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java
:481)
		at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
		at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
		at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
		at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
		at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:297)
		at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
		at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
		at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1139)
		at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1067)
		at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
		at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
		... 60 more

and here is my docker-compose.yml file:

version: '2'

services:

  broadsea-methods-library:
    image: ohdsi/broadsea-methodslibrary
    ports:
      - "8787:8787"
      - "6311:6311"
    environment:
      - PASSWORD=mypass

  broadsea-webtools:
    image: ohdsi/broadsea-webtools
    ports:
      - "8089:8089"
    volumes:
     - .:/tmp/drivers/:ro
     - ./config-local.js:/usr/local/tomcat/webapps/atlas/js/config-local.js:ro
    environment:
      - WEBAPI_URL=http://192.168.1.153:9001
      - env=webapi-postgresql
      - security_origin=*
      - datasource_driverClassName=org.postgresql.Driver
      - datasource_url=jdbc:postgresql://192.168.1.153:5432/OHDSI
      - datasource.cdm.schema=omop_cdm
      - datasource.ohdsi.schema=webapi
      - datasource_username=ohdsi_app_user
      - datasource_password=****
      - spring.jpa.properties.hibernate.default_schema=ohdsi
      - spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
      - spring.batch.repository.tableprefix=ohdsi.BATCH_
      - flyway_datasource_driverClassName=org.postgresql.Driver
      - flyway_datasource_url=jdbc:postgresql://192.168.1.153:5432/OHDSI
      - flyway_schemas=ohdsi
      - flyway.placeholders.ohdsiSchema=ohdsi
      - flyway_datasource_username=ohdsi_admin_user
      - flyway_datasource_password=****
      - flyway.locations=classpath:db/migration/postgresql

the database is running on localhost, but jdbc:postgresql://localhost:5432/OHDSI would not work either, so I replaced localhost with 192.168.1.153, the IP address of the machine where the database is running. And then I got the above error message, mainly the following:

Unable to obtain Jdbc connection from DataSource
------------------------------------------------
SQL State  : 28000
Error Code : 0
Message    : FATAL: no pg_hba.conf entry for host "192.168.1.153", user "ohdsi_admin_user", database "OHDSI", SSL off

could someone please kindly let me know what should I change to fix this?

Thanks!

Let me answer my own question, so this might be helpful to those who see the same issue.

here is what we should be using instead of localhost:

- datasource_url=jdbc:postgresql://${DOCKER_GATEWAY_HOST:-host.docker.internal}:5432/OHDSI

the ${DOCKER_GATEWAY_HOST:-host.docker.internal} part replaces localhost and solves the problem.

And I am seeing other problems now, which I will ask in another thread. Thanks for your attention.

t