Skip to content

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

Update Docker Compose configuration and scripts for webserver support (#638)

Bill Yang493dc2657483
diff --git a/docker-compose.yml b/docker-compose.yml
index 629691487..cacb6116a 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,5 +1,6 @@
services:
caddy:
+ profiles: ["with-webserver"]
image: caddy:2.10.0
container_name: caddy
restart: unless-stopped
diff --git a/docs/content/docs/self-hosting.mdx b/docs/content/docs/self-hosting.mdx
index 9f11ecbd5..eeb5adff2 100644
--- a/docs/content/docs/self-hosting.mdx
+++ b/docs/content/docs/self-hosting.mdx
@@ -114,27 +114,48 @@ Create your admin account. You can then log in and start adding your websites!
## Managing Your Installation
-Rybbit comes with several helper scripts to manage your installation:
+### Helper Scripts
-- **start.sh**: Start all services after they've been stopped
+Rybbit comes with helper scripts to manage your installation:
+
+- **restart.sh**: Restart all services (useful when you've changed .env settings)
```bash
- ./start.sh
+ ./restart.sh
```
-- **stop.sh**: Stop all running services
+- **update.sh**: Update to the latest version by pulling new code and rebuilding containers
```bash
- ./stop.sh
+ git pull
+ ./update.sh
```
-- **restart.sh**: Restart all services
+### Docker Compose Commands
+
+You can also manage services directly with Docker Compose:
+
+- **Stop all services**:
```bash
- ./restart.sh
+ docker compose stop
```
-- **update.sh**: Update to the latest version by pulling new code and rebuilding containers
+- **Stop and remove containers** (preserves data):
```bash
- git pull
- ./update.sh
+ docker compose down
+ ```
+
+- **Start services** (if you used setup.sh with default webserver):
+ ```bash
+ docker compose --profile with-webserver up -d
+ ```
+
+- **Start services** (if you used setup.sh with --no-webserver):
+ ```bash
+ docker compose up -d
+ ```
+
+- **View logs**:
+ ```bash
+ docker compose logs -f
```
<Callout>
diff --git a/restart.sh b/restart.sh
index 69bff0852..670bf3bb9 100644
--- a/restart.sh
+++ b/restart.sh
@@ -21,10 +21,10 @@ source .env
# Start the appropriate services with updated environment variables
if [ "$USE_WEBSERVER" = "false" ]; then
# Start without the caddy service when using --no-webserver
- docker compose up -d backend client clickhouse postgres --force-recreate
+ docker compose up -d --force-recreate
else
# Start all services including caddy
- docker compose up -d --force-recreate
+ docker compose --profile with-webserver up -d --force-recreate
fi
echo "Services restarted. You can monitor logs with: docker compose logs -f"
\ No newline at end of file
diff --git a/setup.sh b/setup.sh
index 00b429570..61b5eb033 100644
--- a/setup.sh
+++ b/setup.sh
@@ -154,10 +154,10 @@ fi
echo "Building and starting Docker services..."
if [ "$USE_WEBSERVER" = "false" ]; then
# Start without the caddy service when using --no-webserver
- docker compose up -d backend client clickhouse postgres
+ docker compose up -d
else
# Start all services including caddy
- docker compose up -d
+ docker compose --profile with-webserver up -d
fi
echo "Setup complete. Services are starting in the background."
diff --git a/start.sh b/start.sh
deleted file mode 100644
index b21a23400..000000000
--- a/start.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/bash
-
-# Exit immediately if a command exits with a non-zero status.
-set -e
-
-echo "Starting services..."
-
-# Check if .env file exists
-if [ ! -f .env ]; then
- echo "Error: .env file not found. Please run setup.sh first."
- echo "Usage: ./setup.sh <domain_name>"
- exit 1
-fi
-
-# Load environment variables
-source .env
-
-if [ "$USE_WEBSERVER" = "false" ]; then
- # Start without the caddy service when using --no-webserver
- docker compose start backend client clickhouse postgres
-else
- # Start all services including caddy
- docker compose start
-fi
-
-echo "Services started. You can monitor logs with: docker compose logs -f"
\ No newline at end of file
diff --git a/stop.sh b/stop.sh
deleted file mode 100644
index 21c68b78b..000000000
--- a/stop.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-# Exit immediately if a command exits with a non-zero status.
-set -e
-
-echo "Stopping services..."
-docker compose stop
-
-echo "Services stopped."
\ No newline at end of file
diff --git a/update.sh b/update.sh
index d6f2d9385..0e548385a 100644
--- a/update.sh
+++ b/update.sh
@@ -36,10 +36,10 @@ source .env
if [ "$USE_WEBSERVER" = "false" ]; then
# Start without the caddy service when using --no-webserver
- docker compose up -d backend client clickhouse postgres --force-recreate
+ docker compose up -d --force-recreate
else
# Start all services including caddy
- docker compose up -d --force-recreate
+ docker compose --profile with-webserver up -d --force-recreate
fi
echo "Update complete. Services are running with the latest version."