Issue with open-balena-admin

Hi everybody,

I have this problem and i don’t know how to fix it.

postgrest_1  | [HPM] Proxy created: /  -> http://127.0.0.1:3000
postgrest_1  | 03/Feb/2025:14:04:50 +0000: Failed listening for notifications on the "pgrst" channel. Just "connection to server at \"db.mydomain.local\" (172.18.0.9), port 5432 failed: Connection refused\n\tIs the server running on that host and accepting TCP/IP connections?\n"
postgrest_1  | 03/Feb/2025:14:04:50 +0000: Failed listening for notifications on the "pgrst" channel. ExitFailure 1
postgrest_1  | 03/Feb/2025:14:04:50 +0000: Retrying listening for notifications in 2 seconds...
postgrest_1  | 03/Feb/2025:14:04:50 +0000: Attempting to reconnect to the database in 1 seconds...
postgrest_1  | 03/Feb/2025:14:04:50 +0000: Failed to query the PostgreSQL version. {"code":"PGRST000","details":"connection to server at \"db.mydomain.local\" (172.18.0.9), port 5432 failed: Connection refused\n\tIs the server running on that host and accepting TCP/IP connections?\n","hint":null,"message":"Database connection error. Retrying the connection."}
postgrest_1  | 03/Feb/2025:14:04:50 +0000: Failed to query database settings for the config parameters.{"code":"PGRST000","details":"connection to server at \"db.mydomain.local\" (172.18.0.9), port 5432 failed: Connection refused\n\tIs the server running on that host and accepting TCP/IP connections?\n","hint":null,"message":"Database connection error. Retrying the connection."}
postgrest_1  | 03/Feb/2025:14:04:50 +0000: Failed to query the role settings. {"code":"PGRST000","details":"connection to server at \"db.mydomain.local\" (172.18.0.9), port 5432 failed: Connection refused\n\tIs the server running on that host and accepting TCP/IP connections?\n","hint":null,"message":"Database connection error. Retrying the connection."}
postgrest_1  | 03/Feb/2025:14:04:50 +0000: Config reloaded
postgrest_1  | 03/Feb/2025:14:04:50 +0000: Failed to load the schema cache. {"code":"PGRST000","details":"connection to server at \"db.mydomain.local\" (172.18.0.9), port 5432 failed: Connection refused\n\tIs the server running on that host and accepting TCP/IP connections?\n","hint":null,"message":"Database connection error. Retrying the connection."}

I think the issue is related to the resolution of db.mydomain.local mapping to 172.18.0.9, but I couldn’t find this IP address anywhere, nor any configuration related to db.mydomain.local.

Below is my current Docker container network setup:

------------------------------------------------------
NETWORK             | SUBNET IPv4     | GATEWAY IPv4 
----                | ----            | ----         
bridge              | "172.17.0.0/16" | "172.17.0.1" 
host                | null            | null         
none                | null            | null         
open-balena_default | "172.18.0.0/16" | "172.18.0.1" 
------------------------------------------------------
CONTAINER                     | IP          | Gateway    | PORTS       | Network            
----                          | ----        | ----       | ----        | ----               
openbalena-admin_ui_1         |             |            |             | open-balena_default
openbalena-admin_postgrest_1  |             |            |             | open-balena_default
openbalena-admin_remote_1     |             |            |             | open-balena_default
open-balena-sut-1             |             |            |             | open-balena_default
open-balena-tag-sidecar-1     |             |            |             | open-balena_default
open-balena-dut-1             |             |            |             | open-balena_default
open-balena-haproxy-1         | 172.18.0.9  | 172.18.0.1 | 80 443 1936 | open-balena_default
open-balena-cert-manager-1    | 172.18.0.7  | 172.18.0.1 |             | open-balena_default
open-balena-haproxy-sidecar-1 | 172.18.0.12 | 172.18.0.1 |             | open-balena_default
open-balena-vpn-1             | 172.18.0.8  | 172.18.0.1 |             | open-balena_default
open-balena-registry-1        | 172.18.0.3  | 172.18.0.1 |             | open-balena_default
open-balena-api-1             | 172.18.0.6  | 172.18.0.1 |             | open-balena_default
open-balena-balena-ca-1       | 172.18.0.4  | 172.18.0.1 |             | open-balena_default
open-balena-db-1              | 172.18.0.11 | 172.18.0.1 |             | open-balena_default
open-balena-docker-1          | 172.18.0.5  | 172.18.0.1 |             | open-balena_default
open-balena-s3-1              | 172.18.0.10 | 172.18.0.1 |             | open-balena_default
open-balena-redis-1           | 172.18.0.2  | 172.18.0.1 |             | open-balena_default
------------------------------------------------------

I installed OpenBalena a few weeks ago, and while reading the manual page of open-balena-admin GitHub - dcaputo-harmoni/open-balena-admin: Open Balena Admin I noticed that I couldn’t execute some indicated steps, for example:
source open-balena/config/activate ; source open-balena/compose/versions because those files do not exist.

I also noticed that the Docker network was named open-balena_default instead of openbalena_default, which was referenced in open-balena-admin/compose/services.yml, so I changed it.

Now, I must have done something wrong, but I can’t figure out the correct way to fix this issue.

Any help would be greatly appreciated!
Thank you in advance,
Andrea

