diff --git a/Self-Hosting.md b/Self-Hosting.md index 751abd1..61f1fc9 100644 --- a/Self-Hosting.md +++ b/Self-Hosting.md @@ -21,28 +21,33 @@ This starts: Copy `.env.example` to `.env` and set: ```env +# App DUMPSTER_HOST=chat.your.domain DUMPSTER_PORT=8080 -DUMPSTER_SECRET=change-me +DUMPSTER_SECRET= +# Database POSTGRES_HOST=postgres POSTGRES_PORT=5432 POSTGRES_USER=dumpster -POSTGRES_PASSWORD=change-me +POSTGRES_PASSWORD= +POSTGRES_DB=dumpster +# Cache VALKEY_URL=redis://valkey:6379 +# File storage (optional) MINIO_ENDPOINT=minio:9000 -MINIO_ACCESS_KEY=dumpster -MINIO_SECRET_KEY=change-me +MINIO_ACCESS_KEY= +MINIO_SECRET_KEY= MINIO_BUCKET=dumpster-files -LIVEKIT_API_KEY=devkey -LIVEKIT_API_SECRET=change-me +# Voice/video (optional) +LIVEKIT_API_KEY= +LIVEKIT_API_SECRET= -VAPID_PUBLIC_KEY=... -VAPID_PRIVATE_KEY=... -VAPID_SUBJECT=mailto:admin@your.domain +# Giphy (optional) +GIPHY_API_KEY= ``` ## Ports required @@ -56,6 +61,22 @@ VAPID_SUBJECT=mailto:admin@your.domain | 50000-50100/udp | LiveKit relay | | 10000-20000/udp | coturn media relay | +## First run + +```bash +# Start services +docker compose -f docker/compose.yml up -d + +# Run migrations (creates tables) +go run ./cmd/migrate up + +# Start the server +go run ./cmd/server + +# In dev, start the web frontend separately +cd web && npm install && npm run dev +``` + ## Production TLS For production, update `docker/Caddyfile`: @@ -64,10 +85,33 @@ For production, update `docker/Caddyfile`: chat.your.domain { reverse_proxy /api/* app:8080 reverse_proxy /ws app:8080 - reverse_proxy /livekit/* livekit:7880 + reverse_proxy /ws/bot app:8080 + reverse_proxy /webhooks/* app:8080 + reverse_proxy /files/* app:8080 root * /srv/web file_server } ``` Remove `auto_https off` and Caddy will fetch Let's Encrypt certificates. + +## Adding bots + +1. Create a bot via the web UI (`/bots` page) +2. Copy the bot token (shown once) +3. Add the bot to a server +4. Run the bot: + ```bash + BOT_TOKEN= go run ./examples/modbot/main.go + ``` + +## Webhooks + +1. Create a webhook via the API or web UI +2. Copy the webhook URL (includes token) +3. POST to the URL: + ```bash + curl -X POST https://chat.your.domain/webhooks// \ + -H "Content-Type: application/json" \ + -d '{"content": "Hello from webhook!", "username": "GitHub"}' + ```