rashadphz / farfalle

🔍 AI search engine - self-host with local or cloud LLMs
https://www.farfalle.dev/
Apache License 2.0
2.21k stars 166 forks source link

SQLalchemy failure to connect to postgres database #62

Open smehra opened 6 days ago

smehra commented 6 days ago

This is out of the box running with docker as shown here docker run \ -p 8000:8000 -p 3000:3000 -p 8080:8080 \ --add-host=host.docker.internal:host-gateway \ ghcr.io/rashadphz/farfalle:main

Sqlchemy fails to connect: sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at "localhost" (::1), port 5432 failed: Connection refused backend-1 | Is the server running on that host and accepting TCP/IP connections? backend-1 | connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused backend-1 | Is the server running on that host and accepting TCP/IP connections?

rashadphz commented 6 days ago

Hey, the Dockerfile doesn't yet support the Postgres database, for now you'll have to use the docker-compose. I'll update you when I add support for this in the Dockerfile.

crypticatul commented 5 days ago

I have cloned the repo and using Groq with Bing. When I ask a query, it starts generating the answer, however, before the complete answer is generated it shows the following error.

image

In Inspect element -> console, it says :1 Unchecked runtime.lastError: The message port closed before a response was received.

rashadphz commented 4 days ago

Hmm, thats weird. Did you modify the database URL in the .env?

crypticatul commented 4 days ago

Did you modify the database URL in the .env? Actually, there was a typo in db url earlier, however, I have corrected it and have double checked that I have also enabled DB_ENABLED as true. However, still now I'm getting the following error:

500: (psycopg2.OperationalError) could not translate host name "db" to address: Name or service not known (Background on this error at: https://sqlalche.me/e/20/e3q8)

rashadphz commented 3 days ago

Do you have the updated docker-compose.dev file? This part is especially important:

db:
    image: postgres:15.2-alpine
    restart: always
    environment:
      - POSTGRES_USER=${POSTGRES_USER:-postgres}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
      - POSTGRES_DB=${POSTGRES_DB:-postgres}
    ports:
      - "5432:5432"
    volumes:
      - db_volume:/var/lib/postgresql/data
    networks:
      - farfalle-network