In this article, we'll walk through the complete process of working with plausible in a server environment. Understanding analytics is essential for maintaining a reliable and performant infrastructure.
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
The plausible configuration requires careful attention to resource limits and security settings. On a VPS with limited resources, it's important to tune these parameters according to your available RAM and CPU cores.
# docker-compose.yml
version: '3.8'
services:
plausible:
image: plausible/plausible:latest
restart: unless-stopped
ports:
- "8080:8080"
volumes:
- plausible_data:/data
- plausible_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=plausible
- POSTGRES_USER=plausible
- POSTGRES_PASSWORD=changeme
volumes:
plausible_data:
plausible_config:
db_data:
This configuration provides a good balance between performance and resource usage. For high-traffic scenarios, you may need to increase the limits further.
Initial Configuration
For production deployments, consider implementing high availability by running multiple instances behind a load balancer. This approach provides both redundancy and improved performance under heavy load.
# Reverse proxy configuration
server {
listen 443 ssl http2;
server_name plausible.example.com;
ssl_certificate /etc/letsencrypt/live/plausible.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/plausible.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;
}
}
This configuration provides a good balance between performance and resource usage. For high-traffic scenarios, you may need to increase the limits further.
Performance Considerations
Performance benchmarks show that properly tuned plausible can handle significantly more concurrent connections than the default configuration. The key improvements come from adjusting worker processes and connection pooling.
Reverse Proxy Integration
The default configuration works well for development environments, but production servers require additional tuning. Pay particular attention to connection limits, timeout values, and logging settings.
# docker-compose.yml
version: '3.8'
services:
plausible:
image: plausible/plausible:latest
restart: unless-stopped
ports:
- "8080:8080"
volumes:
- plausible_data:/data
- plausible_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=plausible
- POSTGRES_USER=plausible
- POSTGRES_PASSWORD=changeme
volumes:
plausible_data:
plausible_config:
db_data:
This configuration provides a good balance between performance and resource usage. For high-traffic scenarios, you may need to increase the limits further.
Configuration Options
Performance benchmarks show that properly tuned plausible can handle significantly more concurrent connections than the default configuration. The key improvements come from adjusting worker processes and connection pooling.
Common Issues and Solutions
- Slow performance: Check for disk I/O bottlenecks with
iostat -x 1and network issues withmtr. Review application logs for slow queries or requests. - High memory usage: Review the configuration for memory-related settings. Reduce worker counts or buffer sizes if running on a low-RAM VPS.
- Service won't start: Check the logs with
journalctl -xe -u plausible. Common causes include port conflicts, missing configuration files, or insufficient permissions.
Wrapping Up
Following this guide, your plausible setup should be production-ready. Keep an eye on resource usage as your traffic grows and don't forget to test your backup and recovery procedures periodically.