nextcloud / context_chat_backend

GNU Affero General Public License v3.0
5 stars 5 forks source link

[install-help]: One click install sets wrong environment config #33

Closed Hyp3rSoniX closed 6 months ago

Hyp3rSoniX commented 6 months ago

Describe the issue I run nextcloud inside a proxmox lxc. Docker, runs inside another lxc. I have set up the docker proxy and am able to add my docker host daemon to nextcloud.

BUT when I install the context chat backend via the ExApps Web UI, I see that the chat backend gets set up with environment variables, that would have me need to either run nextcloud on the same host as the docker daemon, or in the same docker network.

That is not the case with me. Can I somehow manipulate the environment variables that are going to be used from nextcloud side?

In detail: APP_HOST is set to 127.0.0.1. Even though the container runs with network mode host, because of that ip adress, my home network can't connect to the container. It would need to be 0.0.0.0 for example, or the network ip of the host machine.

Screenshots If applicable, add screenshots to help explain your problem.

default nextcloud ExApp we ui deployment: image

different machine in the home network: image

With modified port: image image

my other machine in my home network: image

Is this expected/wanted that the nextcloud installation needs to be near to the docker host?

If not and my usecase is valid, is there a way I can somehow tell nextcloud to deploy the chat backend with MY desired env vars? Or are they maybe even set into the image itself? Though the example env file also uses 0.0.0.0 for the Host...

Server logs (if applicable)

``` healtcheck failed ```

Context Chat Backend logs (if applicable, from the docker container)

``` App config: { "debug": true, "disable_aaa": false, "httpx_verify_ssl": true, "use_colors": true, "uvicorn_workers": 1, "disable_custom_model_download": false, "model_download_uri": "https://download.nextcloud.com/server/apps/context_chat_backend", "vectordb": [ "chroma", { "is_persistent": true } ], "embedding": [ "instructor", { "model_name": "hkunlp/instructor-base", "model_kwargs": { "device": "cuda" } } ], "llm": [  "llama", { "model_path": "dolphin-2.2.1-mistral-7b.Q5_K_M.gguf", "n_batch": 10, "n_ctx": 4096, "n_gpu_layers": -1, "template": "<|im_start|> system \nYou're an AI assistant good at finding relevant context from documents to answer questions provided by the user. <|im_end|>\n<|im_start|> user\nUse the following documents as context to answer the question at the end. REMEMBER to excersice source critisicm as the documents are returned by a search provider that can return unrelated documents.\n\nSTART OF CONTEXT: \n{context} \n\nEND OF CONTEXT!\n\nIf you don't know the answer or are unsure, just say that you don't know, don't try to make up an answer. Don't mention the context in your answer but rather just answer the question directly. \nQuestion: {question} Let's think this step-by-step. \n<|im_end|>\n<|im_start|> assistant\n", "end_separator": "<|im_end|>", "model_kwargs": { "device": "cuda" } } ] } App disabled at startup INFO: Started server process [1] INFO: Waiting for application startup. TRACE: ASGI [1] Started scope={'type': 'lifespan', 'asgi': {'version': '3.0', 'spec_version': '2.0'}, 'state': {}} TRACE: ASGI [1] Receive {'type': 'lifespan.startup'} TRACE: ASGI [1] Send {'type': 'lifespan.startup.complete'} INFO: Application startup complete. INFO: Uvicorn running on http://127.0.0.1:23000 (Press CTRL+C to quit) ```

Setup Details (please complete the following information):

kyteinsky commented 6 months ago

AppAPI should setup the context chat's docker container in the same docker network as the main nextcloud container and use 127.0.0.1 for security purposes. It then accesses the HTTP endpoints using the container's name as the host address. The HTTP endpoints cannot be accessed from the host machine's network.
@bigcat88 I'm not sure if changing the docker socket proxy's settings would change things here. Your insights would be valuable.

@Hyp3rSoniX Can you post the outputs to docker inspect <container_name> for both nextcloud and the chat backend?

bigcat88 commented 6 months ago

I run nextcloud inside a proxmox lxc. Docker, runs inside another lxc.

currently unfortunately this configuration is considered as a remote install - Nextcloud and ExApps runs on different hosts..

is there a way I can somehow tell nextcloud to deploy the chat backend with MY desired env vars?

it is not possible currently, see

I'm not sure if changing the docker socket proxy's settings would change things here

this will happen, the env variables will change depending on whether the ExApp is local or remote

Similar issue: https://github.com/cloud-py-api/app_api/issues/231

Hyp3rSoniX commented 6 months ago

Alright, I somehow managed to set the stuff up on my system via the manual installation thing.

However it would be cool if you could reconsider maybe at least giving the server admins the option to enable/disable remote docker host usage.

On my system, the one click install was almost successful, in the end it failed just because of the APP_HOST being set restrictively.

Updating the manual install is probably also gonna be harder than the one click install...

My installation is working now though, so feel free to close this issue, if you don't need it for anything else.