2025-10-31 16:17:04 -04:00
# Docker Deployment Guide
Complete guide for deploying the Kosmi-IRC bridge using Docker.
## Quick Start
```bash
2026-05-12 22:01:25 -04:00
cp matterbridge.toml.example matterbridge.toml
2025-10-31 16:17:04 -04:00
nano matterbridge.toml
docker-compose up -d
docker-compose logs -f
```
## Prerequisites
- Docker (20.10+)
- Docker Compose (1.29+)
- A Kosmi room URL
- IRC server access
## Step-by-Step Setup
### 1. Configure the Bridge
2026-05-12 22:01:25 -04:00
Copy `matterbridge.toml.example` to `matterbridge.toml` and update these settings:
2025-10-31 16:17:04 -04:00
```toml
[kosmi.hyperspaceout]
2026-05-12 22:01:25 -04:00
RoomURL="https://app.kosmi.io/room/@YOUR_ROOM "
2025-10-31 16:17:04 -04:00
2026-05-12 22:01:25 -04:00
[irc.zeronode]
Server="irc.libera.chat:6697"
Nick="kosmi-relay"
UseTLS=true
2025-10-31 16:17:04 -04:00
[[gateway.inout]]
2026-05-12 22:01:25 -04:00
account="irc.zeronode"
channel="#your -channel"
2025-10-31 16:17:04 -04:00
```
### 2. Build the Docker Image
```bash
docker-compose build
```
This will:
2026-05-12 22:01:25 -04:00
- Use the Go 1.23 Alpine base image
- Install Chromium (used only for email/password authentication)
- Build the Matterbridge binary
- Create a production image
2025-10-31 16:17:04 -04:00
**Build time**: ~5-10 minutes (first time)
### 3. Run the Container
```bash
# Start in detached mode
docker-compose up -d
# Or start with logs visible
docker-compose up
```
### 4. Verify It's Working
```bash
2026-05-12 22:01:25 -04:00
docker-compose logs -f
```
2025-10-31 16:17:04 -04:00
2026-05-12 22:01:25 -04:00
Look for:
```
INFO Successfully connected to Kosmi
INFO Connection succeeded (IRC)
INFO Gateway(s) started successfully. Now relaying messages
2025-10-31 16:17:04 -04:00
```
### 5. Test Message Relay
2026-05-12 22:01:25 -04:00
1. **Kosmi --> IRC ** : Send a message in your Kosmi room
- Should appear in IRC as: `[kosmi] <username> message`
2025-10-31 16:17:04 -04:00
2026-05-12 22:01:25 -04:00
2. **IRC --> Kosmi ** : Send a message in your IRC channel
- Should appear in Kosmi as: `[irc] <username> message`
2025-10-31 16:17:04 -04:00
## Docker Commands Reference
### Container Management
```bash
2026-05-12 22:01:25 -04:00
docker-compose up -d # Start
docker-compose down # Stop
docker-compose restart # Restart
docker-compose logs -f # Follow logs
docker-compose logs --tail=100 # Last 100 lines
docker-compose ps # Container status
docker-compose exec matterbridge sh # Shell into container
2025-10-31 16:17:04 -04:00
```
### Updating
```bash
git pull
docker-compose build --no-cache
docker-compose up -d
```
2026-05-12 22:01:25 -04:00
## docker-compose.yml Reference
2025-10-31 16:17:04 -04:00
```yaml
2026-05-12 22:01:25 -04:00
version: '3.8'
2025-10-31 16:17:04 -04:00
services:
matterbridge:
build:
context: .
dockerfile: Dockerfile
container_name: kosmi-irc-relay
restart: unless-stopped
2026-05-12 22:01:25 -04:00
command: ["-conf", "/app/matterbridge.toml"]
2025-10-31 16:17:04 -04:00
volumes:
2026-05-12 22:01:25 -04:00
- ./matterbridge.toml:/app/matterbridge.toml:ro,z
- ./logs:/app/logs:z
- ./data:/app/data:z
2025-10-31 16:17:04 -04:00
environment:
2026-05-12 22:01:25 -04:00
- TZ=America/New_York
- MATTERBRIDGE_DATA_DIR=/app/data
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
```
### Starting Muted
To start with Jackbox announcements suppressed:
```yaml
command: ["-conf", "/app/matterbridge.toml", "-muted"]
2025-10-31 16:17:04 -04:00
```
### Environment Variables
| Variable | Description | Default |
|----------|-------------|---------|
2026-05-12 22:01:25 -04:00
| `TZ` | Timezone for log timestamps | `America/New_York` |
| `MATTERBRIDGE_DATA_DIR` | Directory for persistent data (token cache) | `/app/data` |
| `DEBUG` | Set to `1` for debug logging | `0` |
| `CHROME_BIN` | Path to Chrome binary (set in Dockerfile) | `/usr/bin/chromium-browser` |
Note: `CHROME_BIN` and `CHROME_PATH` are set in the Dockerfile. Chromium is installed in the container for email/password authentication. If you only use anonymous access, Chrome is present but unused.
2025-10-31 16:17:04 -04:00
### Volume Mounts
| Host Path | Container Path | Purpose |
|-----------|----------------|---------|
2026-05-12 22:01:25 -04:00
| `./matterbridge.toml` | `/app/matterbridge.toml` | Configuration (read-only) |
2025-10-31 16:17:04 -04:00
| `./logs` | `/app/logs` | Log files (optional) |
2026-05-12 22:01:25 -04:00
| `./data` | `/app/data` | Persistent data: token cache |
The `./data` volume is important for email/password auth -- it stores the cached JWT so the bot doesn't need to re-authenticate on every restart. See [TOKEN_PERSISTENCE.md ](TOKEN_PERSISTENCE.md ).
2025-10-31 16:17:04 -04:00
## Troubleshooting
### Container Won't Start
```bash
docker-compose logs
```
2026-05-12 22:01:25 -04:00
Common causes:
- TOML syntax error in `matterbridge.toml`
- Missing configuration file
- Port conflict (if webhook port is exposed)
2025-10-31 16:17:04 -04:00
2026-05-12 22:01:25 -04:00
### Kosmi Connection Fails
2025-10-31 16:17:04 -04:00
```bash
2026-05-12 22:01:25 -04:00
# Check connectivity from inside the container
docker-compose exec matterbridge wget -q -O - https://app.kosmi.io > /dev/null && echo "OK"
2025-10-31 16:17:04 -04:00
```
2026-05-12 22:01:25 -04:00
- Verify `RoomURL` is correct
- Enable debug logging (`Debug=true` in the Kosmi config section)
2025-10-31 16:17:04 -04:00
2026-05-12 22:01:25 -04:00
### IRC Connection Fails
2025-10-31 16:17:04 -04:00
```bash
2026-05-12 22:01:25 -04:00
# Test IRC connectivity
docker-compose exec matterbridge nc -zv irc.libera.chat 6697
2025-10-31 16:17:04 -04:00
```
2026-05-12 22:01:25 -04:00
- Verify server address and port
- Check TLS settings
- Try a different nick if the current one is registered/in use
2025-10-31 16:17:04 -04:00
2026-05-12 22:01:25 -04:00
### Messages Not Relaying
2025-10-31 16:17:04 -04:00
2026-05-12 22:01:25 -04:00
1. Confirm both bridges are connected in logs
2. Verify gateway config: Kosmi channel = `"main"` , IRC channel includes `#`
3. Enable debug logging and watch for message routing
2025-10-31 16:17:04 -04:00
2026-05-12 22:01:25 -04:00
### Authentication Issues
2025-10-31 16:17:04 -04:00
2026-05-12 22:01:25 -04:00
If using email/password:
- Delete cached token: `rm ./data/kosmi_token_cache.json`
- Rebuild container: `docker-compose build --no-cache`
- Check Chromium is working: `docker-compose exec matterbridge chromium-browser --version`
2025-10-31 16:17:04 -04:00
2026-05-12 22:01:25 -04:00
## Runtime Operations
2025-10-31 16:17:04 -04:00
2026-05-12 22:01:25 -04:00
### Mute Toggle
2025-10-31 16:17:04 -04:00
2026-05-12 22:01:25 -04:00
Toggle Jackbox announcements without restarting:
2025-10-31 16:17:04 -04:00
2026-05-12 22:01:25 -04:00
```bash
docker kill -s SIGUSR1 kosmi-irc-relay
2025-10-31 16:17:04 -04:00
```
2026-05-12 22:01:25 -04:00
See [MUTE_CONTROL.md ](MUTE_CONTROL.md ) for details.
2025-10-31 16:17:04 -04:00
2026-05-12 22:01:25 -04:00
### Force Token Refresh
2025-10-31 16:17:04 -04:00
```bash
2026-05-12 22:01:25 -04:00
docker-compose down
rm ./data/kosmi_token_cache.json
2025-10-31 16:17:04 -04:00
docker-compose up -d
```
2026-05-12 22:01:25 -04:00
### View Token Status
2025-10-31 16:17:04 -04:00
```bash
2026-05-12 22:01:25 -04:00
cat ./data/kosmi_token_cache.json | python3 -m json.tool
2025-10-31 16:17:04 -04:00
```
2026-05-12 22:01:25 -04:00
## Resource Usage
2025-10-31 16:17:04 -04:00
2026-05-12 22:01:25 -04:00
The bridge uses a native WebSocket connection, so resource requirements are modest:
2025-10-31 16:17:04 -04:00
2026-05-12 22:01:25 -04:00
- **Memory**: ~50-100MB typical (lower than browser-based approaches)
- **CPU**: Minimal (event-driven, no polling)
- **Network**: WebSocket to Kosmi + IRC connection
2025-10-31 16:17:04 -04:00
2026-05-12 22:01:25 -04:00
### Memory Limits (Optional)
2025-10-31 16:17:04 -04:00
2026-05-12 22:01:25 -04:00
```yaml
services:
matterbridge:
mem_limit: 256m
mem_reservation: 64m
2025-10-31 16:17:04 -04:00
```
2026-05-12 22:01:25 -04:00
## Production Considerations
2025-10-31 16:17:04 -04:00
2026-05-12 22:01:25 -04:00
### Log Rotation
2025-10-31 16:17:04 -04:00
2026-05-12 22:01:25 -04:00
Already configured in `docker-compose.yml` :
2025-10-31 16:17:04 -04:00
```yaml
2026-05-12 22:01:25 -04:00
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
2025-10-31 16:17:04 -04:00
```
2026-05-12 22:01:25 -04:00
### Health Check
2025-10-31 16:17:04 -04:00
Add to `docker-compose.yml` :
```yaml
services:
matterbridge:
healthcheck:
test: ["CMD", "pgrep", "-f", "matterbridge"]
interval: 30s
timeout: 10s
retries: 3
2026-05-12 22:01:25 -04:00
start_period: 30s
2025-10-31 16:17:04 -04:00
```
2026-05-12 22:01:25 -04:00
### Security
2025-10-31 16:17:04 -04:00
2026-05-12 22:01:25 -04:00
- Configuration is mounted read-only (`:ro` )
- Token cache directory has restricted access inside the container
- Credentials in `matterbridge.toml` should be protected: `chmod 600 matterbridge.toml`
- Do not commit `matterbridge.toml` with real credentials to version control
2025-10-31 16:17:04 -04:00
2026-05-12 22:01:25 -04:00
## Further Reading
2025-10-31 16:17:04 -04:00
2026-05-12 22:01:25 -04:00
- [README.md ](../../README.md ) -- Project overview
- [DOCKER_QUICKSTART.md ](DOCKER_QUICKSTART.md ) -- 5-minute quick start
- [JACKBOX_INTEGRATION.md ](JACKBOX_INTEGRATION.md ) -- Jackbox Game Picker setup
- [TOKEN_PERSISTENCE.md ](TOKEN_PERSISTENCE.md ) -- Token caching details
- [IRC.md ](../IRC.md ) -- IRC commands and voting