3x3cut0r / docker

several docker containers
https://github.com/3x3cut0r/docker
23 stars 9 forks source link

docker-compose.yml for Postgres DB #19

Closed AlexPerkin closed 1 month ago

AlexPerkin commented 2 months ago

Hi, Please provide a sample docker-compose.yml file for privategpt project in case of using postgres as DB. In my case:

`VECTORSTORE_DATABASE: postgres NODESTORE_DATABASE: postgres

POSTGRES_HOST: privategpt POSTGRES_PORT: 5432 POSTGRES_DATABASE: postgres POSTGRES_USER: postgres POSTGRES_PASSWORD: admin POSTGRES_SCHEMA_NAME: private_gpt`

Error:

privategpt | sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at "privategpt" (172.18.0.3), port 5432 failed: Connection refused privategpt | Is the server running on that host and accepting TCP/IP connections?

Thanks in advance

3x3cut0r commented 2 months ago
version: '3.9'

services:
  privategpt:
    image: 3x3cut0r/privategpt:latest
    container_name: privategpt
    environment:
      VECTORSTORE_DATABASE: postgres
      NODESTORE_DATABASE: postgres
      POSTGRES_HOST: postgres
      POSTGRES_PORT: 5432
      POSTGRES_DATABASE: postgres
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: admin
      POSTGRES_SCHEMA_NAME: private_gpt
    depends_on:
      - postgres
    ports:
      - "8080:8080"
    networks:
      - privategpt

  postgres:
    image: postgres:latest
    container_name: postgres
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: admin
      POSTGRES_DB: postgres
    volumes:
      - postgres_data:/var/lib/postgresql/data
    ports:
      - "5432:5432"
    networks:
      - privategpt

volumes:
  postgres_data:
    name: postgres_data

networks:
  privategpt:
    name: privategpt
    driver: bridge
AlexPerkin commented 2 months ago

Hi, If I use this configuration and try to load files in PrivateGPT, I get an error:

privategpt | DETAIL: Could not open extension control file "/usr/share/postgresql/16/extension/vector.control": No such file or directory. privategpt | HINT: The extension must first be installed on the system where PostgreSQL is running.

I probably need to install PGVector extension. Please tell me how to do it correctly?

3x3cut0r commented 2 months ago

i haven"t done this before. maybe you need to search for this by yourself. i found this for example: https://medium.com/@johannes.ocean/setting-up-a-postgres-database-with-the-pgvector-extension-10ab7ff212cc