https://supertokens.com/ logo
c

Cat Swolo

04/01/2022, 8:56 AM
hello, this is maybe a docker problem but I got a problem with my supertokens. It cannot connect to the postgresql container.
Copy code
01 Apr 2022 07:20:52:829 +0000 | DEBUG | pid: ab12b59e-98a4-4068-9cc7-cdbdf3f76117 | [main] thread | io.supertokens.storage.postgresql.HikariLoggingAppender.doAppend(HikariLoggingAppender.java:136) | SuperTokens - Starting...


01 Apr 2022 07:20:52:832 +0000 | DEBUG | pid: ab12b59e-98a4-4068-9cc7-cdbdf3f76117 | [main] thread | io.supertokens.storage.postgresql.HikariLoggingAppender.doAppend(HikariLoggingAppender.java:136) | SuperTokens - Failed to create/setup connection: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.


01 Apr 2022 07:20:52:833 +0000 | DEBUG | pid: ab12b59e-98a4-4068-9cc7-cdbdf3f76117 | [main] thread | io.supertokens.storage.postgresql.HikariLoggingAppender.doAppend(HikariLoggingAppender.java:136) | SuperTokens - Cannot acquire connection from data source


01 Apr 2022 07:20:52:834 +0000 | ERROR | pid: ab12b59e-98a4-4068-9cc7-cdbdf3f76117 | [main] thread | io.supertokens.storage.postgresql.HikariLoggingAppender.doAppend(HikariLoggingAppender.java:132) | SuperTokens - Exception during pool initialization.


Trying again in a few seconds for 59.0 mins...

01 Apr 2022 07:20:52:836 +0000 | INFO | pid: ab12b59e-98a4-4068-9cc7-cdbdf3f76117 | [main] thread | io.supertokens.storage.postgresql.ConnectionPool.initPool(ConnectionPool.java:155) | Trying again in a few seconds for 59.0 mins...
Here is the docker compose:
Copy code
version: '3.1'

services:
  supertoken-users:
    image: registry.supertokens.io/supertokens/supertokens-postgresql
    ports:
      - '3567:3567'
    environment:
      - POSTGRESQL_USER=root
      - POSTGRESQL_PASSWORD=example
      - POSTGRESQL_HOST=host
      - POSTGRESQL_PORT=5432
      - POSTGRESQL_DATABASE_NAME=authdb

  db:
    image: postgres
    restart: always
    ports:
      - '5432:5432'
    environment:
      POSTGRES_USER: root
      POSTGRES_PASSWORD: example
      POSTGRES_DB: authdb

  adminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080
r

rp

04/01/2022, 8:58 AM
POSTGRESQL_HOST
should be
db
? Cause the name of the db in the compose file is
db
c

Cat Swolo

04/01/2022, 9:06 AM
wait so host is not a
url
but a
docker container
itself?
so the supertoken container is trying to connect to a postgres container named db
r

rp

04/01/2022, 9:07 AM
Well. it's the the address on which the db is reachable
c

Cat Swolo

04/01/2022, 9:07 AM
ok I thought it was the address
r

rp

04/01/2022, 9:07 AM
It is the address of the postgresql container
c

Cat Swolo

04/01/2022, 9:08 AM
makes sense
r

rp

04/01/2022, 9:08 AM
but in docker network, that is = to the name of the service
which i think in this case is
db
c

Cat Swolo

04/01/2022, 9:09 AM
ok, I thought you have to input the url of the database
but this makes developing a lot easier
r

rp

04/01/2022, 9:10 AM
im not sure what you mean by url of database and how that's different from the address on which the db is hosted at
c

Cat Swolo

04/01/2022, 9:53 AM
ah
by that I meant localhost
r

rp

04/01/2022, 10:37 AM
hmm