I want to deploy ThingsBoard as a Docker container. I use this image and I try to overwrite some environment variables to get connection with an external Postgres database.
I simply have a Postgres running on localhost:5432
with (empty) database thingsboard
, I create the Docker volumes mytb-data
and mytb-logs
and I launch:
docker run -it -p 9090:9090 -p 1883:1883 -p 5683:5683/udp -v mytb-data:/data -v mytb-logs:/var/log/thingsboard -e SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/thingsboard -e SPRING_DATASOURCE_USERNAME=postgres -e SPRING_DATASOURCE_PASSWORD=<MY_PASSWORD_HERE> --name mytb --restart=always thingsboard/tb-postgres
The container starts, but the logs report the following error:
2020-11-03 07:55:40,480 [main] ERROR o.h.e.jdbc.spi.SqlExceptionHelper - ERROR: relation "admin_settings" does not exist
Position: 152
... [OMITTED]
Caused by: org.postgresql.util.PSQLException: ERROR: relation "admin_settings" does not exist
Position: 152
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2455)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2155)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:288)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:430)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:356)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:168)
at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:116)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:57)
... 166 common frames omitted
pg_ctl: could not send stop signal (PID: 9): No such process
Any idea why this happens?
/usr/share/thingsboard/bin/install/install.sh
to do this. I'm not sure if this is done automatigically by the docker scripts.