Installation
There are several ways to run Rustrak depending on your needs. Pick the one that fits your setup.
Quick install (Docker Compose)
The fastest way to get everything running locally.
1. Create the docker-compose.yml
Create a docker-compose.yml file with the following content:
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 5
restart: unless-stopped
server:
image: abians7/rustrak-server:latest
ports:
- "${SERVER_PORT}:8080"
environment:
- HOST=0.0.0.0
- PORT=8080
- RUST_LOG=${RUST_LOG}
- DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
- SESSION_SECRET_KEY=${SESSION_SECRET_KEY}
- CREATE_SUPERUSER=${CREATE_SUPERUSER}
depends_on:
postgres:
condition: service_healthy
restart: unless-stopped
ui:
image: abians7/rustrak-ui:latest
ports:
- "${UI_PORT}:3000"
environment:
- RUSTRAK_API_URL=${RUSTRAK_API_URL}
depends_on:
- server
restart: unless-stopped
volumes:
postgres_data:What each service does:
| Service | Description |
|---|---|
postgres | PostgreSQL 16 database with persistent storage. Includes a healthcheck to ensure it’s ready before the server starts. |
server | The Rustrak API server (Rust/Actix-web). Handles event ingestion and API requests. Uses ~50MB RAM. |
ui | The Rustrak dashboard (Next.js). |
2. Configure environment variables
Create a .env file with all required configuration:
# ===================
# Database (PostgreSQL)
# ===================
POSTGRES_USER=rustrak
POSTGRES_PASSWORD=rustrak
POSTGRES_DB=rustrak
# ===================
# Server
# ===================
SERVER_PORT=8080
RUST_LOG=info
# Session secret (required) - generate with: openssl rand -hex 32
SESSION_SECRET_KEY=your-64-char-hex-secret-here
# Admin user (required) - format: email:password
CREATE_SUPERUSER=admin@example.com:changeme123
# ===================
# Dashboard
# ===================
UI_PORT=3000
RUSTRAK_API_URL=http://server:8080To generate a secure session secret:
openssl rand -hex 323. Start Rustrak
docker compose up -dThis starts:
- PostgreSQL on port 5432
- Rustrak Server on port 8080
- Rustrak Dashboard on port 3000
Open http://localhost:3000 and log in with the credentials you set in CREATE_SUPERUSER.
Server only (recommended for production)
For production, you often want minimal resource usage on your server. Run only the Rustrak server and access the dashboard from your laptop or deploy it separately on Vercel.
On your server
# Pull and run just the server
docker run -d \
--name rustrak \
-p 8080:8080 \
-e DATABASE_URL="postgres://user:pass@db-host:5432/rustrak" \
-e SESSION_SECRET_KEY="$(openssl rand -hex 32)" \
-e CREATE_SUPERUSER="admin@example.com:changeme123" \
abians7/rustrak-server:latestThe server uses ~50MB RAM and handles all error ingestion and API requests.
Access the dashboard
Option A: Self-host the dashboard
docker run -d \
--name rustrak-ui \
-p 3000:3000 \
-e RUSTRAK_API_URL="https://your-server.com" \
abians7/rustrak-ui:latestOption B: Deploy to Vercel (free)
Set RUSTRAK_API_URL to your server URL in Vercel’s environment variables.
User management
First admin user
The admin user is created automatically on first startup using the CREATE_SUPERUSER environment variable:
# In your .env file
CREATE_SUPERUSER=admin@example.com:yourpasswordThe format is email:password. This only creates the user if no users exist in the database yet.
Verify the installation
- Open the dashboard (localhost:3000 or your Vercel URL)
- Log in with your admin credentials
- You should see an empty project list
You’re ready to capture your first error.
Resource comparison
| Setup | Server RAM | Server CPU | Notes |
|---|---|---|---|
| Full stack | ~200MB | Low | Easiest setup |
| Server only | ~50MB | Minimal | Dashboard runs elsewhere |
| Server only + Vercel | ~50MB | Minimal | Zero dashboard overhead |
For a 512MB VPS, the server-only option leaves plenty of room for your application and database.