Skip to content

armgit / posta

Public Imported from GitHub
0

Self-hosted email delivery platform that enables applications to send emails via HTTP APIs while handling SMTP delivery, templates, storage, security, and analytics. Fully self-hostable alternative to services like SendGrid or Mailgun.

2.0 KB
Raw Blame
# Posta Deployment (Single container Worker Setup)
# ==================================================
# This configuration runs Posta with the embedded worker enabled.
# The email processing worker runs inside the main Posta server process,
# so no separate worker container is required. This setup is ideal for
# simple deployments, development environments, or small installations.

services:
  posta:
    image: jkaninda/posta:latest
    ports:
      - "9000:9000"
    environment:
      POSTA_DB_HOST: posta-db
      POSTA_DB_NAME: posta
      POSTA_DB_USER: posta
      POSTA_DB_PASSWORD: posta
      POSTA_DB_PORT: 5432
      POSTA_DB_SSL_MODE: disable
      POSTA_REDIS_ADDR: "posta-redis:6379"
      # Both are required: compose refuses to start until they are set, and the
      # server rejects placeholder or too-short values in production anyway.
      POSTA_JWT_SECRET: "${POSTA_JWT_SECRET:?required, min 32 chars, generate with openssl rand -hex 32}"
      POSTA_ADMIN_EMAIL: "[email protected]"
      POSTA_ADMIN_PASSWORD: "${POSTA_ADMIN_PASSWORD:?required, min 12 chars, sets the initial admin password}"
      POSTA_EMBEDDED_WORKER: "true"
    healthcheck:
      test: ["CMD", "wget", "-qO-", "http://localhost:9000/healthz"]
      interval: 30s
      timeout: 5s
      start_period: 10s
      retries: 3
    depends_on:
      posta-db:
        condition: service_healthy
      posta-redis:
        condition: service_healthy
    restart: unless-stopped

  posta-db:
    image: postgres:17-alpine
    environment:
      POSTGRES_USER: posta
      POSTGRES_PASSWORD: posta
      POSTGRES_DB: posta
    volumes:
      - db_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U posta"]
      interval: 5s
      timeout: 5s
      retries: 5

  posta-redis:
    image: redis:7-alpine
    volumes:
      - redis_data:/data
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 5s
      timeout: 5s
      retries: 5

volumes:
  db_data:
  redis_data: