| .gitignore | ||
| backup.sh | ||
| check_ssl.sh | ||
| compose.override.yml | ||
| compose.yml | ||
| Dockerfile | ||
| example.env | ||
| README.md | ||
| setup.sh | ||
pretix Docker Compose Setup
This repository contains a Docker Compose setup for running pretix - an open-source event ticketing platform. This setup is based on the official pretix Docker documentation but uses Docker Compose for easier management.
Architecture
This setup runs pretix with the following components:
- pretix: Main application (custom built with plugins)
- PostgreSQL: Database server for data persistence
- Redis: Caching and message broker for background tasks
All data and configuration are persisted through Docker volumes. This setup is designed to run behind a reverse proxy (nginx setup is separate).
Prerequisites
- Docker and Docker Compose installed
- A SMTP server for sending emails
- Reverse proxy setup (nginx) for SSL termination and domain routing
- Firewall configured (recommended)
Quick Start
-
Clone or download this repository
git clone <repository-url> cd pretix-docker -
Create environment file
cp example.env .env -
Configure environment variables
# Edit .env with your values PRETIX_VERSION=2025.7 POSTGRES_DB=pretix POSTGRES_USER=pretix POSTGRES_PASSWORD=my_secret_password -
Run the setup script
# This will create necessary directories and networks ./setup.sh -
Start the services
docker compose up -d --buildDocker Compose automatically applies
compose.override.yml. This attaches thepretixservice to the externalreverse-proxynetwork (and avoids exposing direct ports). -
Access pretix
- Control interface: https://yourdomain.com/control/
- Default login:
admin@localhost/admin - Important: Change the default password immediately!
Configuration
Compose Override
This project includes a compose.override.yml that Docker Compose loads automatically.
It connects the pretix service to the external reverse-proxy network for access via
the nginx reverse proxy.
- Ensure the
reverse-proxynetwork exists (usually created by the nginx setup). - Prefer defining network membership in your Compose files over manual
docker network connectcommands.
Environment Variables
| Variable | Description | Example |
|---|---|---|
PRETIX_VERSION |
pretix version to use | 2025.7 |
POSTGRES_DB |
PostgreSQL database name | pretix |
POSTGRES_USER |
PostgreSQL username | pretix |
POSTGRES_PASSWORD |
PostgreSQL password | my_secret_password |
Volume Mappings
| Host Path | Container Path | Purpose |
|---|---|---|
./pretix-data |
/var/pretix/data |
pretix data files |
./pretix-config |
/etc/pretix |
pretix configuration |
./pgdata |
/var/lib/postgresql/data |
PostgreSQL data |
Services
pretix
- Image: Custom built from
pretix/standalone:${PRETIX_VERSION} - Plugins: Includes
pretix-passbookplugin - Features: Web interface, API, background tasks
- Access: Through reverse proxy network
- Network: Connected to
reverse-proxynetwork for external access
PostgreSQL
- Image:
postgres:13 - Purpose: Primary database for all pretix data
- Persistence: Data stored in
./pgdatavolume - Security: Password-protected, internal network only
Redis
- Image:
redis:alpine - Purpose: Caching and message broker for Celery tasks
- Features: Session storage, background job queue
- Persistence: In-memory with optional persistence
Network Configuration
Docker Networks
The setup uses the reverse-proxy network to communicate with the nginx reverse proxy:
# Create network if not exists (usually done by nginx setup)
docker network create reverse-proxy
# Connect pretix to the network
docker network connect reverse-proxy pretix
Note: Using compose.override.yml, pretix is already attached to reverse-proxy.
Defining the network under services.pretix.networks in Compose keeps the configuration
persistent across restarts.
Reverse Proxy Integration
This pretix setup is designed to work with a separate nginx reverse proxy that:
- Handles SSL termination
- Routes traffic based on domain names
- Provides PROXY protocol support
- Manages client IP forwarding
Customization
Adding Plugins
-
Edit the Dockerfile:
FROM pretix/standalone:${PRETIX_VERSION} USER root RUN pip3 install pretix-passbook pretix-your-plugin USER pretixuser RUN cd /pretix/src && make production -
Rebuild the container:
docker compose build
pretix Configuration
Create ./pretix-config/pretix.cfg:
[pretix]
instance_name=My pretix installation
url=https://yourdomain.com
currency=EUR
datadir=/var/pretix/data
trust_x_forwarded_for=on
trust_x_forwarded_proto=on
[database]
backend=postgresql
name=pretix
user=pretix
password=my_secret_password
host=pretix-db
[mail]
from=tickets@yourdomain.com
host=your-smtp-server.com
port=587
username=your-username
password=your-password
use_tls=True
[redis]
location=redis://pretix-redis:6379/0
sessions=true
[celery]
backend=redis://pretix-redis:6379/1
broker=redis://pretix-redis:6379/2
Maintenance
Updates
-
Edit version in
.env:PRETIX_VERSION=2025.8 -
Rebuild and restart:
docker compose down docker compose up -d --build -
Run database migrations:
docker compose exec -it pretix pretix upgrade
Backups
Backups are handled by a cron job that runs the provided backup.sh script as root at
the beginning of every month. No logging/output is stored.
- Ensure the script is executable:
chmod +x /srv/pretix/backup.sh
- Install the cron entry for
root:
# Run at 00:00 on the 1st day of every month, discard all output
0 0 1 * * /srv/pretix/backup.sh >/dev/null 2>&1
The script creates a PostgreSQL dump, compresses it, saves it to /srv/pretix/backup/,
and copies the current pretix.cfg alongside it. Old archives are pruned based on the
retention configured in backup.sh.
Database Access
# From container
docker compose exec -it pretix-db psql -U pretix -d pretix
Logs
# All services
docker compose logs -f
# Specific service
docker compose logs -f pretix
Cron Jobs
# Add to crontab
15,45 * * * * /usr/bin/docker exec pretix-pretix-1 pretix cron
Testing
Test your pretix installation:
# Check if pretix is responding
docker compose exec pretix curl -I http://localhost
# Check database connection
docker compose exec pretix-db pg_isready -U pretix
# Check Redis connection
docker compose exec pretix-redis redis-cli ping
Debugging
# Check service status
docker compose ps
# View pretix logs
docker compose logs pretix
# Check network connectivity
docker compose exec pretix ping pretix-db
docker compose exec pretix ping pretix-redis
Integration with Reverse Proxy
Requirements for Reverse Proxy
Your reverse proxy (nginx) should:
- Be on the same
reverse-proxynetwork - Route traffic to
pretix:80 - Handle SSL termination
- Forward proper headers (X-Forwarded-For, X-Forwarded-Proto, etc.)
- Support PROXY protocol if behind a load balancer
Example nginx configuration
server {
listen 443 ssl proxy_protocol;
server_name yourdomain.com;
location / {
proxy_pass http://pretix:80;
proxy_set_header X-Real-IP $proxy_protocol_addr;
proxy_set_header X-Forwarded-For $proxy_protocol_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $http_host;
}
}
Support
License
This setup is provided as-is. pretix itself is licensed under the Apache License 2.0.