Enable pg_stat_statements module

How to do it pg_stat_statements is required by pgAssistant. If you are not familiar with this module, you can find here the official Postgres documentation. To enable this module, add this option on the command that runs Posgres : shared_preload_libraries='pg_stat_statements' Then, connect to the database and run this command : CREATE EXTENSION IF NOT EXISTS pg_stat_statements; (When you run pgAssistant, he will execute this SQL Statements) If you run Postgresql in a docker environment Here is a sample docker-compose file that enables the module : ...

January 10, 2025 · 1 min · beh74

Startup pgAssistant with docker

Before you begin You must enable the pg_stat_statements module on your postgres database. Here is a documentation Using the NexSol Technologies docker file Here is a sample docker-compose.yml file to run pgassistant : services: pgassistant: image: nexsoltech/pgassistant:latest restart: always environment: - OPENAI_API_KEY=nothing - OPENAI_API_MODEL=codestral:latest - LOCAL_LLM_URI=http://host.docker.internal:11434/v1/ - SECRET_KEY=mySecretKey4PgAssistant ports: - "8080:5005" volumes: - ./myqueries.json:/home/pgassistant/myqueries.json The file myqueries.json is not necessary to run pgAssistant, but it should be usefull. Please read the doc here Envrionment variables Variable Description Example value OPENAI_API_KEY Dummy key (required by clients expecting a token) nothing OPENAI_API_MODEL Model identifier to use with the API codestral:latest or mistral:latest LOCAL_LLM_URI Local endpoint URL for the OpenAI-compatible API http://host.docker.internal:11434/v1/ SECRET_KEY Used to encrypt some htttp session variables. mySecretKey4PgAssistant Notes OPENAI_API_KEY is required by most clients but not used when querying local LLMs like Ollama. You can set it to any placeholder (e.g. nothing). OPENAI_API_MODEL must match the model name loaded in Ollama (e.g. codestral, llama3, mistral, etc.). LOCAL_LLM_URI should point to the Ollama server, accessible from inside your Docker container via host.docker.internal. How to build your docker image Simply clone the repo and then build your own image like this : ...

January 10, 2025 · 1 min · beh74