gravitl / netmaker

Netmaker makes networks with WireGuard. Netmaker automates fast, secure, and distributed virtual networks.
https://netmaker.io
Other
9.4k stars 547 forks source link

Docker-Compose File assumes local deployment #7

Closed mattkasun closed 3 years ago

mattkasun commented 3 years ago

The docker-compose.yml has BACKEND_URL set to http://localhost:8081 for netmaker-ui

This works for local deployment. For a remote deployment this has to be updated to the public ip (or FQDN) of the remote machine.

The BACKEND_URL should be set to the name of the netmaker container(or docker network ip), but this results in CORS violations and error message in netmaker-ui Incorrect backend detected. Please specify correct URL and refresh. Given: http://netmaker:8081

afeiszli commented 3 years ago

I'm not sure if this is a bug. We're just setting to localhost as the default and it's up to the user to make sure they're running for their environment. Would an update to the docs be sufficient here (more explicitly outlining that BACKEND_URL must be set for deployment)?

We could also just remove the default localhost and let it break if you try to run it without setting URL

mattkasun commented 3 years ago

We should be able to take advantage of docker DNS and use the container name, but that causes CORS issues

afeiszli commented 3 years ago

I don't believe that would work. The requests are being sent from wherever you are accessing the interface (your browser) to the BACKEND_URL.

If I'm accessing the netmaker-ui from my laptop at 22.22.22.2, and the backend server is at 33.33.33.33, I won't be able to reach the backend over the docker network, even though the frontend is hosted from 33.33.33.33, because the request is coming from 22.22.22.22. I think it either needs to be the public IP, or ideally a wireguard address that gets generated at startup (something I'd like to put in the next couple of releases).

Please let me know if you think I'm wrong here.

mattkasun commented 3 years ago

Yes, I misunderstood how the frontend works.

yogeshbhoopathy commented 3 years ago

Any work around for this?