Self-hosting guide
Run Publistic on your own infrastructure. Full control over your data, unlimited pageviews, unlimited sites. Free forever.
Requirements
- Docker and Docker Compose installed on your server
- 4GB+ RAM minimum (ClickHouse needs memory for analytical queries)
- 50GB disk minimum (analytics data grows over time; plan accordingly for your traffic volume)
- A domain name pointed at your server (for SSL via Caddy)
Installation
-
Clone the repository
git clone https://github.com/nicholasgriffintn/publistic.git cd publistic -
Copy the environment file
Editcp .env.example .env.envand set your domain, database passwords, and JWT secret. -
Start all services
This starts all services in the background.docker compose up -d -
Initialize the ClickHouse tables
This creates the analytics tables. Only needed on first run.docker compose exec clickhouse clickhouse-client \ --multiquery < clickhouse/init.sql -
Register your first user
Openhttps://your-domain.com/registerin your browser and create your account.
Architecture
Publistic runs as a set of Docker containers managed by Docker Compose:
Configuration
All configuration is done through environment variables in the .env file. Key settings:
# Your domain (used by Caddy for SSL)
DOMAIN=analytics.yoursite.com
# Database passwords
POSTGRES_PASSWORD=your-secure-password
CLICKHOUSE_PASSWORD=your-secure-password
# JWT secret for authentication
JWT_SECRET=your-random-secret-string
# Optional: GeoIP database path
GEOIP_DB=/data/GeoLite2-City.mmdb
Updating
To update to the latest version:
git pull
docker compose pull
docker compose up -d
ClickHouse migrations are applied automatically on startup when needed.
Backups
Back up both databases regularly:
- PostgreSQL — standard
pg_dumpfor account data - ClickHouse — use ClickHouse's built-in backup functionality or snapshot the data directory
Troubleshooting
Services not starting
Check container logs to identify the issue:
docker compose logs -f
ClickHouse out of memory
ClickHouse needs memory for analytical queries. If you see OOM errors, increase the server's RAM or adjust ClickHouse's memory limits in the Docker Compose configuration.
SSL certificate issues
Make sure your domain's DNS A record points to the server's IP address. Caddy needs to be reachable on ports 80 and 443 for certificate provisioning. Check Caddy logs if certificates aren't being issued.