Managing listmonk effectively is a crucial skill for any system administrator. This tutorial provides step-by-step instructions for newsletter configuration, along with best practices for production environments.
Prerequisites
- A VPS running Ubuntu 22.04 or later (2GB+ RAM recommended)
- Docker and Docker Compose installed
- Root or sudo access to the server
- Basic familiarity with the Linux command line
- A reverse proxy configured (Nginx or Traefik)
Docker Compose Setup
When scaling this setup, consider vertical scaling (adding more RAM/CPU) first, as it's simpler to implement. Horizontal scaling adds complexity but may be necessary for high-traffic applications.
# docker-compose.yml
version: '3.8'
services:
listmonk:
image: listmonk/listmonk:latest
restart: unless-stopped
ports:
- "8080:8080"
volumes:
- listmonk_data:/data
- listmonk_config:/config
environment:
- TZ=UTC
- PUID=1000
- PGID=1000
depends_on:
- db
db:
image: postgres:16-alpine
restart: unless-stopped
volumes:
- db_data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=listmonk
- POSTGRES_USER=listmonk
- POSTGRES_PASSWORD=changeme
volumes:
listmonk_data:
listmonk_config:
db_data:
These commands should be run as root or with sudo privileges. If you're using a non-root user, prefix each command with sudo.
- Enable firewall and allow only necessary ports
- Keep all software components up to date
- Use SSH keys instead of password authentication
Initial Configuration
When scaling this setup, consider vertical scaling (adding more RAM/CPU) first, as it's simpler to implement. Horizontal scaling adds complexity but may be necessary for high-traffic applications.
# Reverse proxy configuration
server {
listen 443 ssl http2;
server_name listmonk.example.com;
ssl_certificate /etc/letsencrypt/live/listmonk.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/listmonk.example.com/privkey.pem;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
client_max_body_size 0;
}
}
Note that file paths may vary depending on your Linux distribution. The examples here are for Debian/Ubuntu; adjust paths accordingly for RHEL/CentOS-based systems.
Performance Considerations
When scaling this setup, consider vertical scaling (adding more RAM/CPU) first, as it's simpler to implement. Horizontal scaling adds complexity but may be necessary for high-traffic applications.
- Start with the minimum required resources
- Scale vertically before scaling horizontally
- Implement caching at every appropriate layer
- Profile before optimizing - measure first
Conclusion
This guide covered the essential steps for working with listmonk on a VPS environment. For more advanced configurations, refer to the official documentation. Don't hesitate to reach out to our support team if you need help with your specific setup.