Baserow + Docker : Could not connect to the API server

Hi everyone,
I’m trying to use the docker container with a separate SQL server with the following command:

sudo docker run \
-d \
--name baserow \
-e BASEROW_PUBLIC_URL=http://10.0.0.123 \
-e DATABASE_URL=postgresql://baserow:blablabla@10.0.0.17:5432/baserow \
-v baserow_data:/baserow/data \
-p 8080:80 \
-p 9999:443 \
-p 3001:3000 \
--restart unless-stopped \
baserow/baserow:1.11.0

I did specify the IP adress for the public URL since I’m using a headless server.

At first, everything seems to be OK.
The connection with the postgres server works. All the baserow table are created and have the correct owner.
Dockers logs shows:

 [BACKEND][2022-08-10 10:02:22] Checking the provided DATABASE_URL
 [BACKEND][2022-08-10 10:02:22] PostgreSQL is available
...
 [BASEROW-WATCHER][2022-08-10 10:02:53] Baserow is now available at http://10.0.0.123

From the browser, the Sign Up page appears but as soon as I click on the Sign Up Button, I get the following error message:
Network Error
Could not connect to the API server
2022-08-10 12_15_40-Create new account __ Baserow

Docker logs shows:

 [WEBFRONTEND][2022-08-10 10:02:43] ℹ Listening on: http://localhost:3000/
 [WEBFRONTEND][2022-08-10 10:02:43]
 [WEBFRONTEND][2022-08-10 10:02:43]  ERROR  connect ECONNREFUSED 127.0.0.1:8000
 [WEBFRONTEND][2022-08-10 10:02:43]
 [WEBFRONTEND][2022-08-10 10:02:43]   at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)

Any idea ?

Hey,

This is a wild guess since I am not super familiar with docker but the log is saying that the web frontend container is trying to connect to 127.0.0.1:8000 which is a localhost address. I am assuming that in your installation the api is running on a different container so when you want to connect to something on another container you can’t use localhost but instead you need to use the name of the container.

Is this potentially the issue here?

Alex,
Not sure I understand what you mean by “api running on a different container”. There’s just the server on pc A and the browser on pc B. Nothing else, therefore I cannot command the browser to query a specific address beside the server address.
This is definitely a connectivity issue, perhaps with port redirection…
I’m going to do some more test to figure this out.

Hey :slight_smile:

What I meant was that you have 2 servers here that are important.

  1. Your Nuxt server which runs the frontend (port 3000)
  2. Your Django server which runs the API

Your Nuxt server seems to work fine, since you can see the frontend, so there is connectivity to the Nuxt server. But when you send a request to request data, that’s where the error happens.

The path that request takes is, first to your nuxt server and then your nuxt server re-routes that request to your API Django server. (we do this for CORS reasons for example).

The error that you see there ERROR connect ECONNREFUSED 127.0.0.1:8000 is your nuxt server trying to connect to your django server to forward the request.

It’s trying to connect to your django server via 127.0.0.1:8000 and it can’t because 127.0.0.1:8000 is a local address of your nuxt container. Django is sitting in another container so you can’t use local addresses to connect to that other container where your django api runs.

But maybe @nigel can help out here, he knows way more than me when it comes to docker :slight_smile:

@Alex, no need to go deeper, it works !
The missing part was the port number in the public URL statement:
-e BASEROW_PUBLIC_URL=http://10.0.0.123 :8080 \

Here’s the full command:

sudo docker run \
-d \
--name baserow \
-e BASEROW_PUBLIC_URL=http://10.0.0.123:8080 \
-e DATABASE_HOST=10.0.0.17 \
-e DATABASE_NAME=baserow \
-e DATABASE_USER=baserow \
-e DATABASE_PASSWORD=blablabla \
-e DATABASE_PORT=5432 \
-v baserow_data:/baserow/data \
-p 8080:80 \
-p 9999:443 \
--restart unless-stopped \
baserow/baserow:1.11.0

Awesome, glad it works!