Docker: Baserow with Appsmith local self hosted

0

I’m trying to use Baserow with Appsmith locally. Here is my docker-compose.yml:

version: "3.4"
services:
  appsmith:
    container_name: appsmith
    image: index.docker.io/appsmith/appsmith-ee
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./stacks:/appsmith-stacks
    restart: unless-stopped
    depends_on:
      - baserow
     
  baserow:
    container_name: baserow
    image: baserow/baserow:1.22.2
    environment:
      BASEROW_PUBLIC_URL: 'http://localhost:4001'
    ports:
      - "4001:80"
      - "4002:443"
    volumes:
      - baserow_data:/baserow/data
volumes:
  baserow_data:

(I tried first with another port then 443 or 80 for Appsmith but it did not work) With this, everything is working properly except I cannot do a simple curl from appsmith to baserow. If I try this: curl -X GET -H "Authorization: Token mytoken" "http://baserow/api/database/fields/table/1172/" It returns an error on AppSmith. If I try this cURL directly in my docker-destkop app I get this:

<!doctype html>
<html lang="en">
<head>
  <title>Bad Request (400)</title>
</head>
<body>
  <h1>Bad Request (400)</h1><p></p>
</body>
</html>

Finally, if I try the same cURL from my terminal (of my computer) it’s working but I use this: curl -X GET -H "Authorization: Token mytoken" "http://localhost:4001/api/database/fields/table/1172/"

Thanks for your help!

Hello @Edwinzap, first of all, welcome to the Baserow community! :wave:

We have @joseph_appsmith from AppSmith here. Joseph, do you have any ideas on how to solve this problem? :pray:

1 Like

Hi @Edwinzap , just replace localhost with host.docker.internal in the url of the curl or API in Appsmith.

Thanks for helping me!
I’m not quit sure to understand what you want me to try. I tried that:
curl -X GET -H "Authorization: Token mytoken" "http://host.docker.internal/api/database/fields/table/1172/"
=> returns “Your API failed to execute” with a 401.

and also:
curl -X GET -H "Authorization: Token mytoken" "http://baserow/api/database/fields/table/1172/"
=> returns “Your API failed to execute” with a 400.

I don’t see how the first option could work, baserow is in another container.

If I do a ping baserow, it’s working (from appsmith container). Same for ping appsmith (from baserow container).

Is it possible that it has something to do with that line in the docker-compose?

      BASEROW_PUBLIC_URL: 'http://localhost:4001'

Ok I found the solution. After checking the logs while sending the request with curl -X GET -H "Authorization: Token mytoken" "http://baserow/api/database/fields/table/1172/" I had an error saying that baserow host is not allowed and that I may need to add it to the ALLOWED_HOSTS.

I found the environment parameter in the documentation: BASEROW_EXTRA_ALLOWED_HOSTS.
So I added it in my docker-compose and now it’s working!

    environment:
      BASEROW_EXTRA_ALLOWED_HOSTS: baserow
1 Like