Skip to content

Docker Setup

PolitikTok uses Docker Compose to run its infrastructure dependencies. All services are defined in docker-compose.yml at the project root.

Starting All Services

bash
docker compose up -d

To stop all services:

bash
docker compose down

To stop and remove all data volumes:

bash
docker compose down -v

Services Overview

PostgreSQL

PropertyValue
Imagepostgres:16
Containerpolitiktok-postgres
Host Port5433
Container Port5432
Databasepolitiktok
Usernamepolitiktok
Passwordpolitiktok

PostgreSQL is the primary data store for all relational data -- users, volunteers, tasks, donors, social posts, chat messages, documents, compliance records, and more. The connection pool is configured for up to 20 concurrent connections.

Migrations are stored in the ./migrations directory and run automatically when the server starts. The health check uses pg_isready with a 5-second interval.

Connection string for local development:

postgresql://politiktok:politiktok@localhost:5433/politiktok

Note the host port is 5433 (not the default 5432) to avoid conflicts with any local PostgreSQL installation.

Qdrant

PropertyValue
Imageqdrant/qdrant:latest
Containerpolitiktok-qdrant
HTTP Port6335 (host) -> 6333 (container)
gRPC Port6336 (host) -> 6334 (container)

Qdrant is the vector database used for semantic search in the RAG pipeline. It stores document chunk embeddings for:

  • Policy Chatbot (F02) -- policy_documents collection
  • Knowledge Base (F25) -- knowledge_base collection

Collections are created on-demand when documents are first ingested. The default distance metric is cosine similarity.

Health check URL: http://localhost:6335/healthz

Keycloak

PropertyValue
Imagequay.io/keycloak/keycloak:26.0
Containerpolitiktok-keycloak
Host Port8081
Container Port8080
Admin Useradmin
Admin Passwordadmin

Keycloak handles authentication and authorization via OpenID Connect with PKCE. It runs in start-dev mode with realm auto-import.

The application uses four roles mapped from Keycloak realm roles:

RolePermissions
adminFull access to all modules and admin panel
staffAccess to all operational modules
volunteerLimited access to volunteer-facing modules
readonlyView-only access

Keycloak depends on PostgreSQL and will wait for it to be healthy before starting. The Keycloak database is stored in the same PostgreSQL instance.

Admin console: http://localhost:8081

Ollama

PropertyValue
Imageollama/ollama
Containerpolitiktok-ollama
Host Port11434
Container Port11434

Ollama provides the local LLM inference endpoint. It exposes an OpenAI-compatible API at http://localhost:11434/v1. The container is configured with GPU passthrough for NVIDIA GPUs.

Required models:

bash
# Text generation
docker exec politiktok-ollama ollama pull llama3.1:8b

# Embedding
docker exec politiktok-ollama ollama pull nomic-embed-text

You can substitute any Ollama-supported model by changing LLM_MODEL and EMBEDDING_MODEL in your .env file.

SearXNG

PropertyValue
Imagesearxng/searxng:latest
Containerpolitiktok-searxng
Host Port8889
Container Port8080

SearXNG is a privacy-respecting metasearch engine used by modules that need to retrieve current information from the web -- such as the Regulatory Monitor (F20) and Media Monitor (F21).

Search UI: http://localhost:8889

Network

All services are connected through the politiktok-net bridge network, allowing inter-container communication by service name (e.g., postgres:5432 from within other containers).

Persistent Volumes

VolumeServicePurpose
postgres-dataPostgreSQLDatabase files
qdrant-dataQdrantVector storage
ollama-dataOllamaDownloaded model weights
searxng-dataSearXNGConfiguration
keycloak-dataKeycloakRealm data and themes

Data persists across docker compose down and docker compose up cycles. Use docker compose down -v to remove all volumes and start fresh.

Resource Requirements

ServiceRAM (minimum)Notes
PostgreSQL256 MBIncreases with database size
Qdrant512 MBScales with number of stored vectors
Keycloak512 MBJVM-based, may spike on startup
Ollama4 -- 16 GBDepends on model size; 8B models need ~8 GB
SearXNG128 MBLightweight

For development with an 8B parameter model, plan for at least 16 GB of available RAM total.