Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Add advanced self-hosting documentation and update metadata

Bill Yang20dd1e3062cf
diff --git a/docs/src/content/_meta.js b/docs/src/content/_meta.js
index b76edb4e4..96734f505 100644
--- a/docs/src/content/_meta.js
+++ b/docs/src/content/_meta.js
@@ -12,6 +12,7 @@ export default {
title: "Self-hosting",
},
"self-hosting": "",
+ "self-hosting-advanced": "",
_5: {
type: "separator",
title: "Settings",
diff --git a/docs/src/content/self-hosting-advanced.mdx b/docs/src/content/self-hosting-advanced.mdx
new file mode 100644
index 000000000..b3f90ad15
--- /dev/null
+++ b/docs/src/content/self-hosting-advanced.mdx
@@ -0,0 +1,82 @@
+import { Callout } from 'nextra/components'
+
+# Advanced
+
+This guide covers advanced configuration options for self-hosting Rybbit.
+
+## Setup Script Options
+
+The setup script supports several options:
+
+```bash
+./setup.sh <domain_name> [options]
+```
+
+Available options:
+- `--no-webserver`: Disable the built-in Caddy webserver
+- `--backend-port <port>`: Set custom host port for backend (default: 3001)
+- `--client-port <port>`: Set custom host port for client (default: 3002)
+- `--help`: Show help message
+
+Examples:
+```bash
+# Custom ports with built-in webserver
+./setup.sh tracking.example.com --backend-port 8080 --client-port 8081
+
+# Custom ports with your own webserver
+./setup.sh tracking.example.com --no-webserver --backend-port 8080 --client-port 8081
+```
+
+<Callout type="info">
+ When you specify custom ports, only the host port mapping changes. Inside the Docker containers, the services still use ports 3001 and 3002.
+</Callout>
+
+## Using Your Own Web Server
+
+If you prefer to use your own web server (such as Nginx or Apache) instead of the built-in Caddy server, you can use the `--no-webserver` flag:
+
+```bash
+./setup.sh your.domain.name --no-webserver
+```
+
+This will:
+- Not start the Caddy container
+- Expose the backend service on host port 3001 (or your custom port)
+- Expose the client service on host port 3002 (or your custom port)
+
+You'll need to configure your web server to proxy requests to these services. Here's an example Nginx configuration:
+
+```nginx
+server {
+ listen 80;
+ server_name your.domain.name;
+ return 301 https://$host$request_uri;
+}
+
+server {
+ listen 443 ssl;
+ server_name your.domain.name;
+
+ # SSL configuration (using Let's Encrypt)
+ ssl_certificate /etc/letsencrypt/live/your.domain.name/fullchain.pem;
+ ssl_certificate_key /etc/letsencrypt/live/your.domain.name/privkey.pem;
+
+ # API requests - adjust port if you customized it
+ location /api/ {
+ proxy_pass http://localhost:3001; # or your custom port
+ 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;
+ }
+
+ # Client app - adjust port if you customized it
+ location / {
+ proxy_pass http://localhost:3002; # or your custom port
+ 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;
+ }
+}
+```
diff --git a/docs/src/content/self-hosting.mdx b/docs/src/content/self-hosting.mdx
index c4ba6694a..eca32f6e7 100644
--- a/docs/src/content/self-hosting.mdx
+++ b/docs/src/content/self-hosting.mdx
@@ -9,7 +9,10 @@ This guide will walk you through setting up your own instance of Rybbit.
Before you begin, ensure you have the following:
-- **A Linux VPS:** We use [Hetzner Cloud](https://hetzner.cloud/?ref=QEdVqVpTLBDP) for everything (referral link - but Hetzner is legitimately the best value). CX11 for ~$4/month will be fine for small-medium sized projects. we recommend choosing a VPS with at least 2GB of RAM.
+- **A Linux VPS:** Try to get one with at least 2GB of RAM.
+
+ We use Hetzner for everything. [Use our referral link](https://hetzner.cloud/?ref=QEdVqVpTLBDP) to get a 20 dollars of credits. It should last you almost half a year. The AMD CX11 is a good choice for ~$4/month.
+
- **A Domain Name:** You'll need a domain or subdomain (e.g., `tracking.yourdomain.com`) pointed to your VPS's IP address. HTTPS is required because browsers block tracking scripts served over insecure HTTP.
- **Git:** Needed to clone the repository.
@@ -66,83 +69,10 @@ Run the setup script, replacing `your.domain.name` with the domain or subdomain
The script will create a `.env` file and then build and start the containers. This might take a few minutes the first time.
-#### Setup Script Options
-
-The setup script supports several options:
-
-```bash
-./setup.sh <domain_name> [options]
-```
-
-Available options:
-- `--no-webserver`: Disable the built-in Caddy webserver
-- `--backend-port <port>`: Set custom host port for backend (default: 3001)
-- `--client-port <port>`: Set custom host port for client (default: 3002)
-- `--help`: Show help message
-
-Examples:
-```bash
-# Custom ports with built-in webserver
-./setup.sh tracking.example.com --backend-port 8080 --client-port 8081
-
-# Custom ports with your own webserver
-./setup.sh tracking.example.com --no-webserver --backend-port 8080 --client-port 8081
-```
-
<Callout type="info">
- When you specify custom ports, only the host port mapping changes. Inside the Docker containers, the services still use ports 3001 and 3002.
+ By default, we assume you are on a blank VPS and automatically setup a Caddy webserver. If you want to use your own webserver, checkout the [Advanced Self-Hosting Guide](/docs/self-hosting-advanced#using-your-own-web-server).
</Callout>
-#### Using Your Own Web Server
-
-If you prefer to use your own web server (such as Nginx or Apache) instead of the built-in Caddy server, you can use the `--no-webserver` flag:
-
-```bash
-./setup.sh your.domain.name --no-webserver
-```
-
-This will:
-- Not start the Caddy container
-- Expose the backend service on host port 3001 (or your custom port)
-- Expose the client service on host port 3002 (or your custom port)
-
-You'll need to configure your web server to proxy requests to these services. Here's an example Nginx configuration:
-
-```nginx
-server {
- listen 80;
- server_name your.domain.name;
- return 301 https://$host$request_uri;
-}
-
-server {
- listen 443 ssl;
- server_name your.domain.name;
-
- # SSL configuration (using Let's Encrypt)
- ssl_certificate /etc/letsencrypt/live/your.domain.name/fullchain.pem;
- ssl_certificate_key /etc/letsencrypt/live/your.domain.name/privkey.pem;
-
- # API requests - adjust port if you customized it
- location /api/ {
- proxy_pass http://localhost:3001; # or your custom port
- 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;
- }
-
- # Client app - adjust port if you customized it
- location / {
- proxy_pass http://localhost:3002; # or your custom port
- 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;
- }
-}
-```
-
### 5. Sign Up
Once the services are running and DNS has propagated, Caddy (the webserver) will automatically obtain an SSL certificate for your domain.