thormail/postgres-thormail

By thormail

Updated 2 months ago

PostgreSQL 18 with pg_partman for high-throughput delivery. Optimized for ThorMail.

Image
Databases & storage
0

397

thormail/postgres-thormail repository overview

ThorMail PostgreSQL 18 with pg_partman

Docker Hub Image Size

This image is based on the official postgres:18-alpine and pre-configured with the pg_partman extension and optimized settings for high-throughput delivery processing.

Why PostgreSQL 18?

We have chosen PostgreSQL 18 for this project to leverage its advanced high-performance features, which are critical for a high-volume delivery system like ThorMail:

  • Asynchronous I/O (AIO): A game-changer for I/O-heavy workloads. It allows the database to handle multiple read/write operations concurrently, drastically reducing latency during high-volume delivery bursts.
  • Parallel COPY FROM: Significantly speeds up bulk data ingestion, which represents a massive performance boost when importing large contact lists or logs.
  • Optimized VACUUM: Crucial for our queue system. The new lazy pruning and internal improvements reduce the overhead of cleaning up dead tuples in our highly transactional tables.
  • Native UUIDv7 Support: Provides timestamp-ordered UUIDs natively, improving B-tree index locality and insertion performance compared to random UUIDs.

Quick Start

Pull the image from Docker Hub and run:

docker pull thormail/postgres-thormail:latest

docker run -d \
  --name thormail-postgres \
  -e POSTGRES_PASSWORD=mysecretpassword \
  -e POSTGRES_DB=thormail_db \
  -p 5432:5432 \
  -v postgres_data:/var/lib/postgresql/data \
  thormail/postgres-thormail:latest

Docker Compose

version: '3.8'
services:
  db:
    image: thormail/postgres-thormail:latest
    environment:
      - POSTGRES_USER=thormail
      - POSTGRES_PASSWORD=secret
      - POSTGRES_DB=thormail_db
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "postgres"]
      interval: 30s
      timeout: 5s
      retries: 3

volumes:
  postgres_data:

Features

FeatureDescription
pg_partman 5.2.0Automatic table partitioning for time-series data
Health CheckBuilt-in container health monitoring
Optimized ConfigTuned for high-throughput delivery workloads
Alpine-basedMinimal image size (~108MB)

Data Persistence

To persist your database data (delivery logs, users, etc.) across container restarts, mount a volume to /var/lib/postgresql/data.

Example:

-v /my/local/data:/var/lib/postgresql/data

Environment Variables

This image inherits all functionality from the official Postgres Docker image. You can use standard environment variables for initialization:

VariableRequiredDescription
POSTGRES_PASSWORD✅ YesSets the superuser password
POSTGRES_USERNoSuperuser name (default: postgres)
POSTGRES_DBNoDefault database (recommended: thormail_db)
PGDATANoData directory (default: /var/lib/postgresql/data)

Configuration

The image comes with a custom postgresql.conf located at /etc/postgresql/postgresql.conf which is optimized for:

  • High connection usage (Workers + API)
  • SSD storage
  • Aggressive Autovacuum settings for heavy write workloads (delivery queues)

To override settings, you can mount your own config or pass arguments via command line, but it is recommended to use the provided configuration as a baseline.

More Information

For documentation, support, and more details about the ThorMail ecosystem, visit thormail.io.

License

This image is based on the official PostgreSQL Docker image and pg_partman, both licensed under the PostgreSQL License.

Tag summary

Content type

Image

Digest

sha256:8a9efa808

Size

107.9 MB

Last updated

2 months ago

docker pull thormail/postgres-thormail