nilsherzig / LLocalSearch

LLocalSearch is a completely locally running search aggregator using LLM Agents. The user can ask a question and the system will use a chain of LLMs to find the answer. The user can see the progress of the agents and the final answer. No OpenAI or Google API keys are needed.
Apache License 2.0
5.6k stars 354 forks source link

bug: container hostnames seem to be hardcoded #21

Open sammcj opened 6 months ago

sammcj commented 6 months ago

I was trying to figure out why the frontend wouldn't connect to my backend container and found that the container names appear to be hard coded.

For example if I understand https://github.com/nilsherzig/LLocalSearch/blob/main/vite.config.ts#L9 correctly this assumes the backend container is always going to exist at http://backend:8080 - which won't work if your backend container is named something else, e.g. in my case llocalsearch-backend and may be behind a traefik load balancer so could be something like https://llocalsearch-backend.my.domain:443

nilsherzig commented 6 months ago

Yes you're right. We should use env vars for this. But to be honest, we should not use vite in the first place to run the production / release version.

I think we should package the whole thing and run it either as a static site or via nodejs. https://kit.svelte.dev/docs/adapters.

nilsherzig commented 6 months ago

oh yea and the switch to an .env file really is a good idea :)

nilsherzig commented 6 months ago

I will add the backend env var next. But i dont think we should use the vite proxy solution in the future. Its kinda hard to provide a one click solution and sensible defaults for people like you who have proper routing and networking setup in their env / prod.

But i also plan to run this on my Kubernetes cluster using traefik, so we will definitely find a nice solution for this.

peperunas commented 6 months ago

I was about to open an issue asking to make the backend URI configurable via an env var. That allows for more complex setups that don't have to rely on docker alone (packaging for other distributions).

nilsherzig commented 6 months ago

Anyone here knows how to get vite to read env vars?

https://vitejs.dev/guide/env-and-mode.html#env-files

image