A little later, I found this issue An error ocurred when trying to query database settings for the config parameters · Issue #41 · dcaputo-harmoni/open-balena-admin · GitHub that I hadn’t seen before.

In the meantime, I made some other changes:

  • I modified the file open-balena-admin/config/activate by adding:
export OPENBALENA_DB_HOST=172.18.0.11

(the IP address of my Docker container).

  • Consequently, I updated the file open-balena-admin/compose/services.yml:
PGRST_DB_URI: postgres://${OPENBALENA_DB_USERNAME}:${OPENBALENA_DB_PASSWORD}@${OPENBALENA_DB_HOST}:${OPENBALENA_DB_PORT}/resin

I replaced db.${OPENBALENA_HOST_NAME} with ${OPENBALENA_DB_HOST}.

Now I think the PostgREST issue is resolved (see below)

Attaching to openbalena-admin_postgrest_1, openbalena-admin_remote_1, openbalena-admin_ui_1
postgrest_1  | 04/Feb/2025:08:18:37 +0000: Starting PostgREST 12.2.3...
postgrest_1  | 04/Feb/2025:08:18:37 +0000: Listening on port 3000
postgrest_1  | 04/Feb/2025:08:18:37 +0000: Listening for notifications on the "pgrst" channel
postgrest_1  | 04/Feb/2025:08:18:37 +0000: Successfully connected to PostgreSQL 16.1 (Debian 16.1-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
postgrest_1  | 04/Feb/2025:08:18:37 +0000: Config reloaded
postgrest_1  | 04/Feb/2025:08:18:37 +0000: Schema cache queried in 6.0 milliseconds
postgrest_1  | 04/Feb/2025:08:18:37 +0000: Schema cache loaded 48 Relations, 41 Relationships, 2 Functions, 0 Domain Representations, 4 Media Type Handlers, 1196 Timezones

.... some other logs ....

postgrest_1  | [HPM] Proxy created: /  -> http://127.0.0.1:3000
ui_1         |
ui_1         | > open-balena-ui@0.1.0 start
ui_1         | > node server
ui_1         |
ui_1         | isDevelopment: false
ui_1         | Running open-balena-ui on http://0.0.0.0:8080
ui_1         | Browserslist: caniuse-lite is outdated. Please run:
ui_1         |   npx update-browserslist-db@latest
ui_1         |   Why you should do it regularly: https://github.com/browserslist/update-db#readme
ui_1         | ERROR in EnvironmentPlugin - REACT_APP_BANNER_IMAGE environment variable is undefined.
ui_1         |
ui_1         | You can pass an object with default values to suppress this warning.
ui_1         | See https://webpack.js.org/plugins/environment-plugin for example.
ui_1         |
ui_1         | webpack compiled with 1 error

but the connection to UI doesn’t work.
Recap of containers:

CONTAINER                     | IP          | Gateway    | PORTS                                                       | Network            
----                          | ----        | ----       | ----                                                        | ----               
openbalena-admin_ui_1         | 172.18.0.15 | 172.18.0.1 | 8080                                                        | open-balena_default
openbalena-admin_remote_1     | 172.18.0.13 | 172.18.0.1 | 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 | open-balena_default
openbalena-admin_postgrest_1  | 172.18.0.14 | 172.18.0.1 | 8000                                                        | open-balena_default
open-balena-sut-1             |             |            |                                                             | open-balena_default
open-balena-tag-sidecar-1     |             |            |                                                             | open-balena_default
open-balena-dut-1             |             |            |                                                             | open-balena_default
open-balena-haproxy-1         | 172.18.0.9  | 172.18.0.1 | 80 443 1936                                                 | open-balena_default
open-balena-cert-manager-1    | 172.18.0.7  | 172.18.0.1 |                                                             | open-balena_default
open-balena-haproxy-sidecar-1 | 172.18.0.12 | 172.18.0.1 |                                                             | open-balena_default
open-balena-vpn-1             | 172.18.0.8  | 172.18.0.1 |                                                             | open-balena_default
open-balena-registry-1        | 172.18.0.3  | 172.18.0.1 |                                                             | open-balena_default
open-balena-api-1             | 172.18.0.6  | 172.18.0.1 |                                                             | open-balena_default
open-balena-balena-ca-1       | 172.18.0.4  | 172.18.0.1 |                                                             | open-balena_default
open-balena-db-1              | 172.18.0.11 | 172.18.0.1 |                                                             | open-balena_default
open-balena-docker-1          | 172.18.0.5  | 172.18.0.1 |                                                             | open-balena_default
open-balena-s3-1              | 172.18.0.10 | 172.18.0.1 |                                                             | open-balena_default
open-balena-redis-1           | 172.18.0.2  | 172.18.0.1 |                                                             | open-balena_default

I try http://mydomain.local:8080 because is the only port exposed by UI.

From localhost

$ curl http://localhost:8080
Not Found

From windows host on network

> curl.exe http://mydomain.local:8080
Not Found

Probably due to the errors when starting the UI container.

But the official open-balena-admin documentation (paragraph: “Web Access”) never mentions port 8080, so I have doubts that access should be done this way and that there isn’t some other error.

I would say that the “Not found” problem is also known since I found this issue Does this support OpenBalena v4.1.x? · Issue #42 · dcaputo-harmoni/open-balena-admin · GitHub