Skip to content

Deploying a Pretix App

Introduction

Pretix is an open-source ticketing and event management platform with payments, seating, and scanning support. Deploying Pretix with a Dockerfile on Klutch.sh gives you reproducible builds, managed secrets, and persistent storage—all configured from klutch.sh/app. This guide covers installation, Dockerfile setup, environment variables, storage, Nixpacks overrides, and sample requests to verify your instance.


Prerequisites

  • A Klutch.sh account (sign up)
  • A GitHub repository containing your Pretix Dockerfile (GitHub is the only supported git source)
  • External PostgreSQL database and Redis
  • Domain and TLS for attendee-facing flows

For onboarding, see the Quick Start.


Architecture and ports

  • Pretix serves HTTP on internal port 80 in the standalone image. Choose HTTP traffic and set the internal port to 80.
  • Persistent storage is required for uploaded media, invoices, and configuration; databases live in Postgres, caching in Redis.

Repository layout

pretix/
├── Dockerfile # Must be at repo root for auto-detection
└── README.md

Keep secrets out of Git; store them in Klutch.sh environment variables.


Installation (local) and starter commands

Build and run locally (ensure Postgres/Redis are reachable):

Terminal window
docker build -t pretix-local .
docker run -p 8080:80 \
-e DATABASE_URL=postgres://user:pass@localhost:5432/pretix \
-e REDIS_URL=redis://localhost:6379/0 \
-e SECRET_KEY=$(openssl rand -hex 32) \
pretix-local

Dockerfile for Pretix (production-ready)

Place this at the repo root; Klutch.sh auto-detects Dockerfiles.

FROM pretix/standalone:stable
ENV PRETIX_DISABLE_LOCAL_CDN=true
ENV PRETIX_LANGUAGE=en
ENV PRETIX_COUNTRY=US
ENV PRETIX_TIMEZONE=UTC
EXPOSE 80
CMD ["/entrypoint.sh"]

Notes:

  • Pin to a specific tag (e.g., pretix/standalone:4.19.0) for predictable upgrades.
  • /entrypoint.sh starts Pretix on port 80 inside the container.

Environment variables (Klutch.sh)

Configure these before deploying:

  • PORT=80
  • DATABASE_URL=postgres://<user>:<password>@<host>:5432/<db>
  • REDIS_URL=redis://<host>:6379/0
  • SECRET_KEY=<secure-random-hex>
  • PRETIX_LANGUAGE=en
  • PRETIX_COUNTRY=US
  • PRETIX_TIMEZONE=UTC
  • Optional email settings: MAIL_FROM, SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASSWORD, SMTP_TLS=true

If deploying without the Dockerfile and relying on Nixpacks:

  • NIXPACKS_START_CMD=/entrypoint.sh

Attach persistent volumes

Add storage in Klutch.sh (path and size only):

  • /data — media, invoices, and generated files.
  • /etc/pretix — configuration overrides (if you mount custom settings).

Ensure the paths are writable inside the container.


Deploy Pretix on Klutch.sh (Dockerfile workflow)

  1. Push your repository—with the Dockerfile at the root—to GitHub.
  2. Open klutch.sh/app, create a project, and add an app.
  3. Select HTTP traffic and set the internal port to 80.
  4. Add the environment variables above (database, Redis, secret key, locale, and email settings).
  5. Attach volumes at /data and /etc/pretix sized for your media and configuration needs.
  6. Deploy. Access your app at https://example-app.klutch.sh and complete the Pretix setup wizard.

Sample checks

Landing/health check:

Terminal window
curl -I https://example-app.klutch.sh

If you expose an API endpoint (replace as needed):

Terminal window
curl -I https://example-app.klutch.sh/api/v1/health

Health checks and production tips

  • Add an HTTP readiness probe to / (or your health endpoint) to confirm the app is serving.
  • Keep SECRET_KEY, DB, Redis, and SMTP credentials in Klutch.sh secrets; rotate them regularly.
  • Enforce HTTPS at the edge; back up your Postgres database and export /data for disaster recovery.
  • Pin image tags and test upgrades in staging before production rollout.
  • Monitor volume usage on /data and /etc/pretix; resize proactively.

Pretix on Klutch.sh gives you reproducible Docker builds, managed secrets, and persistent storage—without extra YAML or CI steps. Configure ports, env vars, and storage, then launch your ticketing platform.