Postgres Setup
While PromptPanel uses SQLite by default for its database needs, you have the option to leverage the power and scalability of Postgres for production environments or situations with higher data storage and performance requirements.
Environment Variables
To switch from SQLite to Postgres, you'll need to configure the following environment variables during container startup:
PROMPT_PG_HOST
: Specifies the hostname or IP address of your Postgres server.PROMPT_PG_PORT
: Port number on which the Postgres server is listening (typically 5432).PROMPT_PG_DBNAME
: The name of the Postgres database that PromptPanel should use.PROMPT_PG_USER
: Sets the username for authentication with the Postgres server.PROMPT_PG_PASS
: Provides the password for the specified Postgres user.
You'll need to backup and transfer your data from SQLite to Postgres during this process if you're moving databases.
Docker Compose Example
The following is an example docker-compose.yml
with the required fields for setting up Postgres with PromptPanel:
version: "3.9"
services:
promptpanel:
image: promptpanel/promptpanel:latest
container_name: promptpanel
restart: always
volumes:
- ./database:/app/database
- ./media:/app/media
ports:
- 4000:4000
environment:
# Postgres Setup
PROMPT_PG_HOST: postgres_db
PROMPT_PG_PORT: 5432
PROMPT_PG_DBNAME: postgres
PROMPT_PG_USER: pg_user
PROMPT_PG_PASS: pg_password
depends_on:
postgres_db:
condition: service_healthy
postgres_db:
image: postgres:15
container_name: postgres_db
restart: unless-stopped
environment:
POSTGRES_DB: postgres
POSTGRES_USER: pg_user
POSTGRES_PASSWORD: pg_password
healthcheck:
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
interval: 10s
timeout: 5s
retries: 25