I wanted to try Discourse locally, so I used Docker Compose to set it up:
version: '3.8'
services:
postgres:
image: pgvector/pgvector:pg17
container_name: discourse-postgres
restart: always
environment:
POSTGRES_USER: discourse
POSTGRES_PASSWORD: discourse
POSTGRES_DB: discourse
# Ensure the extension loads correctly
# POSTGRES_INITDB_ARGS: "--enable-extensions=vector"
volumes:
- ./data/postgres:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U discourse && psql -U discourse -c 'SELECT * FROM pg_extension WHERE extname = ''vector'';'"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
container_name: discourse-redis
restart: always
volumes:
- ./data/redis:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
discourse:
image: discourse/discourse:stable
container_name: discourse-app
restart: always
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
ports:
- "80:80"
environment:
DISCOURSE_DB_HOST: postgres
DISCOURSE_DB_USER: discourse
DISCOURSE_DB_PASSWORD: discourse
DISCOURSE_REDIS_HOST: redis
DISCOURSE_DEVELOPER_EMAILS: "admin@example.com"
DISCOURSE_HOSTNAME: "localhost"
# Temporary SMTP configuration (must be changed to real values after startup)
DISCOURSE_SMTP_ADDRESS: "smtp.example.com"
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: "admin@example.com"
DISCOURSE_SMTP_PASSWORD: "password"
# Optional: Disable unnecessary AI features to reduce extension dependencies (if needed)
DISCOURSE_DISABLE_VECTOR_SEARCH: "true"
volumes:
- ./data/discourse:/var/www/discourse/shared
However, I encountered an issue preventing me from experiencing the Discourse forum:
discourse-postgres | 2026-01-20 09:19:47.774 UTC [140] ERROR: column "vector" does not exist at character 44
discourse-postgres | 2026-01-20 09:19:47.774 UTC [140] STATEMENT: SELECT * FROM pg_extension WHERE extname = vector;
I’m not sure what the reason is. Can any experienced user provide guidance?