Skip to content

Python-Nairobi/pretalx_deployment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pretalx Deployment

Pretalx Production Deployment (Custom Docker Hybrid)

This repository contains the configuration files to deploy Pretalx, a conference management system, in a highly secure, production-ready environment.

Unlike the community pretalx-docker repository, this setup uses a custom Dockerfile that pulls the official, Pretalx-supported release directly from PyPI, while still utilizing Docker Compose to seamlessly orchestrate the database, Redis cache, and Celery background workers.

Features

  • Official Source: Installs Pretalx via pip, adhering strictly to official release channels.
  • Secure Secrets: Uses a .env file to manage database credentials securely.
  • High Performance: Configured for an Nginx reverse proxy on the host machine to serve static assets and media files directly from disk, bypassing the Python application for maximum speed.
  • Automated SSL: Ready for Let's Encrypt (Certbot) integration.
  • IPv4 DNS Priority: Includes a custom gai.conf to ensure reliable SMTP outbound connections on VPS environments lacking IPv6 NAT.

Prerequisites

Before deploying, ensure your VPS (Ubuntu/Debian recommended) meets the following requirements:

  • Root or Sudo access.
  • Domain Name: An A Record pointing to your server's public IP (e.g., cfp.yourdomain.com).
  • SMTP Credentials: An email provider (Google Workspace, SendGrid, Mailgun, etc.) to send speaker notifications and password resets.

1. System Preparation

Log into your VPS and install the necessary system dependencies (Docker, Nginx, and Certbot).

# Update system
sudo apt update && sudo apt upgrade -y

# Install Nginx and Certbot
sudo apt install nginx certbot python3-certbot-nginx -y

# Install Docker
curl -fsSL [https://get.docker.com](https://get.docker.com) -o get-docker.sh
sudo sh get-docker.sh

# Add your user to the Docker group
sudo usermod -aG docker $USER
newgrp docker

2. Clone & Configure

Clone this repository to your server:

git clone [https://github.com/YOUR_USERNAME/YOUR_REPO_NAME.git](https://github.com/YOUR_USERNAME/YOUR_REPO_NAME.git) ~/pretalx-production
cd ~/pretalx-production

A. Environment Variables (.env)

Never commit your actual credentials to Git. Create a .env file based on the provided template (if applicable) or create a new one:

nano .env

Add your sensitive configuration:

# .env
DB_PASSWORD=generate_a_very_strong_password_here
POSTGRES_PASSWORD=generate_a_very_strong_password_here
PRETALX_DATABASE_PASSWORD=generate_a_very_strong_password_here

B. Pretalx Configuration (pretalx.cfg)

Create and edit the configuration file to match your environment, including your SMTP credentials.

nano pretalx.cfg

Ensure you update the url and from email address:

[site]
url = [https://cfp.yourdomain.com](https://cfp.yourdomain.com)

[mail]
from = cfp@yourdomain.com

3. Build and Deploy

With your configuration in place, build the custom Docker image and start the stack. This will automatically download the latest Pretalx release from PyPI, compile frontend assets, and run database migrations.

docker compose up -d --build

Verify that the containers are running healthy:

docker compose ps

4. System Initialization

Once the application is running, you must create your administrator account and initial organizer profile. Execute the initialization command inside the running web container:

docker compose exec web python -m pretalx init

Follow the interactive prompts in your terminal.

5. Nginx Reverse Proxy & SSL

To serve files efficiently and secure your site with HTTPS, configure Nginx.

A. Find Your Volume Mountpoint

First, locate exactly where Docker is storing your pretalx-data volume on the host machine:

docker volume inspect pretalx-production_pretalx-data

Copy the path listed under "Mountpoint" (e.g., /var/lib/docker/volumes/pretalx-production_pretalx-data/_data).

B. Configure Nginx

Create a new Nginx server block:

sudo nano /etc/nginx/sites-available/pretalx

Paste your Nginx configuration (refer to the nginx.conf.example in this repo if provided). Crucially: update the /media/ and /static/ alias paths to match the Mountpoint you found in the previous step.

Enable the site and restart Nginx:

sudo ln -s /etc/nginx/sites-available/pretalx /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx

C. Enable HTTPS (Let's Encrypt)

Run Certbot to secure your domain:

sudo certbot --nginx -d cfp.yourdomain.com

6. Background Tasks (Cron Job)

Pretalx requires a periodic trigger to process queued emails, scheduled exports, and other background tasks.

Open the crontab on your host machine:

crontab -e

Add the following line to run the trigger every 15 and 45 minutes past the hour:

15,45 * * * * cd /home/YOUR_USERNAME/pretalx-production && docker compose exec -T web python -m pretalx runperiodic > /dev/null 2>&1

Maintenance & Operations

Updating Pretalx

Because this setup uses the official PyPI package, updating is incredibly simple. Rebuilding the Docker image without cache will pull the latest version, and the startup command automatically handles database migrations.

cd ~/pretalx-production
docker compose build --no-cache web celery
docker compose up -d

Backups

Ensure you are regularly backing up the following Docker volumes:

  1. Database: pretalx-production_pretalx-db (Contains all text data, schedules, and user info).

  2. Media: pretalx-production_pretalx-data(Contains user-uploaded slides, avatars, and static files).

To take a manual database dump:

docker compose exec -T db pg_dump -U pretalx pretalx > pretalx_backup_$(date +%F).sql

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors