Skip to content

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

Refactor Docker configuration and update Caddyfile for Rybbit services (#411)

Bill Yang2fddc1d7ea5f
diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml
deleted file mode 100644
index 3485a282e..000000000
--- a/docker-compose.dev.yml
+++ /dev/null
@@ -1,124 +0,0 @@
-services:
- caddy:
- image: caddy:2.10.0
- container_name: caddy
- restart: unless-stopped
- ports:
- - "80:80"
- - "443:443"
- - "443:443/udp" # Needed for HTTP/3
- volumes:
- - ./Caddyfile:/etc/caddy/Caddyfile # Mount Caddy config file
- - caddy_data:/data # Mount persistent data volume for certs etc.
- - caddy_config:/config # Mount persistent config volume
- environment:
- # Pass domain name for use in Caddyfile
- # Email is configured via Caddyfile global options
- - DOMAIN_NAME=${DOMAIN_NAME}
- depends_on:
- - backend
- - client
-
- clickhouse:
- container_name: clickhouse
- image: clickhouse/clickhouse-server:25.4.2
- ports:
- - "8123:8123"
- - "9000:9000"
- volumes:
- - clickhouse-data:/var/lib/clickhouse
- - ./clickhouse_config:/etc/clickhouse-server/config.d
- environment:
- - CLICKHOUSE_DB=${CLICKHOUSE_DB:-analytics}
- - CLICKHOUSE_USER=${CLICKHOUSE_USER:-default}
- - CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD:-frog}
- healthcheck:
- test:
- [
- "CMD",
- "wget",
- "--no-verbose",
- "--tries=1",
- "--spider",
- "http://localhost:8123/ping",
- ]
- interval: 3s
- timeout: 5s
- retries: 5
- start_period: 10s
- restart: unless-stopped
-
- postgres:
- image: postgres:17.4
- container_name: postgres
- environment:
- - POSTGRES_USER=${POSTGRES_USER:-frog}
- - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-frog}
- - POSTGRES_DB=${POSTGRES_DB:-analytics}
- volumes:
- - postgres-data:/var/lib/postgresql/data
- restart: unless-stopped
- ports:
- - "5432:5432"
-
- backend:
- container_name: backend
- build:
- context: .
- dockerfile: server/Dockerfile
- environment:
- - NODE_ENV=production
- - CLICKHOUSE_HOST=http://clickhouse:8123
- - CLICKHOUSE_DB=${CLICKHOUSE_DB:-analytics}
- - CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD:-frog}
- - POSTGRES_HOST=postgres
- - POSTGRES_PORT=5432
- - POSTGRES_DB=${POSTGRES_DB:-analytics}
- - POSTGRES_USER=${POSTGRES_USER:-frog}
- - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-frog}
- - BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET}
- - BASE_URL=${BASE_URL}
- - DISABLE_SIGNUP=${DISABLE_SIGNUP}
- # below is only for rybbit cloud
- - CLOUD=${CLOUD}
- - STRIPE_SECRET_KEY=${STRIPE_SECRET_KEY}
- - STRIPE_WEBHOOK_SECRET=${STRIPE_WEBHOOK_SECRET}
- - GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
- - GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET}
- - GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID}
- - GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET}
- - RESEND_API_KEY=${RESEND_API_KEY}
- depends_on:
- clickhouse:
- condition: service_healthy
- postgres:
- condition: service_started
- restart: unless-stopped
- ports:
- - "3001:3001"
-
- client:
- container_name: client
- build:
- context: .
- dockerfile: client/Dockerfile
- args:
- NEXT_PUBLIC_BACKEND_URL: ${BASE_URL}
- NEXT_PUBLIC_DISABLE_SIGNUP: ${DISABLE_SIGNUP}
- NEXT_PUBLIC_CLOUD: ${CLOUD}
- environment:
- - NODE_ENV=production
- - NEXT_PUBLIC_BACKEND_URL=${BASE_URL}
- - NEXT_PUBLIC_DISABLE_SIGNUP=${DISABLE_SIGNUP}
- - NEXT_PUBLIC_CLOUD=${CLOUD}
- depends_on:
- - backend
- restart: unless-stopped
- ports:
- - "3002:3002"
-
-volumes:
- clickhouse-data:
- postgres-data:
- caddy_data: # Persistent volume for Caddy's certificates and state
- caddy_config: # Persistent volume for Caddy's configuration cache (optional but good practice)
diff --git a/docker-compose.yml b/docker-compose.yml
index e273a2d79..471fdafb1 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -72,7 +72,7 @@ services:
context: .
dockerfile: server/Dockerfile
ports:
- - "${HOST_BACKEND_PORT}"
+ - "${HOST_BACKEND_PORT:-127.0.0.1:3001:3001}"
environment:
- NODE_ENV=production
- CLICKHOUSE_HOST=http://clickhouse:8123
@@ -109,7 +109,7 @@ services:
NEXT_PUBLIC_BACKEND_URL: ${BASE_URL}
NEXT_PUBLIC_DISABLE_SIGNUP: ${DISABLE_SIGNUP}
ports:
- - "${HOST_CLIENT_PORT}"
+ - "${HOST_CLIENT_PORT:-127.0.0.1:3002:3002}"
environment:
- NODE_ENV=production
- NEXT_PUBLIC_BACKEND_URL=${BASE_URL}
diff --git a/docs/src/content/_meta.js b/docs/src/content/_meta.js
index b037ee09e..5226d33c4 100644
--- a/docs/src/content/_meta.js
+++ b/docs/src/content/_meta.js
@@ -18,8 +18,9 @@ export default {
},
"self-hosting": "",
troubleshooting: "",
+ "self-hosting-manual": "",
"self-hosting-advanced": "",
- "self-hosting-nginx": "",
+ "self-hosting-guides": "Self-hosting Guides",
"v1-migration": "",
_6: {
type: "separator",
diff --git a/docs/src/content/guides/angular.mdx b/docs/src/content/guides/angular.mdx
index beb9b52fa..6c6caf9d1 100644
--- a/docs/src/content/guides/angular.mdx
+++ b/docs/src/content/guides/angular.mdx
@@ -12,7 +12,7 @@ The recommended and most common method is to add the Rybbit tracking script dire
### Adding to `src/index.html`
<Steps>
-### 1. Retrieve Your Tracking Script
+### Retrieve Your Tracking Script
Navigate to your Rybbit dashboard to obtain your code snippet. It will look like this:
@@ -26,11 +26,11 @@ Navigate to your Rybbit dashboard to obtain your code snippet. It will look like
```
Remember to replace `YOUR_SITE_ID` with your actual Site ID.
-### 2. Locate Your `index.html` File
+### Locate Your `index.html` File
In a standard Angular CLI project, this file is typically located at `src/index.html`.
-### 3. Add the Snippet to `index.html`
+### Add the Snippet to `index.html`
Open `src/index.html` and paste the Rybbit tracking snippet just before the closing `</head>` tag or `</body>` tag. Placing it in the `<head>` is generally preferred for earlier loading.
@@ -59,7 +59,7 @@ Open `src/index.html` and paste the Rybbit tracking snippet just before the clos
```
Make sure to replace `YOUR_SITE_ID` with your actual Site ID.
-### 4. Verify Installation
+### Verify Installation
After building and deploying your application, open your Rybbit dashboard to check if data is being received. You can also inspect your browser's network tab to confirm that `script.js` is loaded.
</Steps>
@@ -119,4 +119,4 @@ export class MyFeatureComponent {{
}}
}}
```
-Declaring `window.rybbit` helps with TypeScript type checking. Always ensure `window.rybbit` and its methods are available before calling them.
\ No newline at end of file
+Declaring `window.rybbit` helps with TypeScript type checking. Always ensure `window.rybbit` and its methods are available before calling them.
diff --git a/docs/src/content/guides/astro.mdx b/docs/src/content/guides/astro.mdx
index 896decc21..9ead46c78 100644
--- a/docs/src/content/guides/astro.mdx
+++ b/docs/src/content/guides/astro.mdx
@@ -10,7 +10,7 @@ This guide explains how to integrate Rybbit with your Astro application for anal
The most common way to add a global script like Rybbit's to an Astro site is by including it in a common layout component that is used across your pages, or directly within the `<head>` of your pages if you don't use a shared layout.
<Steps>
-### 1. Retrieve Your Tracking Script
+### Retrieve Your Tracking Script
Navigate to your Rybbit dashboard to obtain your code snippet. It will look like this:
@@ -24,7 +24,7 @@ Navigate to your Rybbit dashboard to obtain your code snippet. It will look like
```
Remember to replace `YOUR_SITE_ID` with your actual Site ID.
-### 2. Add the Snippet to a Common Layout or Page Head
+### Add the Snippet to a Common Layout or Page Head
**Using a Common Layout (Recommended):**
@@ -71,7 +71,7 @@ Make sure to replace `YOUR_SITE_ID` with your actual Site ID.
If you don't have a common layout, you can add the script to the `<head>` of each `.astro` page file in your `src/pages/` directory. However, using a layout is more maintainable.
-### 3. Verify Installation
+### Verify Installation
After building and deploying your Astro site, open your Rybbit dashboard to check if data is being received. You can also inspect your browser's network tab to confirm that `script.js` is loaded on your pages.
</Steps>
@@ -129,4 +129,4 @@ export default function MyReactIsland() {
}
```
-Always ensure `window.rybbit` is available before calling its methods in client-side scripts.
\ No newline at end of file
+Always ensure `window.rybbit` is available before calling its methods in client-side scripts.
diff --git a/docs/src/content/guides/bubble.mdx b/docs/src/content/guides/bubble.mdx
index 08104bce2..8e88583fa 100644
--- a/docs/src/content/guides/bubble.mdx
+++ b/docs/src/content/guides/bubble.mdx
@@ -10,7 +10,7 @@ This guide explains how to integrate Rybbit with your Bubble.io application to t
Bubble allows you to add custom code, including JavaScript snippets, to the header of your pages.
<Steps>
-### 1. Retrieve Your Tracking Script
+### Retrieve Your Tracking Script
Navigate to your Rybbit dashboard to obtain your code snippet. It will look like this:
@@ -24,24 +24,24 @@ Navigate to your Rybbit dashboard to obtain your code snippet. It will look like
```
Remember to replace `YOUR_SITE_ID` with your actual Site ID.
-### 2. Access Your Bubble App Settings
+### Access Your Bubble App Settings
- Open your Bubble application in the editor.
- Navigate to the **Settings** tab in the left-hand sidebar.
- Go to the **SEO / metatags** sub-tab.
-### 3. Add the Snippet to the Page Header
+### Add the Snippet to the Page Header
- Scroll down to the section titled **"Script/meta tags in header"**.
- Paste your Rybbit tracking snippet into this box. This will add the script to the `<head>` section of every page in your Bubble app.
Alternatively, some Bubble plans or configurations might offer a dedicated section for "Advanced Settings" or "Custom Code" where header scripts can be placed globally or on specific pages. The "SEO / metatags" header script section is generally the most common place for global scripts.
-### 4. Deploy Your App
+### Deploy Your App
- After adding the script, ensure you deploy your Bubble application to the live version for the changes to take effect.
-### 5. Verify Installation
+### Verify Installation
Open your live Bubble application and navigate through a few pages. Then, check your Rybbit dashboard to see if data is being received. You can also inspect your browser's network tab to confirm that `script.js` is loaded.
</Steps>
@@ -58,17 +58,17 @@ Open your live Bubble application and navigate through a few pages. Then, check
You can track custom events in Bubble by using a workflow action that runs JavaScript.
<Steps>
-### 1. Create a Workflow
+### Create a Workflow
- In the Bubble editor, go to the **Workflow** tab.
- Create a new workflow triggered by the event you want to track (e.g., "When Button A is clicked", "When a user's data changes", "When a page is loaded" and a certain condition is met).
-### 2. Add "Run JavaScript" Action
+### Add "Run JavaScript" Action
- Within your workflow, add a new action.
- Search for and select the **"Run JavaScript"** action (this might be provided by a free official Bubble plugin or a community plugin if not available by default; ensure you have a way to execute arbitrary JS).
-### 3. Add Rybbit Tracking Code
+### Add Rybbit Tracking Code
- In the "Run JavaScript" action's code block, add your Rybbit event tracking code:
@@ -99,10 +99,10 @@ if (typeof window.rybbit !== 'undefined') {
}
```
-### 4. Test Your Event
+### Test Your Event
- Preview your Bubble app and trigger the workflow.
- Check your Rybbit dashboard to see if the custom event data is being received.
</Steps>
-By adding the global script and using "Run JavaScript" workflow actions, you can effectively integrate Rybbit analytics into your Bubble.io application.
\ No newline at end of file
+By adding the global script and using "Run JavaScript" workflow actions, you can effectively integrate Rybbit analytics into your Bubble.io application.
diff --git a/docs/src/content/guides/docusaurus.mdx b/docs/src/content/guides/docusaurus.mdx
index 21e09e654..4ee0af3f5 100644
--- a/docs/src/content/guides/docusaurus.mdx
+++ b/docs/src/content/guides/docusaurus.mdx
@@ -10,11 +10,11 @@ This guide explains how to integrate Rybbit with your Docusaurus v2+ website for
Docusaurus provides a configuration option to add scripts or tags to the `<head>` of every page, which is the recommended way to include Rybbit.
<Steps>
-### 1. Retrieve Your Tracking Script Details
+### Retrieve Your Tracking Script Details
Navigate to your Rybbit dashboard to obtain your **Site ID**. The script source will be `https://app.rybbit.io/api/script.js`.
-### 2. Modify `docusaurus.config.js`
+### Modify `docusaurus.config.js`
Open your `docusaurus.config.js` (or `docusaurus.config.ts` if using TypeScript) file, which is typically located at the root of your Docusaurus project.
@@ -69,7 +69,7 @@ module.exports = config;
```
Make sure to replace `YOUR_SITE_ID` with your actual Site ID from your Rybbit dashboard.
-### 3. Verify Installation
+### Verify Installation
After rebuilding and deploying your Docusaurus site (e.g., `npm run build` and `npm run serve`, or your deployment process), open your Rybbit dashboard to check if data is being received. You can also inspect your browser's network tab to confirm that `script.js` is loaded on your pages.
</Steps>
@@ -136,4 +136,4 @@ export function onRouteUpdate({location, previousLocation}) {
}
```
-Always ensure `window.rybbit` is available before calling its methods in client-side scripts.
\ No newline at end of file
+Always ensure `window.rybbit` is available before calling its methods in client-side scripts.
diff --git a/docs/src/content/guides/framer.mdx b/docs/src/content/guides/framer.mdx
index 27b39982a..470288f11 100644
--- a/docs/src/content/guides/framer.mdx
+++ b/docs/src/content/guides/framer.mdx
@@ -7,7 +7,7 @@ Rybbit enables you to gather analytics on user behavior, capture custom events,
## How to Add Rybbit to Framer
<Steps>
-### 1. Retrieve Your Tracking Script
+### Retrieve Your Tracking Script
Navigate to your Rybbit dashboard to obtain your code snippet.
@@ -20,7 +20,7 @@ Navigate to your Rybbit dashboard to obtain your code snippet.
></script>
```
-### 2. Add the Snippet to Your Framer Project
+### Add the Snippet to Your Framer Project
- Open your Framer project.
- Go to **Site Settings > General** and scroll down to **Custom Code**.
diff --git a/docs/src/content/guides/google-tag-manager.mdx b/docs/src/content/guides/google-tag-manager.mdx
index 27e39d801..05a1b2e35 100644
--- a/docs/src/content/guides/google-tag-manager.mdx
+++ b/docs/src/content/guides/google-tag-manager.mdx
@@ -7,7 +7,7 @@ Google Tag Manager (GTM) allows you to add code snippets or tracking pixels to y
## How to Add Rybbit to Google Tag Manager
<Steps>
-### 1. Retrieve Your Tracking Script
+### Retrieve Your Tracking Script
Navigate to your Rybbit dashboard to obtain your code snippet.
@@ -36,23 +36,23 @@ However, GTM sanitizes script tags by removing non-standard HTML attributes like
</script>
```
-### 2. Access Your GTM Dashboard
+### Access Your GTM Dashboard
Assuming GTM is already set up, go to your GTM dashboard and select the appropriate account and container linked to your website.
-### 3. Create a New Tag
+### Create a New Tag
Click on **Add a new tag** to initiate the creation process.
-### 4. Configure the Tag
+### Configure the Tag
Under **Tag Configuration**, choose **Custom HTML** and paste your Rybbit snippet into the provided field.
-### 5. Set Up Triggers
+### Set Up Triggers
Assign a trigger to determine when the tag should fire. For instance, to load Rybbit on all pages, select the **All Pages** trigger.
-### 6. Save and Publish
+### Save and Publish
Save your changes and publish the container to make the tag active on your website.
</Steps>
diff --git a/docs/src/content/guides/react/gatsby.mdx b/docs/src/content/guides/react/gatsby.mdx
index 6e8de7b02..93e445c75 100644
--- a/docs/src/content/guides/react/gatsby.mdx
+++ b/docs/src/content/guides/react/gatsby.mdx
@@ -10,11 +10,11 @@ This guide explains how to integrate Rybbit with your Gatsby site for analytics
The recommended way to add a script that should appear on every page in a Gatsby site is by using the `onRenderBody` API in `gatsby-ssr.js`. This ensures the script is included in the HTML generated during the build process.
<Steps>
-### 1. Retrieve Your Tracking Script Details
+### Retrieve Your Tracking Script Details
Navigate to your Rybbit dashboard to obtain your **Site ID**. The script source will be `https://app.rybbit.io/api/script.js`.
-### 2. Modify `gatsby-ssr.js`
+### Modify `gatsby-ssr.js`
Create a `gatsby-ssr.js` file at the root of your Gatsby project if it doesn't already exist. Add the following code to it:
@@ -37,7 +37,7 @@ export const onRenderBody = ({ setHeadComponents }) => {
```
Make sure to replace `YOUR_SITE_ID` with your actual Site ID from your Rybbit dashboard. This will add the Rybbit script to the `<head>` of every page generated by Gatsby.
-### 3. Verify Installation
+### Verify Installation
After rebuilding and deploying your Gatsby site (e.g., `gatsby build` and then serve the `public` folder, or your deployment process), open your Rybbit dashboard to check if data is being received. You can also inspect your browser's network tab to confirm that `script.js` is loaded on your pages.
</Steps>
@@ -130,4 +130,4 @@ const MyPage = () => (
export default MyPage
```
-Always ensure `window.rybbit` is available before calling its methods in client-side scripts.
\ No newline at end of file
+Always ensure `window.rybbit` is available before calling its methods in client-side scripts.
diff --git a/docs/src/content/guides/react/next-js.mdx b/docs/src/content/guides/react/next-js.mdx
index e7d4dc456..321b22525 100644
--- a/docs/src/content/guides/react/next-js.mdx
+++ b/docs/src/content/guides/react/next-js.mdx
@@ -8,15 +8,15 @@ Next.js is a popular React framework that enables features like server-side rend
## How to Add Rybbit to Next.js
<Steps>
-### 1. Retrieve Your Tracking Script
+### Retrieve Your Tracking Script
Navigate to your Rybbit dashboard to obtain your site ID. You'll need this for the `data-site-id` attribute.
-### 2. Install the Script Using Next.js Script Component
+### Install the Script Using Next.js Script Component
Next.js provides a built-in [Script component](https://nextjs.org/docs/app/building-your-application/optimizing/scripts) that handles script loading efficiently. This is the recommended approach.
-### 3. Add to Your Layout File
+### Add to Your Layout File
Create or modify your layout file depending on your Next.js version:
@@ -153,4 +153,4 @@ export default function MyButton({ title }) {
return <button onClick={handleClick}>{title || 'Click Me'}</button>;
}
```
-Always ensure `window.rybbit` and its methods are available before calling them, especially since the script loading is managed by Next.js's `strategy`. Consider the script's loading strategy (`afterInteractive` in the examples) when deciding where and how early you can reliably call these tracking functions.
\ No newline at end of file
+Always ensure `window.rybbit` and its methods are available before calling them, especially since the script loading is managed by Next.js's `strategy`. Consider the script's loading strategy (`afterInteractive` in the examples) when deciding where and how early you can reliably call these tracking functions.
diff --git a/docs/src/content/guides/react/remix.mdx b/docs/src/content/guides/react/remix.mdx
index 8c2ebb920..6f421e8be 100644
--- a/docs/src/content/guides/react/remix.mdx
+++ b/docs/src/content/guides/react/remix.mdx
@@ -10,7 +10,7 @@ This guide explains how to integrate Rybbit with your Remix application for anal
The recommended way to add a script that should appear on every page in a Remix application is by including it in your root layout file, typically `app/root.tsx` (or `app/root.jsx`).
<Steps>
-### 1. Retrieve Your Tracking Script
+### Retrieve Your Tracking Script
Navigate to your Rybbit dashboard to obtain your code snippet. It will look like this:
@@ -23,7 +23,7 @@ Navigate to your Rybbit dashboard to obtain your code snippet. It will look like
```
Remember to replace `YOUR_SITE_ID` with your actual Site ID.
-### 2. Add the Snippet to `app/root.tsx`
+### Add the Snippet to `app/root.tsx`
Open your `app/root.tsx` (or `app/root.jsx`) file. This file defines the root HTML structure for your application. Add the Rybbit tracking snippet within the `<head>` section of the returned JSX.
@@ -65,7 +65,7 @@ export default function App() {
```
Make sure to replace `YOUR_SITE_ID` with your actual Site ID. You can define it as a constant or directly in the script tag.
-### 3. Verify Installation
+### Verify Installation
After restarting your Remix development server or deploying your application, open your Rybbit dashboard to check if data is being received. You can also inspect your browser's network tab to confirm that `script.js` is loaded.
</Steps>
@@ -98,4 +98,4 @@ export default function MyFeatureRoute() {
);
}
```
-Always check `typeof window !== "undefined"` before accessing `window.rybbit` because Remix components can render on the server. Then, ensure `window.rybbit` itself is available.
\ No newline at end of file
+Always check `typeof window !== "undefined"` before accessing `window.rybbit` because Remix components can render on the server. Then, ensure `window.rybbit` itself is available.
diff --git a/docs/src/content/guides/react/vite-cra.mdx b/docs/src/content/guides/react/vite-cra.mdx
index 5f1c3d34a..0e9884ba0 100644
--- a/docs/src/content/guides/react/vite-cra.mdx
+++ b/docs/src/content/guides/react/vite-cra.mdx
@@ -14,7 +14,7 @@ The recommended and simplest method to add the Rybbit tracking script is directl
This is the most straightforward method and ensures the script is loaded early.
<Steps>
-### 1. Retrieve Your Tracking Script
+### Retrieve Your Tracking Script
Navigate to your Rybbit dashboard to obtain your code snippet. It will look like this:
@@ -28,12 +28,12 @@ Navigate to your Rybbit dashboard to obtain your code snippet. It will look like
```
Remember to replace `YOUR_SITE_ID` with your actual Site ID.
-### 2. Locate Your `index.html` File
+### Locate Your `index.html` File
- For **Create React App (CRA)**: This file is typically located at `public/index.html`.
- For **Vite (React template)**: This file is typically located at the root of your project as `index.html`.
-### 3. Add the Snippet to `index.html`
+### Add the Snippet to `index.html`
Open your `index.html` file and paste the Rybbit tracking snippet just before the closing `</head>` tag or `</body>` tag. Placing it in the `<head>` allows it to load sooner.
@@ -62,7 +62,7 @@ Open your `index.html` file and paste the Rybbit tracking snippet just before th
```
Make sure to replace `YOUR_SITE_ID` with your actual Site ID.
-### 4. Verify Installation
+### Verify Installation
After deploying your application, open your Rybbit dashboard to see if data is being received. You can also check your browser's network tab to ensure `script.js` is loaded.
</Steps>
@@ -87,4 +87,4 @@ function MyComponent() {
}
```
-Ensure `window.rybbit` is available before calling its methods, especially if you load the script dynamically or have strict Content Security Policies.
\ No newline at end of file
+Ensure `window.rybbit` is available before calling its methods, especially if you load the script dynamically or have strict Content Security Policies.
diff --git a/docs/src/content/guides/shopify.mdx b/docs/src/content/guides/shopify.mdx
index 87817cfe4..5b6047abb 100644
--- a/docs/src/content/guides/shopify.mdx
+++ b/docs/src/content/guides/shopify.mdx
@@ -8,7 +8,7 @@ Rybbit can be integrated with your Shopify store to capture events, track conver
## How to Add Rybbit to Shopify
<Steps>
-### 1. Retrieve Your Tracking Script
+### Retrieve Your Tracking Script
Navigate to your Rybbit dashboard to obtain your code snippet.
@@ -21,7 +21,7 @@ Navigate to your Rybbit dashboard to obtain your code snippet.
></script>
```
-### 2. Add the Snippet to Your Shopify Store
+### Add the Snippet to Your Shopify Store
- In Shopify, go to **Online Store > Themes** and click **Edit code** from the settings dropdown beside the **Customize** button.
- Open `theme.liquid` in the **Layout** folder.
diff --git a/docs/src/content/guides/svelte/sveltekit.mdx b/docs/src/content/guides/svelte/sveltekit.mdx
index f83b5265c..0e0c55881 100644
--- a/docs/src/content/guides/svelte/sveltekit.mdx
+++ b/docs/src/content/guides/svelte/sveltekit.mdx
@@ -12,7 +12,7 @@ The recommended and most straightforward method for SvelteKit is to add the Rybb
### Adding to `src/app.html`
<Steps>
-### 1. Retrieve Your Tracking Script
+### Retrieve Your Tracking Script
Navigate to your Rybbit dashboard to obtain your code snippet:
@@ -26,11 +26,11 @@ Navigate to your Rybbit dashboard to obtain your code snippet:
```
Replace `YOUR_SITE_ID` with your actual Site ID.
-### 2. Locate Your `app.html` File
+### Locate Your `app.html` File
In a SvelteKit project, this file is typically located at `src/app.html`.
-### 3. Add the Snippet to `app.html`
+### Add the Snippet to `app.html`
Open `src/app.html` and paste the Rybbit tracking snippet into the `<head>` section, usually before `%sveltekit.head%` or just after it.
@@ -57,7 +57,7 @@ Open `src/app.html` and paste the Rybbit tracking snippet into the `<head>` sect
```
Ensure `YOUR_SITE_ID` is replaced.
-### 4. Verify Installation
+### Verify Installation
Deploy your application and check your Rybbit dashboard for incoming data.
</Steps>
@@ -92,4 +92,4 @@ From any Svelte component within your SvelteKit app, you can track custom events
<button on:click={handleAction}>Perform SvelteKit Action</button>
```
-Always check `typeof window !== 'undefined'` before accessing `window.rybbit` as SvelteKit components can also run on the server.
\ No newline at end of file
+Always check `typeof window !== 'undefined'` before accessing `window.rybbit` as SvelteKit components can also run on the server.
diff --git a/docs/src/content/guides/svelte/vite.mdx b/docs/src/content/guides/svelte/vite.mdx
index 05e2b20ac..bec90c677 100644
--- a/docs/src/content/guides/svelte/vite.mdx
+++ b/docs/src/content/guides/svelte/vite.mdx
@@ -10,7 +10,7 @@ This guide explains how to integrate Rybbit with your standard client-side Svelt
The most straightforward method is to add the Rybbit tracking script directly to your `index.html` file.
<Steps>
-### 1. Retrieve Your Tracking Script
+### Retrieve Your Tracking Script
Navigate to your Rybbit dashboard to obtain your code snippet:
@@ -24,11 +24,11 @@ Navigate to your Rybbit dashboard to obtain your code snippet:
```
Replace `YOUR_SITE_ID` with your actual Site ID.
-### 2. Locate Your `index.html` File
+### Locate Your `index.html` File
For Vite-based Svelte projects, this file is typically located at the root of your project as `index.html`.
-### 3. Add the Snippet to `index.html`
+### Add the Snippet to `index.html`
Open `index.html` and paste the Rybbit tracking snippet just before the closing `</head>` tag or `</body>` tag.
@@ -57,7 +57,7 @@ Open `index.html` and paste the Rybbit tracking snippet just before the closing
```
Ensure `YOUR_SITE_ID` is replaced.
-### 4. Verify Installation
+### Verify Installation
Deploy your application and check your Rybbit dashboard for incoming data. You can also inspect your browser's network tab to confirm `script.js` is loaded.
</Steps>
@@ -82,4 +82,4 @@ From any Svelte component, you can track custom events:
<button on:click={handleClientAction}>Perform Client Svelte Action</button>
```
-Always check for `window.rybbit` before calling its methods.
\ No newline at end of file
+Always check for `window.rybbit` before calling its methods.
diff --git a/docs/src/content/guides/vue/nuxt.mdx b/docs/src/content/guides/vue/nuxt.mdx
index 557d55a75..395b0aa3d 100644
--- a/docs/src/content/guides/vue/nuxt.mdx
+++ b/docs/src/content/guides/vue/nuxt.mdx
@@ -10,11 +10,11 @@ This guide explains how to integrate Rybbit with your Nuxt.js application for an
This is the recommended method for Nuxt.js applications.
<Steps>
-### 1. Retrieve Your Site ID
+### Retrieve Your Site ID
Navigate to your Rybbit dashboard to obtain your Site ID. You'll need this for the `data-site-id` attribute in the script configuration.
-### 2. Modify `nuxt.config.ts` (or `.js`)
+### Modify `nuxt.config.ts` (or `.js`)
**For Nuxt 3:**
@@ -60,7 +60,7 @@ export default {
```
Ensure you replace `YOUR_SITE_ID` with your actual Site ID from your Rybbit dashboard. This method ensures the script is included in the `<head>` of all your pages.
-### 3. Verify Installation
+### Verify Installation
After restarting your Nuxt.js development server or deploying your application, open your Rybbit dashboard to check if data is being received. You can also inspect your browser's network tab to confirm that `script.js` is loaded.
</Steps>
@@ -86,4 +86,4 @@ function trackCustomEvent() {
}
</script>
```
-Using `process.client` (Nuxt 2) or checking `typeof window !== 'undefined'` (Nuxt 3, or generally) is good practice before accessing `window` if your component might render or execute logic on the server side.
\ No newline at end of file
+Using `process.client` (Nuxt 2) or checking `typeof window !== 'undefined'` (Nuxt 3, or generally) is good practice before accessing `window` if your component might render or execute logic on the server side.
diff --git a/docs/src/content/guides/vue/vite.mdx b/docs/src/content/guides/vue/vite.mdx
index 911e793d0..862b88c60 100644
--- a/docs/src/content/guides/vue/vite.mdx
+++ b/docs/src/content/guides/vue/vite.mdx
@@ -12,7 +12,7 @@ The recommended and simplest method for client-side Vue applications is to add t
### Adding to `index.html`
<Steps>
-### 1. Retrieve Your Tracking Script
+### Retrieve Your Tracking Script
Navigate to your Rybbit dashboard to obtain your code snippet:
@@ -26,11 +26,11 @@ Navigate to your Rybbit dashboard to obtain your code snippet:
```
Replace `YOUR_SITE_ID` with your actual Site ID.
-### 2. Locate Your `index.html` File
+### Locate Your `index.html` File
This file is typically located at the root of your Vite-based Vue project.
-### 3. Add the Snippet to `index.html`
+### Add the Snippet to `index.html`
Open `index.html` and paste the Rybbit tracking snippet just before the closing `</head>` tag or `</body>` tag. Placing it in the `<head>` allows it to load sooner.
@@ -59,7 +59,7 @@ Open `index.html` and paste the Rybbit tracking snippet just before the closing
```
Ensure `YOUR_SITE_ID` is replaced with your actual Site ID.
-### 4. Verify Installation
+### Verify Installation
Deploy your application and check your Rybbit dashboard for incoming data. You can also inspect your browser's network tab to confirm that `script.js` is loaded.
</Steps>
@@ -104,4 +104,4 @@ function trackCustomEvent() {
}
</script>
```
-Always check if `window.rybbit` and its methods are available before calling them.
\ No newline at end of file
+Always check if `window.rybbit` and its methods are available before calling them.
diff --git a/docs/src/content/guides/webflow.mdx b/docs/src/content/guides/webflow.mdx
index 907e3978d..0fbdfa329 100644
--- a/docs/src/content/guides/webflow.mdx
+++ b/docs/src/content/guides/webflow.mdx
@@ -7,7 +7,7 @@ Rybbit enables you to collect analytics, capture custom events, and more on your
## How to Add Rybbit to Webflow
<Steps>
-### 1. Retrieve Your Tracking Script
+### Retrieve Your Tracking Script
Navigate to your Rybbit dashboard to obtain your code snippet.
@@ -20,7 +20,7 @@ Navigate to your Rybbit dashboard to obtain your code snippet.
></script>
```
-### 2. Add the Snippet to Your Webflow Project
+### Add the Snippet to Your Webflow Project
- In your Webflow project, go to **Site settings > Custom code**.
- Paste your snippet into the **Head code** section.
diff --git a/docs/src/content/inviting-users.mdx b/docs/src/content/inviting-users.mdx
index dbe76679e..11fbd2832 100644
--- a/docs/src/content/inviting-users.mdx
+++ b/docs/src/content/inviting-users.mdx
@@ -7,11 +7,11 @@ Currently only the cloud version of Rybbit supports inviting users.
<Steps>
-### 1. Add the user to your organization
+### Add the user to your organization
Go to https://app.rybbit.io/organization "Add Member" button in the top right. Enter the user's email address and select the user's role.
-### 2. Select the user's role
+### Select the user's role
You can either make the user an admin or a member.
@@ -19,7 +19,7 @@ You can either make the user an admin or a member.
**Members** can see all website data, but they cannot edit anything.
-### 3. Send the invite
+### Send the invite
Click the "Invite" button. The user will receive an email with a link to sign up for Rybbit. You can manage all invites in the organizations tab.
diff --git a/docs/src/content/self-hosting-advanced.mdx b/docs/src/content/self-hosting-advanced.mdx
index 05c012630..40088962f 100644
--- a/docs/src/content/self-hosting-advanced.mdx
+++ b/docs/src/content/self-hosting-advanced.mdx
@@ -33,7 +33,7 @@ Examples:
## 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:
+If you prefer to use your own web server instead of the built-in Caddy server, you can use the `--no-webserver` flag:
```bash
./setup.sh your.domain.name --no-webserver
@@ -44,169 +44,35 @@ This will:
- 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;
- }
-}
-```
-
-For a detailed step-by-step guide on setting up Nginx with SSL certificates using Certbot, see our [Nginx Setup Guide](/docs/self-hosting-nginx).
+<Callout type="info">
+For detailed configuration examples with Nginx, Traefik, NPM, and other reverse proxies, see our [Manual Docker Compose Setup](/docs/self-hosting-manual) guide.
+</Callout>
-## Docker Compose setup with NPM, without exposing ports
-_this setup assumes you have [NPM docker](https://nginxproxymanager.com) up and running and are capable of creating SSL certs for your local hosts. Ideally, also use Technitium to create a DNS entry_
+## Environment Variables
-Note, of course you can use any othert proxy of your choice, sa long you can somehow put it on the same network as Rybbit Docker and edit location rules.
+The setup script creates a minimal `.env` file with only the essential variables:
-1. Create a `docker-compose.yml` file in your project folder with these contents:
-```
-services:
- rybbit_clickhouse:
- image: clickhouse/clickhouse-server:25.4.2
- container_name: rybbit_clickhouse
- volumes:
- - ./clickhouse-data:/var/lib/clickhouse
- - ./clickhouse_config:/etc/clickhouse-server/config.d
- environment:
- - CLICKHOUSE_DB=${CLICKHOUSE_DB:-analytics}
- - CLICKHOUSE_USER=${CLICKHOUSE_USER:-default}
- - CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD:-frog}
- healthcheck:
- test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8123/ping"]
- interval: 3s
- timeout: 5s
- retries: 5
- start_period: 10s
- restart: unless-stopped
- networks:
- - internal
-
- rybbit_postgres:
- image: postgres:17.4
- container_name: rybbit_postgres
- environment:
- - POSTGRES_USER=${POSTGRES_USER:-frog}
- - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-frog}
- - POSTGRES_DB=${POSTGRES_DB:-analytics}
- volumes:
- - ./postgres-data:/var/lib/postgresql/data
- healthcheck:
- test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
- interval: 3s
- timeout: 5s
- retries: 5
- start_period: 10s
- restart: unless-stopped
- networks:
- - internal
-
- rybbit_backend:
- image: ghcr.io/rybbit-io/rybbit-backend:${IMAGE_TAG:-latest}
- container_name: rybbit_backend
- environment:
- - NODE_ENV=production
- - CLICKHOUSE_HOST=http://rybbit_clickhouse:8123
- - CLICKHOUSE_DB=${CLICKHOUSE_DB:-analytics}
- - CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD:-frog}
- - POSTGRES_HOST=rybbit_postgres
- - POSTGRES_PORT=5432
- - POSTGRES_DB=${POSTGRES_DB:-analytics}
- - POSTGRES_USER=${POSTGRES_USER:-frog}
- - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-frog}
- - BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET}
- - BASE_URL=${BASE_URL}
- - DISABLE_SIGNUP=${DISABLE_SIGNUP}
- depends_on:
- rybbit_clickhouse:
- condition: service_healthy
- rybbit_postgres:
- condition: service_started
- healthcheck:
- test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1:3001/api/health"]
- interval: 3s
- timeout: 5s
- retries: 5
- start_period: 10s
- restart: unless-stopped
- networks:
- - internal
- - npm_proxy
-
- rybbit_client:
- image: ghcr.io/rybbit-io/rybbit-client:${IMAGE_TAG:-latest}
- container_name: rybbit_client
- environment:
- - NODE_ENV=production
- - NEXT_PUBLIC_BACKEND_URL=${BASE_URL}
- - NEXT_PUBLIC_DISABLE_SIGNUP=${DISABLE_SIGNUP}
- depends_on:
- - rybbit_backend
- restart: unless-stopped
- networks:
- - internal
- - npm_proxy
-
-networks:
- internal:
- driver: bridge
- npm_proxy:
- external: true
-```
-
-2. Create an `.env` file with these contents (edit them adequately)
-```
-DOMAIN_NAME=domain.tld
-BASE_URL=https://domain.tld
-BETTER_AUTH_SECRET=long_random_string
+```env
+DOMAIN_NAME=your.domain.com
+BASE_URL=https://your.domain.com
+BETTER_AUTH_SECRET=generated_secret
DISABLE_SIGNUP=false
-HOST_BACKEND_PORT=3001
-HOST_CLIENT_PORT=3002
```
-4. Optionally, copy the folder https://github.com/rybbit-io/rybbit/tree/master/clickhouse_config to your project (this is not strictly necessary but allows for greater control over clickhouse and might be necessary if you run into networking issues)
+Optional variables that can be added:
-5. Make sure to create your external network `npm_proxy` and make sure NPM is on it as well
+```env
+# Database configuration (uses defaults if not specified)
+CLICKHOUSE_PASSWORD=frog
+POSTGRES_USER=frog
+POSTGRES_PASSWORD=frog
+POSTGRES_DB=analytics
+CLICKHOUSE_DB=analytics
-6. Create your NPM host entry for `rybbit_client` (point it to port 3002) and in that host, add a custom location for `/api`, pointing it to `rybbit_backend` port 3001.
+# Custom image tags
+IMAGE_TAG=latest
-Hint: In the Custom Location add a custom rule:
-```
-location /api/ {
- proxy_pass http://rybbit_backend:3001;
-}
+# Port mapping (only needed for custom ports or --no-webserver)
+HOST_BACKEND_PORT="3001:3001"
+HOST_CLIENT_PORT="3002:3002"
```
-_Note: Path rewriting is no longer needed as the backend now expects requests with the `/api/` prefix._
-
-7. run `docker compose up -d` (or separately pull and up)
-
-8. Navigate to domain.tld and register your admin Account.
diff --git a/docs/src/content/self-hosting-guides/_meta.js b/docs/src/content/self-hosting-guides/_meta.js
new file mode 100644
index 000000000..94b939798
--- /dev/null
+++ b/docs/src/content/self-hosting-guides/_meta.js
@@ -0,0 +1,4 @@
+export default {
+ "custom-nginx": "Custom Nginx",
+ "nginx-proxy-manager": "Nginx Proxy Manager",
+};
\ No newline at end of file
diff --git a/docs/src/content/self-hosting-guides/custom-nginx.mdx b/docs/src/content/self-hosting-guides/custom-nginx.mdx
new file mode 100644
index 000000000..433e6d5d2
--- /dev/null
+++ b/docs/src/content/self-hosting-guides/custom-nginx.mdx
@@ -0,0 +1,226 @@
+import { Callout } from 'nextra/components'
+import { Steps } from 'nextra/components'
+
+# Custom Nginx Setup
+
+This guide shows you how to set up Rybbit with your own Nginx installation instead of using the built-in Caddy server.
+
+## Prerequisites
+
+- Existing Nginx installation
+- SSL certificates (Let's Encrypt recommended)
+- Domain pointed to your server
+- Rybbit running with `--no-webserver` flag
+
+## Setup Steps
+
+<Steps>
+
+### Run Rybbit without Caddy
+
+First, set up Rybbit to expose ports without the built-in webserver:
+
+```bash
+./setup.sh your.domain.name --no-webserver
+```
+
+This will expose:
+- Backend service on port 3001
+- Client service on port 3002
+
+### Configure Nginx
+
+Create or update your Nginx configuration file (usually in `/etc/nginx/sites-available/`):
+
+```nginx
+server {
+ listen 80;
+ server_name your.domain.name;
+ return 301 https://$host$request_uri;
+}
+
+server {
+ listen 443 ssl http2;
+ 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;
+
+ # Modern SSL configuration
+ ssl_protocols TLSv1.2 TLSv1.3;
+ ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384;
+ ssl_prefer_server_ciphers off;
+
+ # Security headers
+ add_header X-Frame-Options "SAMEORIGIN" always;
+ add_header X-Content-Type-Options "nosniff" always;
+ add_header X-XSS-Protection "1; mode=block" always;
+
+ # API requests
+ 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;
+ proxy_set_header X-Forwarded-Host $server_name;
+
+ # Timeouts
+ proxy_connect_timeout 60s;
+ proxy_send_timeout 60s;
+ proxy_read_timeout 60s;
+ }
+
+ # Client app
+ 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;
+ proxy_set_header X-Forwarded-Host $server_name;
+
+ # Timeouts
+ proxy_connect_timeout 60s;
+ proxy_send_timeout 60s;
+ proxy_read_timeout 60s;
+ }
+}
+```
+
+### Enable the Site
+
+Enable your Nginx configuration:
+
+```bash
+# Create symlink to enable the site
+sudo ln -s /etc/nginx/sites-available/your-site /etc/nginx/sites-enabled/
+
+# Test the configuration
+sudo nginx -t
+
+# Reload Nginx
+sudo systemctl reload nginx
+```
+
+### Verify Setup
+
+Check that everything is working:
+
+```bash
+# Check Nginx status
+sudo systemctl status nginx
+
+# Check Rybbit services
+docker compose ps
+
+# Test the website
+curl -I https://your.domain.name
+```
+
+</Steps>
+
+## SSL Certificate Setup with Certbot
+
+If you need to set up SSL certificates with Let's Encrypt:
+
+<Steps>
+
+### Install Certbot
+
+```bash
+# Ubuntu/Debian
+sudo apt update
+sudo apt install certbot python3-certbot-nginx
+
+# CentOS/RHEL
+sudo yum install certbot python3-certbot-nginx
+```
+
+### Obtain Certificate
+
+```bash
+sudo certbot --nginx -d your.domain.name
+```
+
+### Auto-renewal
+
+Set up automatic renewal:
+
+```bash
+# Test renewal
+sudo certbot renew --dry-run
+
+# Check existing cron job
+sudo crontab -l
+```
+
+Certbot usually sets up auto-renewal automatically, but you can add this cron job if needed:
+
+```bash
+0 12 * * * /usr/bin/certbot renew --quiet
+```
+
+</Steps>
+
+## Custom Ports
+
+If you need to use custom ports for Rybbit:
+
+```bash
+./setup.sh your.domain.name --no-webserver --backend-port 8080 --client-port 8081
+```
+
+Update your Nginx configuration accordingly:
+
+```nginx
+location /api/ {
+ proxy_pass http://localhost:8080; # Custom backend port
+ # ... rest of config
+}
+
+location / {
+ proxy_pass http://localhost:8081; # Custom client port
+ # ... rest of config
+}
+```
+
+## Troubleshooting
+
+### Common Issues
+
+**502 Bad Gateway**: Check if Rybbit services are running:
+```bash
+docker compose ps
+docker compose logs
+```
+
+**SSL Certificate Issues**: Verify certificate paths:
+```bash
+sudo certbot certificates
+```
+
+**Permission Denied**: Check Nginx error logs:
+```bash
+sudo tail -f /var/log/nginx/error.log
+```
+
+### Logs
+
+Monitor logs for debugging:
+
+```bash
+# Nginx access logs
+sudo tail -f /var/log/nginx/access.log
+
+# Nginx error logs
+sudo tail -f /var/log/nginx/error.log
+
+# Rybbit logs
+docker compose logs -f
+```
+
+<Callout type="info">
+For step-by-step Nginx installation and SSL setup, see our [Nginx Setup Guide](/docs/self-hosting-nginx).
+</Callout>
\ No newline at end of file
diff --git a/docs/src/content/self-hosting-guides/nginx-proxy-manager.mdx b/docs/src/content/self-hosting-guides/nginx-proxy-manager.mdx
new file mode 100644
index 000000000..db33462b6
--- /dev/null
+++ b/docs/src/content/self-hosting-guides/nginx-proxy-manager.mdx
@@ -0,0 +1,326 @@
+import { Callout } from 'nextra/components'
+import { Steps } from 'nextra/components'
+
+# Nginx Proxy Manager (NPM) Setup
+
+This guide shows you how to set up Rybbit with Nginx Proxy Manager without exposing ports directly to the host.
+
+## Prerequisites
+
+- [Nginx Proxy Manager](https://nginxproxymanager.com) already running
+- Basic knowledge of Docker networks
+- Domain name pointed to your server
+
+<Callout type="info">
+This setup assumes you have NPM running and are capable of creating SSL certificates. You can also use any other reverse proxy as long as you can put it on the same Docker network as Rybbit.
+</Callout>
+
+## Setup Steps
+
+<Steps>
+
+### Create Custom Docker Compose
+
+Create a new directory for your Rybbit installation and create a `docker-compose.yml` file:
+
+```yaml
+services:
+ rybbit_clickhouse:
+ image: clickhouse/clickhouse-server:25.4.2
+ container_name: rybbit_clickhouse
+ volumes:
+ - ./clickhouse-data:/var/lib/clickhouse
+ - ./clickhouse_config:/etc/clickhouse-server/config.d
+ environment:
+ - CLICKHOUSE_DB=${CLICKHOUSE_DB:-analytics}
+ - CLICKHOUSE_USER=${CLICKHOUSE_USER:-default}
+ - CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD:-frog}
+ healthcheck:
+ test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8123/ping"]
+ interval: 3s
+ timeout: 5s
+ retries: 5
+ start_period: 10s
+ restart: unless-stopped
+ networks:
+ - internal
+
+ rybbit_postgres:
+ image: postgres:17.4
+ container_name: rybbit_postgres
+ environment:
+ - POSTGRES_USER=${POSTGRES_USER:-frog}
+ - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-frog}
+ - POSTGRES_DB=${POSTGRES_DB:-analytics}
+ volumes:
+ - ./postgres-data:/var/lib/postgresql/data
+ healthcheck:
+ test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
+ interval: 3s
+ timeout: 5s
+ retries: 5
+ start_period: 10s
+ restart: unless-stopped
+ networks:
+ - internal
+
+ rybbit_backend:
+ image: ghcr.io/rybbit-io/rybbit-backend:${IMAGE_TAG:-latest}
+ container_name: rybbit_backend
+ environment:
+ - NODE_ENV=production
+ - CLICKHOUSE_HOST=http://rybbit_clickhouse:8123
+ - CLICKHOUSE_DB=${CLICKHOUSE_DB:-analytics}
+ - CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD:-frog}
+ - POSTGRES_HOST=rybbit_postgres
+ - POSTGRES_PORT=5432
+ - POSTGRES_DB=${POSTGRES_DB:-analytics}
+ - POSTGRES_USER=${POSTGRES_USER:-frog}
+ - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-frog}
+ - BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET}
+ - BASE_URL=${BASE_URL}
+ - DISABLE_SIGNUP=${DISABLE_SIGNUP}
+ depends_on:
+ rybbit_clickhouse:
+ condition: service_healthy
+ rybbit_postgres:
+ condition: service_started
+ healthcheck:
+ test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1:3001/api/health"]
+ interval: 3s
+ timeout: 5s
+ retries: 5
+ start_period: 10s
+ restart: unless-stopped
+ networks:
+ - internal
+ - npm_proxy
+
+ rybbit_client:
+ image: ghcr.io/rybbit-io/rybbit-client:${IMAGE_TAG:-latest}
+ container_name: rybbit_client
+ environment:
+ - NODE_ENV=production
+ - NEXT_PUBLIC_BACKEND_URL=${BASE_URL}
+ - NEXT_PUBLIC_DISABLE_SIGNUP=${DISABLE_SIGNUP}
+ depends_on:
+ - rybbit_backend
+ restart: unless-stopped
+ networks:
+ - internal
+ - npm_proxy
+
+networks:
+ internal:
+ driver: bridge
+ npm_proxy:
+ external: true
+
+volumes:
+ clickhouse-data:
+ postgres-data:
+```
+
+### Configure Environment
+
+Create a `.env` file in the same directory:
+
+```env
+# 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_generated_secret_here
+
+# Optional: Disable new user signups after creating admin account
+DISABLE_SIGNUP=false
+
+# Optional: Custom image tag
+IMAGE_TAG=latest
+```
+
+<Callout type="info">
+Generate a secure `BETTER_AUTH_SECRET` using: `openssl rand -hex 32`
+</Callout>
+
+### Setup Docker Network
+
+Create the external network that NPM uses (if it doesn't exist):
+
+```bash
+docker network create npm_proxy
+```
+
+Make sure your NPM container is connected to this network:
+
+```bash
+# Check if NPM is on the network
+docker network inspect npm_proxy
+
+# If needed, connect NPM to the network
+docker network connect npm_proxy <npm_container_name>
+```
+
+### Copy ClickHouse Config (Optional)
+
+Optionally, copy the ClickHouse configuration for better control:
+
+```bash
+# If you cloned the main repo, copy the config
+cp -r /path/to/rybbit/clickhouse_config ./
+
+# Or download it directly
+curl -L https://github.com/rybbit-io/rybbit/archive/master.tar.gz | tar -xz --strip=2 rybbit-master/clickhouse_config
+```
+
+### Start Services
+
+Start all Rybbit services:
+
+```bash
+docker compose up -d
+```
+
+Verify all services are running:
+
+```bash
+docker compose ps
+```
+
+### Configure NPM
+
+In your Nginx Proxy Manager interface:
+
+1. **Create Proxy Host**:
+ - Domain Names: `your.domain.com`
+ - Scheme: `http`
+ - Forward Hostname/IP: `rybbit_client`
+ - Forward Port: `3002`
+ - Enable "Cache Assets", "Block Common Exploits", "Websockets Support"
+
+2. **Add Custom Location**:
+ - Location: `/api`
+ - Scheme: `http`
+ - Forward Hostname/IP: `rybbit_backend`
+ - Forward Port: `3001`
+
+3. **Advanced Configuration** (in the custom location):
+ ```nginx
+ location /api/ {
+ proxy_pass http://rybbit_backend: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;
+ }
+ ```
+
+4. **SSL Configuration**:
+ - Enable SSL
+ - Request a new SSL certificate with Let's Encrypt
+ - Enable "Force SSL" and "HTTP/2 Support"
+
+### Access Rybbit
+
+Navigate to `https://your.domain.com` and create your admin account.
+
+</Steps>
+
+## Alternative Proxy Configurations
+
+### Traefik
+
+If you're using Traefik instead, add these labels to your services:
+
+```yaml
+services:
+ rybbit_backend:
+ # ... existing config
+ labels:
+ - "traefik.enable=true"
+ - "traefik.http.routers.rybbit-api.rule=Host(`your.domain.com`) && PathPrefix(`/api`)"
+ - "traefik.http.routers.rybbit-api.tls.certresolver=letsencrypt"
+ - "traefik.http.services.rybbit-api.loadbalancer.server.port=3001"
+ - "traefik.docker.network=traefik_proxy"
+
+ rybbit_client:
+ # ... existing config
+ labels:
+ - "traefik.enable=true"
+ - "traefik.http.routers.rybbit-client.rule=Host(`your.domain.com`)"
+ - "traefik.http.routers.rybbit-client.tls.certresolver=letsencrypt"
+ - "traefik.http.services.rybbit-client.loadbalancer.server.port=3002"
+ - "traefik.docker.network=traefik_proxy"
+
+networks:
+ traefik_proxy:
+ external: true
+```
+
+### Cloudflare Tunnel
+
+For Cloudflare Tunnel, create a tunnel configuration:
+
+```yaml
+tunnel: your-tunnel-id
+credentials-file: /path/to/credentials.json
+
+ingress:
+ - hostname: your.domain.com
+ path: /api
+ service: http://rybbit_backend:3001
+ - hostname: your.domain.com
+ service: http://rybbit_client:3002
+ - service: http_status:404
+```
+
+## Troubleshooting
+
+### Common Issues
+
+**NPM can't reach containers**:
+- Verify both NPM and Rybbit are on the same network
+- Check container names match the proxy configuration
+
+**SSL certificate issues**:
+- Ensure domain is pointed to your server
+- Check NPM logs for certificate generation errors
+
+**502 Bad Gateway**:
+- Verify Rybbit services are healthy: `docker compose ps`
+- Check container logs: `docker compose logs`
+
+### Networking
+
+Check network connectivity:
+
+```bash
+# List all networks
+docker network ls
+
+# Inspect the npm_proxy network
+docker network inspect npm_proxy
+
+# Check which containers are connected
+docker ps --format "table {{.Names}}\t{{.Networks}}"
+```
+
+### Logs
+
+Monitor logs for debugging:
+
+```bash
+# Rybbit services
+docker compose logs -f
+
+# Specific service
+docker compose logs -f rybbit_backend
+
+# NPM logs (adjust container name)
+docker logs -f nginx-proxy-manager
+```
+
+<Callout type="warning">
+Remember to regularly backup your data volumes (`clickhouse-data` and `postgres-data`) and your `.env` file.
+</Callout>
\ No newline at end of file
diff --git a/docs/src/content/self-hosting-manual.mdx b/docs/src/content/self-hosting-manual.mdx
new file mode 100644
index 000000000..331da0388
--- /dev/null
+++ b/docs/src/content/self-hosting-manual.mdx
@@ -0,0 +1,279 @@
+import { Callout } from 'nextra/components'
+import { Steps } from 'nextra/components'
+import { Tabs } from 'nextra/components'
+
+# 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
+
+<Steps>
+### Clone the Repository
+
+```bash
+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:
+
+```bash
+# 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
+```
+
+<Callout type="info">
+To generate a secure `BETTER_AUTH_SECRET`, you can use:
+```bash
+openssl rand -hex 32
+```
+</Callout>
+
+### Choose Your Setup Method
+
+<Tabs items={['Built-in Caddy (Automatic SSL)', 'Without Caddy']}>
+ <Tabs.Tab>
+If you don't have a reverse proxy and want automatic SSL certificates, use the default docker-compose.yml:
+
+```bash
+docker compose up -d
+```
+
+This will:
+- Start all services including Caddy
+- Automatically obtain SSL certificates
+- Make your app available at `https://your.domain.com`
+ </Tabs.Tab>
+ <Tabs.Tab>
+If you have your own reverse proxy (Nginx, Traefik, Coolify, etc.), you need to exclude Caddy and expose the ports:
+
+1. **Option B1: Modify the .env file**
+ ```env
+ # Add these lines to expose ports
+ HOST_BACKEND_PORT="3001:3001"
+ HOST_CLIENT_PORT="3002:3002"
+ ```
+
+ Then start without Caddy:
+ ```bash
+ docker compose up -d backend client clickhouse postgres
+ ```
+
+2. **Option B2: Use docker-compose.override.yml**
+ Create a `docker-compose.override.yml` file:
+ ```yaml
+ services:
+ backend:
+ ports:
+ - "3001:3001"
+ client:
+ ports:
+ - "3002:3002"
+ ```
+
+ Then start without Caddy:
+ ```bash
+ docker compose up -d backend client clickhouse postgres
+ ```
+ </Tabs.Tab>
+</Tabs>
+
+
+### Configure Your Reverse Proxy
+
+If you're using your own reverse proxy, configure it to:
+- Proxy requests to `/api/*` to `http://localhost:3001`
+- Proxy all other requests to `http://localhost:3002`
+
+Example configurations:
+
+<Tabs items={['Nginx', 'Traefik']}>
+ <Tabs.Tab>
+```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;
+ }
+}
+```
+ </Tabs.Tab>
+ <Tabs.Tab>
+```yml
+services:
+ backend:
+ labels:
+ - "traefik.enable=true"
+ - "traefik.http.routers.rybbit-api.rule=Host(`your.domain.com`) && PathPrefix(`/api`)"
+ - "traefik.http.routers.rybbit-api.tls.certresolver=letsencrypt"
+ - "traefik.http.services.rybbit-api.loadbalancer.server.port=3001"
+
+ client:
+ labels:
+ - "traefik.enable=true"
+ - "traefik.http.routers.rybbit-client.rule=Host(`your.domain.com`)"
+ - "traefik.http.routers.rybbit-client.tls.certresolver=letsencrypt"
+ - "traefik.http.services.rybbit-client.loadbalancer.server.port=3002"
+```
+ </Tabs.Tab>
+</Tabs>
+
+### Start the Services
+
+```bash
+# 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:
+```bash
+docker compose ps
+```
+
+Monitor logs:
+```bash
+docker compose logs -f
+```
+
+### Create Admin Account
+
+Navigate to `https://your.domain.com/signup` and create your admin account.
+
+</Steps>
+
+## 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):
+
+```env
+HOST_BACKEND_PORT="8080:3001"
+HOST_CLIENT_PORT="8081:3002"
+```
+
+### Using with Coolify
+
+In Coolify, you can:
+1. Create a new service with the docker-compose.yml
+2. Set the environment variables in Coolify's interface
+3. Use Coolify's built-in proxy by exposing ports 3001 and 3002
+
+### Using with Nginx Proxy Manager
+
+1. Set up port exposure in your .env:
+ ```env
+ HOST_BACKEND_PORT="3001:3001"
+ HOST_CLIENT_PORT="3002:3002"
+ ```
+
+2. Create a proxy host pointing to your server IP:3002
+3. Add a custom location `/api/*` pointing to your server IP:3001
+
+### Database Persistence
+
+Data is automatically persisted in Docker volumes:
+- `rybbit_clickhouse-data`: Analytics data
+- `rybbit_postgres-data`: User accounts and site configurations
+
+## Advanced Configurations
+
+For specific reverse proxy setups, see our detailed guides:
+
+- **[Custom Nginx Setup](/docs/self-hosting-guides/custom-nginx)** - Complete Nginx configuration with SSL
+- **[Nginx Proxy Manager](/docs/self-hosting-guides/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
+```bash
+# Check logs
+docker compose logs
+
+# Check service status
+docker compose ps
+```
+
+### Port conflicts
+If you get port binding errors, either:
+1. Change the host ports in your .env file
+2. Stop the conflicting service
+3. Use docker-compose.override.yml to customize ports
+
+### Database connection issues
+Ensure the database services are healthy:
+```bash
+docker compose ps
+```
+
+Both postgres and clickhouse should show "healthy" status.
+
+<Callout type="info">
+For more advanced configurations and setup script options, see our [Advanced Self-Hosting Guide](/docs/self-hosting-advanced).
+</Callout>
diff --git a/docs/src/content/self-hosting-nginx.mdx b/docs/src/content/self-hosting-nginx.mdx
deleted file mode 100644
index a62932aba..000000000
--- a/docs/src/content/self-hosting-nginx.mdx
+++ /dev/null
@@ -1,155 +0,0 @@
-import { Steps } from 'nextra/components'
-import { Callout } from 'nextra/components'
-
-# Custom Nginx Setup
-
-Rybbit comes with a built-in webserver (Caddy), but you can use your own web server by using the `--no-webserver` flag on the `setup.sh` script. This is an example of how to set up Nginx with SSL certificates using Certbot.
-
-## Prerequisites
-
-- A domain name pointing to your server
-- A Linux-based server (these instructions use apt-based systems like Ubuntu/Debian)
-
-## Setup Process
-
-<Steps>
-### 1. Run the Setup Script
-
-```bash
-./setup.sh your.domain.name --no-webserver
-```
-
-### 2. Install Nginx and Certbot
-
-First, install Nginx and Certbot on your server:
-
-```bash
-# Update package lists
-sudo apt update
-
-# Install Nginx
-sudo apt install nginx
-
-# Install Certbot and the Nginx plugin
-sudo apt install certbot python3-certbot-nginx
-```
-
-### 3. Configure Nginx
-
-Create a new Nginx server configuration file:
-
-```bash
-sudo nano /etc/nginx/sites-available/rybbit
-```
-
-Add the following configuration (replace `your.domain.name` with your actual domain):
-
-```nginx
-server {
- listen 80;
- server_name your.domain.name;
-
- # We'll start with a basic HTTP configuration
- # Certbot will modify this file later to add HTTPS
-
- location / {
- proxy_pass http://localhost:3002; # Client 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;
- }
-
- location /api/ {
- proxy_pass http://localhost:3001; # Backend 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;
- }
-}
-```
-
-<Callout type="info">
- The backend service expects requests to include the `/api/` prefix, so we proxy requests directly without path rewriting.
-</Callout>
-
-### 4. Enable the Site Configuration
-
-Enable the site by creating a symbolic link and test the configuration:
-
-```bash
-# Enable the site
-sudo ln -s /etc/nginx/sites-available/rybbit /etc/nginx/sites-enabled/
-
-# Test the configuration
-sudo nginx -t
-
-# If the test is successful, restart Nginx
-sudo systemctl restart nginx
-```
-
-### 5. Set Up SSL with Certbot
-
-Certbot can automatically configure Nginx to use HTTPS:
-
-```bash
-sudo certbot --nginx -d your.domain.name
-```
-
-Certbot will automatically modify your Nginx configuration to include SSL certificate settings and HTTPS server blocks.
-
-### 6. Verify the Setup
-
-Your final Nginx configuration (in `/etc/nginx/sites-available/rybbit`) should now include HTTPS settings. You can check it with:
-
-```bash
-sudo cat /etc/nginx/sites-available/rybbit
-```
-
-It should include SSL certificate paths and a server block for HTTPS.
-
-</Steps>
-
-## Certificate Renewal
-
-Certbot creates a systemd timer that automatically renews certificates before they expire. You can verify it's active with:
-
-```bash
-sudo systemctl status certbot.timer
-```
-
-You can also test the renewal process (without actually renewing) using:
-
-```bash
-sudo certbot renew --dry-run
-```
-
-## Troubleshooting
-
-If you encounter issues:
-
-1. Make sure your firewall is open to allow HTTP and HTTPS traffic.
- ```bash
- sudo ufw allow 80/tcp
- sudo ufw allow 443/tcp
- sudo ufw status
- ```
-
-2. Check Nginx error logs:
- ```bash
- sudo tail -f /var/log/nginx/error.log
- ```
-
-3. Verify that the Docker containers are running and exposing the correct ports:
- ```bash
- docker ps
- ```
-
-4. Test connectivity to the backend and client services:
- ```bash
- curl -v http://localhost:3001
- curl -v http://localhost:3002
- ```
-
-5. If the Certbot automatic configuration fails, you can manually add SSL configuration to your Nginx server block.
diff --git a/docs/src/content/self-hosting.mdx b/docs/src/content/self-hosting.mdx
index 99ca99f50..fb8aac196 100644
--- a/docs/src/content/self-hosting.mdx
+++ b/docs/src/content/self-hosting.mdx
@@ -1,9 +1,9 @@
import { Steps } from 'nextra/components'
import { Callout } from 'nextra/components'
-# Self Hosting Guide
+# Quick Start
-This guide will walk you through setting up your own instance of Rybbit.
+This guide will walk you through setting up your own instance of Rybbit using our setup script. If you want to manually setup Rybbit using the Docker Compose file, check out our [Manual Docker Compose Setup](/docs/self-hosting-manual) guide.
## Prerequisites
@@ -14,7 +14,6 @@ Before you begin, ensure you have the following:
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.
<Callout type="info">
This guide has been tested on Ubuntu 24 LTS (x86_64). If your server is ARM, it must be at least ARMv8.2-A for Clickhouse support.
@@ -23,7 +22,7 @@ Before you begin, ensure you have the following:
## Setup Steps
<Steps>
-### 1. Point Your Domain to Your VPS
+### Point Your Domain to Your VPS
Configure your domain's DNS settings to point to your VPS's public IP address. This usually involves:
@@ -32,7 +31,6 @@ Configure your domain's DNS settings to point to your VPS's public IP address. T
3. Adding an `A` record:
* **Host/Name:** Your desired subdomain (e.g., `tracking`) or `@` for the root domain.
* **Value:** Your VPS's IPv4 address.
- * **TTL:** Default or a low value (e.g., 300 seconds) for faster updates.
* **Proxy Status:** When using Cloudflare, either:
* Set to "DNS only" (recommended for most setups)
* Or if keeping the proxy enabled, set SSL/TLS encryption mode to "Full" or "Full (strict)" in your Cloudflare dashboard under SSL/TLS settings
@@ -43,14 +41,14 @@ Configure your domain's DNS settings to point to your VPS's public IP address. T
DNS changes might take some time to propagate globally. Use [DNS Checker](https://dnschecker.org/) to verify.
-### 2. Install Docker Engine
+### Install Docker Engine
Connect to your VPS via SSH.
Follow the official Docker Engine installation instructions for your Linux distribution:
[https://docs.docker.com/engine/install/](https://docs.docker.com/engine/install/)
-### 3. Clone the Rybbit Repository
+### Clone the Rybbit Repository
Clone the project repository from GitHub (Git is usually pre-installed on most server distributions):
```bash
@@ -58,7 +56,7 @@ git clone https://github.com/rybbit-io/rybbit.git
cd rybbit
```
-### 4. Run the Setup Script
+### Run the Setup Script
The repository includes a setup script that configures the necessary environment variables (including generating a secure secret) and starts the application using Docker Compose.
@@ -77,10 +75,12 @@ 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.
<Callout type="info">
- 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).
+ By default, we assume you are on a blank VPS and automatically setup a Caddy webserver. If you want to use your own webserver or need more control over the setup, check out:
+ - [Manual Docker Compose Setup](/docs/self-hosting-manual) - For users with existing reverse proxies or deployment tools
+ - [Advanced Self-Hosting Guide](/docs/self-hosting-advanced) - For custom configurations and Nginx setup
</Callout>
-### 5. Sign Up
+### Sign Up
Once the services are running and DNS has propagated, Caddy (the webserver) will automatically obtain an SSL certificate for your domain.
diff --git a/setup.sh b/setup.sh
index 81ed50736..c81224373 100644
--- a/setup.sh
+++ b/setup.sh
@@ -91,29 +91,38 @@ fi
# Create or overwrite the .env file
echo "Creating .env file..."
-# Update port mappings based on webserver choice
-if [ "$USE_WEBSERVER" = "false" ]; then
- # When not using the built-in webserver, expose ports to all interfaces
- # Using quotes to ensure the string is passed as-is to Docker Compose
- HOST_BACKEND_PORT="\"${BACKEND_PORT}:3001\""
- HOST_CLIENT_PORT="\"${CLIENT_PORT}:3002\""
-else
- # Keep ports only accessible via localhost when using Caddy
- HOST_BACKEND_PORT="\"127.0.0.1:${BACKEND_PORT}:3001\""
- HOST_CLIENT_PORT="\"127.0.0.1:${CLIENT_PORT}:3002\""
-fi
-
+# Start building the .env file with required variables
cat > .env << EOL
-# Variables configured by setup.sh
+# Required variables configured by setup.sh
DOMAIN_NAME=${DOMAIN_NAME}
BASE_URL=${BASE_URL}
BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET}
-USE_WEBSERVER=${USE_WEBSERVER}
-HOST_BACKEND_PORT=${HOST_BACKEND_PORT}
-HOST_CLIENT_PORT=${HOST_CLIENT_PORT}
DISABLE_SIGNUP=false
EOL
+# Only add port variables if using custom ports or no webserver
+if [ "$USE_WEBSERVER" = "false" ]; then
+ # When not using the built-in webserver, expose ports to all interfaces
+ if [ "$BACKEND_PORT" != "3001" ] || [ "$CLIENT_PORT" != "3002" ]; then
+ # Custom ports specified
+ echo "HOST_BACKEND_PORT=\"${BACKEND_PORT}:3001\"" >> .env
+ echo "HOST_CLIENT_PORT=\"${CLIENT_PORT}:3002\"" >> .env
+ else
+ # Default ports, just expose them
+ echo "HOST_BACKEND_PORT=\"3001:3001\"" >> .env
+ echo "HOST_CLIENT_PORT=\"3002:3002\"" >> .env
+ fi
+elif [ "$BACKEND_PORT" != "3001" ] || [ "$CLIENT_PORT" != "3002" ]; then
+ # Using webserver but with custom ports - bind to localhost only
+ echo "HOST_BACKEND_PORT=\"127.0.0.1:${BACKEND_PORT}:3001\"" >> .env
+ echo "HOST_CLIENT_PORT=\"127.0.0.1:${CLIENT_PORT}:3002\"" >> .env
+fi
+
+# Add USE_WEBSERVER only if it's false (since true is the default behavior)
+if [ "$USE_WEBSERVER" = "false" ]; then
+ echo "USE_WEBSERVER=false" >> .env
+fi
+
echo ".env file created successfully with domain ${DOMAIN_NAME}."
if [ "$USE_WEBSERVER" = "false" ]; then
echo "Caddy webserver is disabled. You'll need to set up your own webserver."