Docker Deployment
Guides, route-group overviews, and live schema entry points for the Plexichat backend.
Docker deployment guide
This section describes how to run Plexichat with Docker and Docker Compose.
Quick navigation
- Quick start - Run Plexichat locally in 5 minutes.
- Configuration - Configure environment variables and the
.envfile. - Development workflow - Use hot reload, tests, and debugging.
- Production setup - Harden, configure TLS, and scale the deployment.
- Connection pooling - Tune database connection pools.
- Health checks - Monitor service health.
- Troubleshooting - Diagnose and fix common issues.
- Architecture - Understand networks, services, and data flows.
What is Plexichat in Docker?
Plexichat runs as a multi-container stack:
- Backend (FastAPI, Python 3.14) - REST API, WebSocket gateway, and business logic.
- Database (PostgreSQL 18) - Stores users, messages, and servers.
- Cache (Valkey 9.1) - Stores sessions, rate-limit state, and WebSocket presence.
- Storage (RustFS 1.0) - Stores media files such as avatars and attachments.
- Frontend (Nginx + Vite) - Serves the web client and terminates TLS.
- Scanner (ClamAV 1.5) - Scans uploads for malware on TCP 3310 (internal).
- Backup (restic) - Creates encrypted, deduplicated snapshots.
All services share a single Docker bridge network (plexichat_default) and include health checks and dependency conditions.
System requirements
- Docker 20.10 or later
- Docker Compose 2.0 or later
- 4 GB RAM minimum, 8 GB recommended
- 10 GB free disk space
- Linux, macOS, or Windows with Docker Desktop
Start the stack
Start in the foreground for development:
docker compose up
Start in the background for self-hosted production:
docker compose up -d
Run backend tests against an isolated database without the full stack. Install
the dev lock first: the runtime image has no test framework, because pytest
and its plugins are test-only dependencies.
pip install --require-hashes -r requirements-dev.txt
NO_STRICT_CONFIG=false python -m pytest
The Compose file (plexichat/docker-compose.yml) does not use --profile flags for core services. A service starts when it is present in docker-compose.yml and its .env variables are set. Optional services (search, AI moderation) use profiles; see docker/README.md.
Check service health
List service status and health:
docker compose ps
All services report healthy when ready. Check logs for a specific service:
docker compose logs -f backend
docker compose logs -f db
Common commands
| Action | Command |
|---|---|
| Start all services | docker compose up |
| Start in background | docker compose up -d |
| View logs | docker compose logs -f <service> |
| Run a command in the backend | docker compose exec backend python main.py self-test |
| Stop all services | docker compose down |
| Remove volumes and delete all data | docker compose down -v |
Access points
Only the following ports are published to the host by default (plexichat/docker-compose.yml, plexichat/docker-compose.yml):
| Service | Host port | Container port | URL | Purpose |
|---|---|---|---|---|
| Frontend (Nginx) | 80 | 80 | http://localhost | Web client (redirects to HTTPS) |
| Frontend (Nginx) | 443 | 443 | https://localhost | Web client with TLS |
| Backend API | 8000 | 8000 | http://localhost:8000 | REST API and docs |
| Backend voice | 30000–30100/UDP | 30000–30100/UDP | — | Voice media (SFU) |
| PostgreSQL | — | 5432 | Internal db:5432 |
Database; access with docker compose exec db psql |
| Valkey | — | 6379 | Internal valkey:6379 |
Cache; access with docker compose exec valkey redis-cli |
| RustFS S3 API | — | 9000 | Internal rustfs:9000 |
S3 API; not published by default |
| RustFS console | — | 9001 | Internal rustfs:9001 |
Console; publish with a ports override if needed |
| ClamAV | — | 3310 | Internal clamav:3310 |
Scanner daemon |
To expose RustFS on the host for direct debugging, add a temporary override:
# docker-compose.override.yml
services:
rustfs:
ports:
- "9000:9000"
- "9001:9001"
Direct backend access:
- REST:
http://localhost:8000/api/v1 - Swagger UI:
http://localhost:8000/docs(orhttps://localhost/docsthrough Nginx) - ReDoc:
http://localhost:8000/redoc - OpenAPI spec:
http://localhost:8000/openapi.json - Readiness probe:
http://localhost:8000/api/v1/ready - Deep health:
http://localhost:8000/api/v1/health - WebSocket gateway:
ws://localhost:8000/gateway(through Nginx:wss://localhost/gateway)
First-time setup
Generate a secure
.envfile with the environment generator and save it as.envinplexichat/. See.env.example:1for all variables.Start the stack:
BACKEND_VERSION=latest CLIENT_VERSION=latest docker compose up -dTo deploy a pinned version:
BACKEND_VERSION=1.0.0a239 CLIENT_VERSION=1.0.0a147 docker compose up -dWait until
docker compose psshowshealthyfordb,valkey,rustfs,clamav,backend, andclient.Open
https://localhost(accept the self-signed certificate on first run) orhttp://localhost:8000/docsfor the API.
For detailed steps, see Quick start.
Startup times
- First build: 2–3 minutes (downloads base images and installs Python 3.14 dependencies from
plexichat/Dockerfile:1). - Subsequent starts: 10–30 seconds.
- Database initialization: 5–10 seconds on first run.
- Backend
healthy(migrations and module initialization): 15–30 seconds.
Security considerations
- Development
.envexamples use placeholder passwords. Do not use them in production. - Production requires strong, unique values for
POSTGRES_PASSWORD,VALKEY_PASSWORD,S3_ACCESS_KEY,S3_SECRET_KEY, andBACKUP_RESTIC_PASSWORD(plexichat/.env.example:17,plexichat/docker-compose.yml). - Self-signed certificates are generated in the
certsvolume on first boot (plexichat/docker-compose.yml). Replace them with Let's Encrypt certificates for production. - All services communicate over the internal
plexichat_defaultnetwork. Onlyclient(80/443) andbackend(8000/TCP, 30000–30100/UDP) publish host ports by default.
See Production setup for hardening steps.
Data persistence
All data lives in named Docker volumes:
postgres_data- PostgreSQL datavalkey_data- Valkey append-only filerustfs_data- Media objectsplexichat_home- Application state at/home/plexichat/.plexichat(config, keyrings, logs)certs- TLS certificatesbackup_repo- Restic repositoryclamav_db- ClamAV signature databasemeilisearch_data,elasticsearch_data- Search indexes (when enabled)
Volumes persist across container restarts. docker compose down -v deletes them.
Networking
plexichat/docker-compose.yml creates a single default bridge network. Services reach each other by service name, for example backend reaches db at db:5432 and valkey at valkey:6379. The client Nginx reaches the API at http://backend:8000 (plexichat-client/docker/nginx/default.conf:53) and load-balances WebSocket connections with ip_hash (plexichat-client/docker/nginx/default.conf:12).
When you scale the backend (docker compose up --scale backend=4), remove the ports mapping on backend (plexichat/docker-compose.yml) and rely on Nginx at :443.
Next steps
- Quick start - Run the stack now.
- Development workflow - Develop with hot reload.
- Production setup - Deploy to production.
If you encounter issues, see Troubleshooting.