azimuttapp / azimutt

Explore and optimize any database
https://azimutt.app
MIT License
1.21k stars 86 forks source link

Backend port mismatch #281

Open frafra opened 6 months ago

frafra commented 6 months ago

Hi :) I am running Azimutt locally using Docker Compose with the prebuilt image. Port 4000 is exposed, but when I try to add a schema from a database conection I get this error:

Loaded postgres database.
http://localhost:4177: NetworkError when attempting to fetch resource.
: Not Found
Done!
rllola commented 5 months ago

I run into the same problem @frafra. You actually need to install CLI to extract the database schema.

Here the steps:

$ npm install -g azimutt
$ azimutt gateway

A note was showing but I missed it too...

jmrenouard commented 5 months ago

With docker install I get same error message

rllola commented 5 months ago

I have published a gist with a working example including azimutt gateway to export postgres schema in docker compose.

https://gist.github.com/rllola/973d6911bf6cdeefa9f16a4ec7fd400d

It can be improved but it is working. I hope it will help @jmrenouard

loicknuchel commented 3 weeks ago

Hi, this is expected ;)

Azimutt backend is listening to port 4000 but for privacy and networking reasons, it never access any customer database. That's the gateway job, a small node app which can be seen as a proxy between your frontend and your database. It's expected to be run locally by each user with npx azimutt@latest gateway and listen on port 4177. That's why Azimutt it trying to reach out localhost:4177, even on azimutt.app, if it fails it will try with the one I deployed (gateway.azimutt.app). In enterprise plan, you can even define your own url if you want to host the gateway in your infra and maybe customize it with additional user/db rights ;)

@rllola do you think the gateway should be started by default in the Docker compose? Would make sense for easier trial (less to know at the beginning).

rllola commented 3 weeks ago

That would be a nice touch. If people don't want to use it they can then comment it but it would show how to use it with the gateway or stop it via docker compose stop. Personally, it was the feature that I wanted to try when I have found azimutt.

I can propose a PR to update the docker compose to include the gateway.

loicknuchel commented 3 weeks ago

Cool, your PR is welcome :+1:

rllola commented 3 weeks ago

I am testing the docker compose using the current build. I have specify the gateway url like this : GATEWAY_URL: http://gateway:4177. gateway is the name of the service in the docker-compose.yml

Unfortunately it is not working. It is still trying to reach http://localhost:4177 (which is not available) and I also have a CORS error in the console.

Could it be that a modification lead to override the GATEWAY_URL environment variable ?

rllola commented 3 weeks ago

I think it might come from here : https://github.com/azimuttapp/azimutt/blob/main/frontend/ts-src/services/backend.ts#L190

It seems to try first to reach http://localhost:4177 first with a ping and it if fails it will try the reach the gateway_remote url. In my browser the local ping return 200 for some unknown reason.