nextcloud / context_chat_backend

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

[install-help]: ASGI Exception in DockerContainer #41

Closed Pfeiffenrohr closed 5 months ago

Pfeiffenrohr commented 5 months ago

Describe the issue I created the context chat backend container and started the container with

docker run \ -v ./config.yaml:/app/config.yaml \ -v ./context_chat_backend:/app/context_chat_backend \ -v /var/run/docker.sock:/var/run/docker.sock \ --env-file example.env \ -p 10034:10034 \ -e CUDA_VISIBLE_DEVICES=0 \ -v persistent_storage:/app/persistent_storage \ context_chat_backend

The docker started up.

Then I try to register the app to my nextcloud with: sudo -u www-data php occ app_api:app:register \ context_chat_backend \ manual_install \ --json-info "{\"appid\":\"context_chat_backend\",\ \"name\":\"Context Chat Backend\",\ \"daemon_config_name\":\"manual_install\",\ \"version\":\"2.1.0\",\ \"secret\":\"12345\",\ \"port\":10034,\ \"scopes\":[],\ \"system_app\":0}" \ --force-scopes \ --wait-finish

Then I get an error in the Logfile of the Dockercontainer.

Server logs (if applicable)

ERROR: Exception in ASGI application Traceback (most recent call last): File "/usr/local/lib/python3.11/dist-packages/uvicorn/protocols/http/h11_impl.py", line 407, in run_asgi result = await app( # type: ignore[func-returns-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/uvicorn/middleware/proxy_headers.py", line 69, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/uvicorn/middleware/message_logger.py", line 84, in call raise exc from None File "/usr/local/lib/python3.11/dist-packages/uvicorn/middleware/message_logger.py", line 80, in call await self.app(scope, inner_receive, inner_send) File "/usr/local/lib/python3.11/dist-packages/fastapi/applications.py", line 1054, in call await super().call(scope, receive, send) File "/usr/local/lib/python3.11/dist-packages/starlette/applications.py", line 123, in call await self.middleware_stack(scope, receive, send) File "/usr/local/lib/python3.11/dist-packages/starlette/middleware/errors.py", line 186, in call raise exc File "/usr/local/lib/python3.11/dist-packages/starlette/middleware/errors.py", line 164, in call await self.app(scope, receive, _send) File "/app/context_chat_backend/ocs_utils.py", line 75, in call await self.app(scope, receive, send) File "/usr/local/lib/python3.11/dist-packages/starlette/middleware/exceptions.py", line 65, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "/usr/local/lib/python3.11/dist-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/usr/local/lib/python3.11/dist-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/usr/local/lib/python3.11/dist-packages/starlette/routing.py", line 756, in call await self.middleware_stack(scope, receive, send) File "/usr/local/lib/python3.11/dist-packages/starlette/routing.py", line 776, in app await route.handle(scope, receive, send) File "/usr/local/lib/python3.11/dist-packages/starlette/routing.py", line 297, in handle await self.app(scope, receive, send) File "/usr/local/lib/python3.11/dist-packages/starlette/routing.py", line 77, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) File "/usr/local/lib/python3.11/dist-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/usr/local/lib/python3.11/dist-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/usr/local/lib/python3.11/dist-packages/starlette/routing.py", line 75, in app await response(scope, receive, send) File "/usr/local/lib/python3.11/dist-packages/starlette/responses.py", line 162, in call await self.background() File "/usr/local/lib/python3.11/dist-packages/starlette/background.py", line 45, in call await task() File "/usr/local/lib/python3.11/dist-packages/starlette/background.py", line 30, in call await run_in_threadpool(self.func, *self.args, *self.kwargs) File "/usr/local/lib/python3.11/dist-packages/starlette/concurrency.py", line 42, in run_in_threadpool return await anyio.to_thread.run_sync(func, args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/anyio/to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/anyio/_backends/_asyncio.py", line 2144, in run_sync_in_worker_thread return await future ^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/anyio/_backends/_asyncio.py", line 851, in run result = context.run(func, *args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/context_chat_backend/download.py", line 259, in background_init if not _download_model(model_name): ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/context_chat_backend/download.py", line 183, in _download_model return _extract_n_save(model_name, filepath) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/context_chat_backend/download.py", line 209, in _extract_n_save tar_archive.extractall(_MODELS_DIR, filter='data') TypeError: TarFile.extractall() got an unexpected keyword argument 'filter' TRACE: 172.17.0.1:50244 - HTTP connection lost

Can sombody help?

Setup Details (please complete the following information):

kyteinsky commented 5 months ago

Hello, what is your python version? 'filter' was introduced in later versions of python I suppose. Using python 3.11 should be ideal.

-v ./config.yaml:/app/config.yaml

should not be required, the config.yaml file now lives in the persistent_storage. Keep in mind to change that one instead of the sample yaml files in the root of the project. Also, it would be nice to update the dependencies if you've not already done so: pip install --upgrade -r requirements.in.txt

-v /var/run/docker.sock:/var/run/docker.sock

not required for manual installs

Pfeiffenrohr commented 5 months ago

Thanks for the answer. I installed it now with docker-install direct from nextcloud and it works now