166 lines
3.4 KiB
Markdown
166 lines
3.4 KiB
Markdown
# Quick Setup - Make Your Worker Live
|
|
|
|
Your worker is deployed but needs configuration to enable admin features.
|
|
|
|
## Current Status
|
|
✅ Worker deployed
|
|
✅ R2 bucket `obs-videos` exists
|
|
❌ KV namespace missing (needed for admin)
|
|
❌ Admin password not set
|
|
❌ Custom domain not configured
|
|
|
|
## 3-Minute Setup
|
|
|
|
### 1. Create KV Namespace (30 seconds)
|
|
```bash
|
|
cd /home/jeffe/Github/obs-r2-uploader/worker
|
|
wrangler kv namespace create VIDEO_METADATA
|
|
```
|
|
|
|
**Example output:**
|
|
```
|
|
⛅️ wrangler 4.50.0
|
|
🌀 Creating namespace with title "obs-video-server-VIDEO_METADATA"
|
|
✨ Success!
|
|
Add the following to your configuration file in your kv_namespaces array:
|
|
{ binding = "VIDEO_METADATA", id = "abc123def456..." }
|
|
```
|
|
|
|
**COPY THE ID** (the `abc123def456...` part)
|
|
|
|
### 2. Update Configuration (1 minute)
|
|
```bash
|
|
# Copy enhanced config
|
|
cp wrangler-enhanced.toml wrangler.toml
|
|
|
|
# Edit the file
|
|
nano wrangler.toml
|
|
```
|
|
|
|
Find this line:
|
|
```toml
|
|
id = "placeholder_id"
|
|
```
|
|
|
|
Replace with YOUR ID:
|
|
```toml
|
|
id = "abc123def456..." # Use your actual ID from step 1
|
|
```
|
|
|
|
Save and exit (Ctrl+X, then Y, then Enter)
|
|
|
|
### 3. Set Admin Password (30 seconds)
|
|
```bash
|
|
wrangler secret put ADMIN_PASSWORD
|
|
```
|
|
|
|
Type your password when prompted, then press Enter.
|
|
|
|
### 4. Deploy (30 seconds)
|
|
```bash
|
|
wrangler deploy
|
|
```
|
|
|
|
### 5. Add Custom Domain (1 minute)
|
|
|
|
**Option A: Via Dashboard (Recommended)**
|
|
1. Go to: https://dash.cloudflare.com/
|
|
2. Click **Workers & Pages**
|
|
3. Click **obs-video-server**
|
|
4. Click **Settings** → **Domains & Routes**
|
|
5. Click **Add Custom Domain**
|
|
6. Enter: `videos.jeffemmett.com`
|
|
7. Click **Add Domain**
|
|
|
|
**Option B: Via Command Line**
|
|
```bash
|
|
# Edit wrangler.toml and uncomment these lines:
|
|
[env.production]
|
|
routes = [
|
|
{ pattern = "videos.jeffemmett.com/*", custom_domain = true }
|
|
]
|
|
|
|
# Then deploy again
|
|
wrangler deploy
|
|
```
|
|
|
|
## Done! 🎉
|
|
|
|
Now test:
|
|
|
|
1. **Visit**: `https://videos.jeffemmett.com/admin`
|
|
2. **Login** with your password
|
|
3. **See** the beautiful empty state
|
|
4. **Upload** a test video
|
|
|
|
## What Gets Enabled
|
|
|
|
Without KV namespace:
|
|
- ❌ Admin login
|
|
- ❌ Video upload via browser
|
|
- ❌ Visibility controls
|
|
- ❌ Video metadata
|
|
- ❌ Delete videos
|
|
|
|
With KV namespace:
|
|
- ✅ Admin login
|
|
- ✅ Video upload via browser
|
|
- ✅ Visibility controls (Private/Shareable/Clip)
|
|
- ✅ Video metadata
|
|
- ✅ Delete videos
|
|
- ✅ Beautiful empty states
|
|
- ✅ Statistics dashboard
|
|
|
|
## Troubleshooting
|
|
|
|
### "Namespace already exists"
|
|
```bash
|
|
# List existing namespaces
|
|
wrangler kv namespace list
|
|
|
|
# Use the ID from an existing VIDEO_METADATA namespace
|
|
```
|
|
|
|
### "Secret not found"
|
|
```bash
|
|
# Set it again
|
|
wrangler secret put ADMIN_PASSWORD
|
|
```
|
|
|
|
### "Worker not found"
|
|
```bash
|
|
# Make sure you're in the worker directory
|
|
cd /home/jeffe/Github/obs-r2-uploader/worker
|
|
wrangler deploy
|
|
```
|
|
|
|
### Can't access admin panel
|
|
1. Check worker is deployed: `wrangler deployments list`
|
|
2. Check password is set: `wrangler secret list`
|
|
3. Check KV is bound: `cat wrangler.toml | grep VIDEO_METADATA`
|
|
4. Try the worker URL first before custom domain
|
|
|
|
## Quick Copy-Paste Commands
|
|
|
|
All in one:
|
|
```bash
|
|
cd /home/jeffe/Github/obs-r2-uploader/worker
|
|
wrangler kv namespace create VIDEO_METADATA
|
|
# Copy the ID shown
|
|
cp wrangler-enhanced.toml wrangler.toml
|
|
nano wrangler.toml
|
|
# Replace placeholder_id with your ID, save and exit
|
|
wrangler secret put ADMIN_PASSWORD
|
|
# Enter your password
|
|
wrangler deploy
|
|
```
|
|
|
|
Then add custom domain via dashboard.
|
|
|
|
---
|
|
|
|
**Need help?** Check logs:
|
|
```bash
|
|
wrangler tail
|
|
```
|