Manual Docker Compose Setup
This guide is for users who want to manually set up Rybbit using Docker Compose without the setup script. This is useful if you already have a reverse proxy setup (like Nginx, Traefik, or Coolify), or if you want more control over the configuration.
Prerequisites
- Docker and Docker Compose installed
- A domain name pointed to your server
- Basic knowledge of Docker and environment variables
Setup Steps
Clone the Repository
git clone https://github.com/rybbit-io/rybbit.git
cd rybbit
Create Environment File
Create a .env
file in the root directory with the following content:
# Required: Your domain and base URL
DOMAIN_NAME=your.domain.com
BASE_URL=https://your.domain.com
# Required: Authentication secret (generate a random 32+ character string)
BETTER_AUTH_SECRET=your-very-long-random-secret-string-here
# Optional: Disable new user signups after creating admin account
DISABLE_SIGNUP=false
# Optional: Custom ports (only needed if you want different ports)
# HOST_BACKEND_PORT="3001:3001"
# HOST_CLIENT_PORT="3002:3002"
# Optional: Database credentials (defaults work fine)
# CLICKHOUSE_PASSWORD=frog
# POSTGRES_USER=frog
# POSTGRES_PASSWORD=frog
# POSTGRES_DB=analytics
# CLICKHOUSE_DB=analytics
To generate a secure BETTER_AUTH_SECRET
, you can use:
openssl rand -hex 32
Choose Your Setup Method
Built-in Caddy (Automatic SSL)
If you don’t have a reverse proxy and want automatic SSL certificates, use the default docker-compose.yml:
docker compose up -d
This will:
- Start all services including Caddy
- Automatically obtain SSL certificates
- Make your app available at
https://your.domain.com
Configure Your Reverse Proxy
If you’re using your own reverse proxy, configure it to:
- Proxy requests to
/api/*
tohttp://localhost:3001
- Proxy all other requests to
http://localhost:3002
Example configurations:
Nginx
server {
listen 80;
server_name your.domain.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name your.domain.com;
# Your SSL configuration here
location /api/ {
proxy_pass http://localhost:3001;
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;
}
location / {
proxy_pass http://localhost:3002;
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;
}
}
Start the Services
# Start all services
docker compose up -d
# Or start specific services (without Caddy)
docker compose up -d backend client clickhouse postgres
Verify Setup
Check that all services are running:
docker compose ps
Monitor logs:
docker compose logs -f
Create Admin Account
Navigate to https://your.domain.com/signup
and create your admin account.
Service Architecture
Rybbit consists of these services:
- client: Next.js frontend (port 3002)
- backend: Node.js API server (port 3001)
- postgres: User data and configuration
- clickhouse: Analytics data storage
- caddy: Reverse proxy with automatic SSL (optional)
Common Configurations
Using Custom Ports
If you need different host ports (e.g., if 3001/3002 are already in use):
HOST_BACKEND_PORT="8080:3001"
HOST_CLIENT_PORT="8081:3002"
Using with Coolify
In Coolify, you can:
- Create a new service with the docker-compose.yml
- Set the environment variables in Coolify’s interface
- Use Coolify’s built-in proxy by exposing ports 3001 and 3002
Using with Nginx Proxy Manager
-
Set up port exposure in your .env:
HOST_BACKEND_PORT="3001:3001" HOST_CLIENT_PORT="3002:3002"
-
Create a proxy host pointing to your server IP:3002
-
Add a custom location
/api/*
pointing to your server IP:3001
Database Persistence
Data is automatically persisted in Docker volumes:
rybbit_clickhouse-data
: Analytics datarybbit_postgres-data
: User accounts and site configurations
Advanced Configurations
For specific reverse proxy setups, see our detailed guides:
- Custom Nginx Setup - Complete Nginx configuration with SSL
- Nginx Proxy Manager - NPM setup without port exposure
These guides provide step-by-step instructions for integrating Rybbit with your existing infrastructure.
Troubleshooting
Services won’t start
# Check logs
docker compose logs
# Check service status
docker compose ps
Port conflicts
If you get port binding errors, either:
- Change the host ports in your .env file
- Stop the conflicting service
- Use docker-compose.override.yml to customize ports
Database connection issues
Ensure the database services are healthy:
docker compose ps
Both postgres and clickhouse should show “healthy” status.
For more advanced configurations and setup script options, see our Advanced Self-Hosting Guide.