OdyseeTeam / odysee-api

API server for Odysee
https://odysee.com
MIT License
228 stars 49 forks source link

Fail to connect to postgres DB - panic: dial tcp 127.0.0.1:5432: connect: connection refused #376

Closed wizlee closed 3 years ago

wizlee commented 3 years ago

Description

Below are the steps that leads to the issue and what I had tried to solve it.

I am not familiar with both postgres and Go so I am facing difficulty in moving forward. Any pointers for me to debug further or does this looks like an actual issue?

System Info

Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

Full Log

> docker-compose run app ./lbrytv db_migrate_up
Creating network "odysee-api_default" with the default driver
Creating volume "odysee-api_pgdata" with default driver
Creating volume "odysee-api_storage" with default driver
Creating volume "odysee-api_test_storage" with default driver
Pulling lbrynet (lbry/lbrynet-tv:latest)...
latest: Pulling from lbry/lbrynet-tv
feac53061382: Pull complete
ae7f8cefb448: Pull complete
5c34bae4c714: Pull complete
e8ca6d2af8d5: Pull complete
4cfca76d0cf2: Pull complete
e233bebc1938: Pull complete
71257435ce9c: Pull complete
ba7c44e1033f: Pull complete
2adc1e6875e7: Pull complete
4d2945c1a8e2: Pull complete
Digest: sha256:f9cc383e061dc57b647d6ed2e9aaaf342aa695500d065a797ab71163aadf5ce4
Status: Downloaded newer image for lbry/lbrynet-tv:latest
Pulling postgres (postgres:11-alpine)...
11-alpine: Pulling from library/postgres
a0d0a0d46f8b: Pull complete
5034a66b99e6: Pull complete
82e9eb77798b: Pull complete
351ed8634988: Pull complete
18d059d16088: Pull complete
4e934fbe90b5: Pull complete
faca3cd3c3fd: Pull complete
e884a1e228ac: Pull complete
Digest: sha256:f811f9f9dd96568118fc9f274a6d353b2ab30851d961e8bf8fd69c781c545fd3
Status: Downloaded newer image for postgres:11-alpine
Pulling app (lbry/odysee-api:latest)...
latest: Pulling from lbry/odysee-api
a0d0a0d46f8b: Already exists
d82f3b27c123: Pull complete
eccbb0e80c4a: Pull complete
665f42856fbb: Pull complete
155815a58e98: Pull complete
Digest: sha256:7352893ff47fb073d1bc5d1ab55f50e3ee6dc2c2267877af6434dfe79df85f2b
Status: Downloaded newer image for lbry/odysee-api:latest
Creating odysee-api_lbrynet_1  ... done
Creating odysee-api_postgres_1 ... done
Creating odysee-api_app_run    ... done
{"buildCommit":"f29e392","buildDate":"unknown","buildVersion":"api-v21.9.0-next","level":"info","logLevel":"info","mode":"production","msg":"standard logger configured"}
{"host":"c65455a6a09c","level":"info","module":"monitor","msg":"sentry disabled (no DSN configured)"}
{"dsn":"postgres://lbrytv:lbrytv@localhost/lbrytv?sslmode=disable","host":"c65455a6a09c","level":"info","module":"storage","msg":"connecting to the DB"}
{"dsn":"postgres://lbrytv:lbrytv@localhost/lbrytv?sslmode=disable","host":"c65455a6a09c","level":"info","module":"storage","msg":"DB connection failed"}
panic: dial tcp 127.0.0.1:5432: connect: connection refused

goroutine 1 [running]:
main.main()
        /home/runner/work/odysee-api/odysee-api/main.go:40 +0x650
ERROR: 2
anbsky commented 3 years ago

We generally don't run off the docker image locally so the process is a bit out of sync, thanks for bringing this to my attention. Should be fixed now, just git pull and docker-compose up app is enough.