New postgres db, can't reach Forest Admin panel

Expected behavior

I want to test forest admin with a simple postgres DB I created following theses steps https://www.postgresqltutorial.com/install-postgresql-linux/

Actual behavior

I was able to link my data to Forest admin (with docker, on port 5433). When I run http://localhost:3310 it says my app is running but when I want to log to Forest Admin on http://app.forestadmin.com/ I first have to login and it then says Your server encountered an error

Failure Logs

[forest] 🌳🌳🌳  Unexpected error: connect ECONNREFUSED 127.0.0.1:5433
SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:5433
    at connection.connect.err (/usr/src/app/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:170:24)
    at Connection.connectingErrorHandler (/usr/src/app/node_modules/pg/lib/client.js:213:14)
    at Connection.emit (events.js:198:13)
    at Socket.reportStreamError (/usr/src/app/node_modules/pg/lib/connection.js:57:10)
    at Socket.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Context

I’m running on Ubuntu

1 Like

Hi @ElieM, and welcome to our community :wave:,

The errors indicate that the connection between your lumber project and your database errored.

In order to assist you in this process, I have a few questions:

Are you able to connect to this database with another client app with the connection string generated in your .env, like Postico?
Also, are you using docker for both database & your lumber project?
If you can, could you provide the commands you used to run your database & your lumber project?

Thanks in advance

Hi @jeffladiray, thanks for your quick answer :slight_smile:
For now I only tested my database in command line using psql. For docker I followed the command line Forest Admin shows on the tutorial:
docker pull forestadmin/lumber

docker run \                    
  -v `pwd`:/usr/src/app --init \
  --network host \
  -e DATABASE_SCHEMA="public" \
  -e DATABASE_SSL="false" \
  -e DATABASE_URL="postgres://postgres:postgres@localhost:5433/dvdrental" \
  -e APP_NAME="films2" \
  -e FOREST_EMAIL="elie.mietkiewicz@matters.tech" \
  -e FOREST_TOKEN="eyJraWQiOiJ6d0VjbU5LVVpV[...]" \
  -e APPLICATION_HOST="localhost" \
  -e APPLICATION_PORT="3310" \
  -ti forestadmin/lumber

Let me know if you need anything else

1 Like

Thanks, I just wanted to be sure the --network host was here since you are running ubuntu :slight_smile:

I can’t find any issue here, this looks ok to me. I assume psql postgresql://postgres:postgres@localhost:5433/dvdrental works fine from your host then?

dvdrental is a pretty common database, so I’ll do a test real quick on my end to check if everything is ok on my end or if I’m able to reproduce.

In the meantime, I would suggest to check if within the lumber container you are able to run psql postgresql://postgres:postgres@localhost:5433/dvdrental just to make sure there are no issue with the connection between your database and the lumber container. Also, you could give a shot at replacing localhost with 127.0.0.1 or even 0.0.0.0, just to make sure there are no docker issues involved here.

EDIT: I’m not able to reproduce on my end using the dvdrental database on a setup with a local postgresql & dockerized lumber project. Let me know if my previous suggestion helped, otherwise we might have more things to look into :pray:

The command you gave me run fine. I tried again with the npm config instead and everything worked fine so I guess it’s a problem with my docker env rather than my forest admin config. Should be enough for my tests anyway :slight_smile:

2 Likes

Ubuntu does not handle host.docker.internal and the onboarding process contains linux specific step, which might explain why you encountered an issue here. I’ll still further investigate this issue on my end.

I guess running your project with npm rather than docker is not an issue if your database is already running locally :slight_smile:

Don’t hesitate if you are still encountering issue with this process!

1 Like