Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on docker compose up #4

Open
gabazureus opened this issue Feb 10, 2023 · 5 comments
Open

Error on docker compose up #4

gabazureus opened this issue Feb 10, 2023 · 5 comments

Comments

@gabazureus
Copy link

gabazureus commented Feb 10, 2023

Hello!

First of all, awesome project! Thank you!

I am running this on Ubuntu 22.04.

I have created an .env file inside the "api" directory with this configuration
image

And then I entered inside the "api" folder, and tried to run "docker compose up", and got these errors:

$ sudo docker compose up
[+] Running 2/0
 ⠿ Container bricky-app-1  Created                                                                                    0.0s
 ⠿ Container bricky-api-1  Created                                                                                    0.0s
Attaching to bricky-api-1, bricky-app-1
bricky-app-1  | 
bricky-app-1  | > bricky-chat@0.1.0 start
bricky-app-1  | > next start
bricky-app-1  | 
bricky-app-1  | ready - started server on 0.0.0.0:3000, url: http://localhost:3000
bricky-api-1  | INFO:haystack.telemetry:Telemetry has been disabled.
bricky-api-1  | DEBUG:haystack.pipelines.base:Running node 'File` with input: {'root_node': 'File', 'params': None, 'node_id': 'File'}
bricky-api-1  | DEBUG:haystack.pipelines.base:Running node 'MarkdownConverter` with input: {'root_node': 'File', 'params': {}, 'node_id': 'MarkdownConverter'}
bricky-api-1  | DEBUG:haystack.pipelines.base:Exception while running node 'MarkdownConverter' with input {'root_node': 'File', 'params': {}, 'node_id': 'MarkdownConverter'}
bricky-api-1  | Traceback (most recent call last):
bricky-api-1  |   File "/opt/venv/lib/python3.10/site-packages/haystack/pipelines/base.py", line 530, in run
bricky-api-1  |     node_output, stream_id = self._run_node(node_id, node_input)
bricky-api-1  |   File "/opt/venv/lib/python3.10/site-packages/haystack/pipelines/base.py", line 457, in _run_node
bricky-api-1  |     return self.graph.nodes[node_id]["component"]._dispatch_run(**node_input)
bricky-api-1  |   File "/opt/venv/lib/python3.10/site-packages/haystack/nodes/base.py", line 201, in _dispatch_run
bricky-api-1  |     return self._dispatch_run_general(self.run, **kwargs)
bricky-api-1  |   File "/opt/venv/lib/python3.10/site-packages/haystack/nodes/base.py", line 245, in _dispatch_run_general
bricky-api-1  |     output, stream = run_method(**run_inputs, **run_params)
bricky-api-1  | TypeError: BaseConverter.run() missing 1 required positional argument: 'file_paths'
bricky-api-1  | 
bricky-api-1  | The above exception was the direct cause of the following exception:
bricky-api-1  | 
bricky-api-1  | Traceback (most recent call last):
bricky-api-1  |   File "/opt/venv/bin/uvicorn", line 8, in <module>
bricky-api-1  |     sys.exit(main())
bricky-api-1  |   File "/opt/venv/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
bricky-api-1  |     return self.main(*args, **kwargs)
bricky-api-1  |   File "/opt/venv/lib/python3.10/site-packages/click/core.py", line 1055, in main
bricky-api-1  |     rv = self.invoke(ctx)
bricky-api-1  |   File "/opt/venv/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
bricky-api-1  |     return ctx.invoke(self.callback, **ctx.params)
bricky-api-1  |   File "/opt/venv/lib/python3.10/site-packages/click/core.py", line 760, in invoke
bricky-api-1  |     return __callback(*args, **kwargs)
bricky-api-1  |   File "/opt/venv/lib/python3.10/site-packages/uvicorn/main.py", line 404, in main
bricky-api-1  |     run(
bricky-api-1  |   File "/opt/venv/lib/python3.10/site-packages/uvicorn/main.py", line 569, in run
bricky-api-1  |     server.run()
bricky-api-1  |   File "/opt/venv/lib/python3.10/site-packages/uvicorn/server.py", line 60, in run
bricky-api-1  |     return asyncio.run(self.serve(sockets=sockets))
bricky-api-1  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
bricky-api-1  |     return loop.run_until_complete(main)
bricky-api-1  |   File "/usr/local/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
bricky-api-1  |     return future.result()
bricky-api-1  |   File "/opt/venv/lib/python3.10/site-packages/uvicorn/server.py", line 67, in serve
bricky-api-1  |     config.load()
bricky-api-1  |   File "/opt/venv/lib/python3.10/site-packages/uvicorn/config.py", line 477, in load
bricky-api-1  |     self.loaded_app = import_from_string(self.app)
bricky-api-1  |   File "/opt/venv/lib/python3.10/site-packages/uvicorn/importer.py", line 21, in import_from_string
bricky-api-1  |     module = importlib.import_module(module_str)
bricky-api-1  |   File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
bricky-api-1  |     return _bootstrap._gcd_import(name[level:], package, level)
bricky-api-1  |   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
bricky-api-1  |   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
bricky-api-1  |   File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
bricky-api-1  |   File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
bricky-api-1  |   File "<frozen importlib._bootstrap_external>", line 883, in exec_module
bricky-api-1  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
bricky-api-1  |   File "/home/appuser/./main.py", line 28, in <module>
bricky-api-1  |     index_pipe.ensure_index()
bricky-api-1  |   File "/home/appuser/./pipelines/indexing.py", line 57, in ensure_index
bricky-api-1  |     self.pipeline.run(file_paths=files_to_index)
bricky-api-1  |   File "/opt/venv/lib/python3.10/site-packages/haystack/pipelines/base.py", line 535, in run
bricky-api-1  |     raise Exception(
bricky-api-1  | Exception: Exception while running node 'MarkdownConverter': BaseConverter.run() missing 1 required positional argument: 'file_paths'
bricky-api-1  | Enable debug logging to see the data that was passed when the pipeline failed.
bricky-api-1 exited with code 1

I can access localhost:3000, but I get this error when I do:

bricky-app-1  | Warning: For production Image Optimization with Next.js, the optional 'sharp' package is strongly recommended. Run 'yarn add sharp', and Next.js will use it automatically for Image Optimization.
bricky-app-1  | Read more: https://nextjs.org/docs/messages/sharp-missing-in-production
bricky-app-1  | TypeError: fetch failed
bricky-app-1  |     at Object.fetch (node:internal/deps/undici/undici:14152:11)
bricky-app-1  |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
bricky-app-1  |     at async __WEBPACK_DEFAULT_EXPORT__ (/app/.next/server/pages/api/chat.js:16:22)
bricky-app-1  |     at async Object.apiResolver (/app/node_modules/next/dist/server/api-utils/node.js:363:9)
bricky-app-1  |     at async NextNodeServer.runApi (/app/node_modules/next/dist/server/next-server.js:487:9)
bricky-app-1  |     at async Object.fn (/app/node_modules/next/dist/server/next-server.js:749:37)
bricky-app-1  |     at async Router.execute (/app/node_modules/next/dist/server/router.js:253:36)
bricky-app-1  |     at async NextNodeServer.run (/app/node_modules/next/dist/server/base-server.js:384:29)
bricky-app-1  |     at async NextNodeServer.handleRequest (/app/node_modules/next/dist/server/base-server.js:322:20) {
bricky-app-1  |   cause: Error: getaddrinfo EAI_AGAIN api
bricky-app-1  |       at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) {
bricky-app-1  |     errno: -3001,
bricky-app-1  |     code: 'EAI_AGAIN',
bricky-app-1  |     syscall: 'getaddrinfo',
bricky-app-1  |     hostname: 'api'
bricky-app-1  |   }
bricky-app-1  | }

I can't access localhost:8000/docs

Am I doing something wrong?
Thanks!

@gabazureus
Copy link
Author

I have a doubt, in my doc dir I can put what kind of files?

@larsbaunwall
Copy link
Owner

Hi @gabazureus - thank you for checking my project out 😄

I managed to reproduce your error. It occurs because no files were found to index (in the doc_dir).
I've implemented a fix for this, so you now should get a nice error instead of a crash.

The code picks up any .md files in the doc_dir path, you can see how in the indexing pipeline:

for file in glob.glob(os.path.join(self.doc_dir, "**/*.md"), recursive=True):

Also note that the files need to be visible to the docker container, either by copying them into a local project folder that gets copied on build, or by mounting a volume.

A quick start could be to put your markdown files in the api/sources folder and configure the DOC_DIR to point to sources

@gabriel0xdef
Copy link

gabriel0xdef commented Feb 10, 2023

Hey @larsbaunwall

Thanks for the reply!

I tried to put a .md file inside the api/sources, and specified this folder in DOC_DIR in .env file like you said. But the same error persisted.

So I tried to deleting all the contents of the main.py, openai.py and indexing.py files.

And then tried these commands:

sudo docker system prune
systemctl restart docker.service
sudo docker compose down
sudo docker compose up -d

And then the same error persist, even with these files without any lines.

Before that I put many prints inside indexing.py and main.py, and none of them printed in the log. I tried commenting out this line as well "disable_telemetry()" in main.py, to see if the following line in the log disappears: "INFO:haystack.telemetry:Telemetry has been disabled.". But it showed up anyway.

I don't know if I'm doing something wrong with docker, because I'm new to this.

Thanks!

@larsbaunwall
Copy link
Owner

Hi @gabriel0xdef

From your description, I'm wondering if your docker-compose is using recent images. Deleting contents in those files should give you a whole range of other errors 😉

Have you tried running docker-compose up --build in the repo root? The --build flag forces the images to be rebuilt.

@gabriel0xdef
Copy link

gabriel0xdef commented Feb 11, 2023

Oh yes! This command made it. Thanks!

Now I can open localhost:8080/docs
and every of my prints appeared when I run
sudo docker compose up --build
and got no error in the starting process.

But when I asked a question, I got these errors:

bricky-api-1  | No files found to index at path /api/sources
bricky-api-1  | Source context will be empty

I tried "/api/sources" or "api/sources", and it give me the same.

Then I tried only "sources" and it worked!

Simply awesome!!

A doubt, is it possible to change the default language to read the DOCs contents, and the answer of Bricky to Portuguese?

If yes, what can I change in the code?

Thank you, I would like to help you more If I can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants