lobehub / lobe-chat

🤯 Lobe Chat - an open-source, modern-design AI chat framework. Supports Multi AI Providers( OpenAI / Claude 3 / Gemini / Ollama / Azure / DeepSeek), Knowledge Base (file upload / knowledge management / RAG ), Multi-Modals (Vision/TTS) and plugin system. One-click FREE deployment of your private ChatGPT/ Claude application.
https://chat-preview.lobehub.com
Other
44.68k stars 10.04k forks source link

[Bug] lobechat-database-docker quick deploy script produces broken startup #4730

Open anphex opened 2 hours ago

anphex commented 2 hours ago

📦 Environment

Docker

📌 Version

latest as of 19th november 2024

💻 Operating System

Ubuntu

🌐 Browser

Chrome

🐛 Bug Description

> `      
> panic: dial tcp 172.30.0.3:5432: connect: no route to host
> 
> goroutine 1 [running]:
> 
> github.com/casdoor/casdoor/object.InitAdapter()
> 
>   /go/src/casdoor/object/ormer.go:91 +0x246
> 
> main.main()
> 
>   /go/src/casdoor/main.go:35 +0x30
> 
> panic: dial tcp 172.30.0.3:5432: connect: no route to host
> 
> goroutine 1 [running]:
> 
> github.com/casdoor/casdoor/object.InitAdapter()
> 
>   /go/src/casdoor/object/ormer.go:91 +0x246
> 
> main.main()
> 
>   /go/src/casdoor/main.go:35 +0x30`
> 

This is what happens when I run this command as stated in your guide: bash <(curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/local/setup.sh) -f

My understanding is this should work out of the box, but why can't cassador reach the postgres database?

Also the lobechat-chat container can't reach the database

> `  errno: -113,
> 
>   code: 'EHOSTUNREACH',
> 
>   syscall: 'connect',
> 
>   address: '172.30.0.3',
> 
> 
>   port: 5432
> 
> }
> 
> ❌ Error during DB migration:
> 
> Error: 🔴 Process exited with code 1
> 
>     at ChildProcess.<anonymous> (/app/startServer.js:88:68)
> 
>     at ChildProcess.emit (node:events:519:28)
> 
>     at maybeClose (node:internal/child_process:1105:16)
> 
>     at ChildProcess._handle.onexit (node:internal/child_process:305:5)`
> 

📷 Recurrence Steps

Follow this guide step by step up until docker compose up -d

🚦 Expected Behavior

Clean start of the lobechat-database compose environment.

📝 Additional Information

No response

lobehubbot commented 2 hours ago

👀 @anphex

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.\ 非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

dosubot[bot] commented 2 hours ago

Hey @anphex! I'm here to help you with any bugs, questions, or contributions you have regarding lobechat-database-docker. Let's squash this bug together!

It seems like you're encountering a network connectivity issue between the Casdoor and LobeChat containers and the Postgres database. This type of error often indicates that the containers are unable to communicate over the network, which could be due to several reasons such as network misconfiguration or firewall settings.

Here are a few steps you can take to troubleshoot and resolve this issue:

  1. Check Docker Network Configuration: Ensure that all your containers are on the same Docker network. The default network configuration for the Docker Compose setup in the lobe-chat repository uses a custom network named lobe-network with the bridge driver [1]. Verify that your containers are connected to this network.

  2. Verify Container Health: Make sure that the Postgres container is healthy and running. You can check the status of your containers using docker ps and inspect the logs of the Postgres container for any errors using docker logs <container_id>.

  3. Firewall Settings: Ensure that there are no firewall rules blocking the communication between the containers. A similar issue was resolved by opening the necessary ports in the firewall [2].

  4. Service Dependencies: Check the depends_on configuration in your Docker Compose file to ensure that services start in the correct order. The postgresql service should be healthy before other services like Casdoor and LobeChat attempt to connect to it [1].

  5. Network Connectivity: You can test the network connectivity between containers using Docker's exec command to run network tools like ping or telnet from one container to another.

If these steps do not resolve the issue, you might want to review the Docker Compose file and any custom configurations you have applied to ensure they align with the expected setup.

To continue talking to Dosu, mention @dosu.