thingsboard / thingsboard

Open-source IoT Platform - Device management, data collection, processing and visualization.
https://thingsboard.io
Apache License 2.0
17.4k stars 5.14k forks source link

Docker/postgres: Connection to localhost:5432 refused [Bug] #3757

Closed 4mtc-4 closed 3 years ago

4mtc-4 commented 3 years ago

My enviromnent Debian 9.13 / Docker 19.03.13 / Docker-compose 1.8.0

Description I am attempting to install ThingsBoard CE with Docker. I am using the latest tb-cassandra image (although the exact same happens for tb-postgres) with Kafka, which is ThingsBoard v3.1.1. I am following the docs, using the Docker compose file there. But after I docker-compose up, I get a fatal org.postgresql.util.PSQLException: Connection to localhost:5432 refused followed by the Java stacktrace. For tb-postgres, there is an additional pg_ctl: directory "/data/db" is not a database cluster directory afterwards. The full logs are here: failed-install.log.

Additional info The funny thing is, it used to work exactly like this, but then I removed everything TB-related and attempted to reinstall. Interestingly, when I run a shell in the thingsboard_mytb_1 container and cat /var/log/postgres/postgres.log I (only) see a few lines of postgres: could not access the server configuration file "/data/db/postgresql.conf": No such file or directory. I can see that /data/db is just empty. Did I miss to delete something after first installing? I sure removed ~/.mytb-data and ~/.mytb-logs and I aggressively Docker-pruned everything.

yhavrysh commented 3 years ago

Hi @4mtc-4 , You have probably missed this two commands from the instruction:

mkdir -p ~/.mytb-data && sudo chown -R 799:799 ~/.mytb-data mkdir -p ~/.mytb-logs && sudo chown -R 799:799 ~/.mytb-logs

I have checked on my env and everything is working as expected. Please check this moment from your side.

4mtc-4 commented 3 years ago

Hello, thanks for getting back. No, I did not miss them. However, I had docker-compose run as root even though it shouldn't, this turned out to be the root of the problem. So this issue is invalid, thanks anyways.