# Quick Emby Deployment Guide

## TL;DR - Deploy Emby Right Now

### If you have Emby already running:

1. Open dashboard: `https://status.sami`
2. Click **📱 App Selector**
3. Click **Emby** (under Media category)
4. Enter your Emby server's **IP** and **Port** (default: 8096)
5. Click **Deploy**
6. Access at: `https://emby.sami`

### If you need to install Emby first:

**Quick Docker Deploy:**
```bash
docker run -d \
  --name=emby \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=America/New_York \
  -p 8096:8096 \
  -v ./emby-config:/config \
  -v /path/to/movies:/data/movies \
  -v /path/to/tvshows:/data/tvshows \
  --restart unless-stopped \
  lscr.io/linuxserver/emby:latest
```

**Then add to dashboard:**
1. Dashboard → 📱 App Selector → Emby
2. IP: `localhost` or your server IP
3. Port: `8096`
4. Deploy!

## Deployment Form Values

```
Subdomain: emby
IP Address: [your server IP]
Port: 8096
DNS Type: ⦿ Private DNS (recommended for local network)
SSL Type: ⦿ Internal CA (recommended for .sami domain)
```

## What Happens When You Deploy

1. ✅ DNS A record created: `emby.sami → your IP`
2. ✅ Caddy reverse proxy configured
3. ✅ SSL certificate generated (internal CA)
4. ✅ Accessible at: `https://emby.sami`

## Common Deployment Scenarios

### Scenario 1: Emby on Windows PC
```
IP: 192.168.254.100 (your PC's IP)
Port: 8096
```

### Scenario 2: Emby in Docker on same Caddy server
```
IP: localhost or 172.17.0.1
Port: 8096
```

### Scenario 3: Emby on another server (Tailscale IP)
```
IP: 100.xx.xx.xx (Tailscale IP)
Port: 8096
```

### Scenario 4: Emby on NAS
```
IP: 192.168.254.50 (NAS IP)
Port: 8096
```

## Verify Deployment

```bash
# Test DNS
nslookup emby.sami dns1.sami

# Test HTTPS (from Caddy server)
curl -k https://emby.sami

# Check Caddy configuration
curl http://localhost:2019/config/ | jq '.apps.http.servers.srv0.routes[] | select(.["@id"] == "emby.sami")'

# Check if Emby responds
curl http://[your-emby-ip]:8096/emby/System/Info/Public
```

## Quick Fixes

**Emby not accessible after deployment:**
```bash
# Check Emby is running
curl http://[ip]:8096

# Check Caddy route exists
curl http://localhost:2019/id/emby.sami

# Check DNS record
curl "http://192.168.254.204:5380/api/zones/records/get?token=$TECHNITIUM_API_TOKEN&domain=emby.sami"
```

**Remove and redeploy:**
1. Delete the card from dashboard (🗑️ button)
2. Deploy again through App Selector

## Manual Caddy Configuration (Alternative)

If you prefer manual configuration, add to Caddyfile:

```caddyfile
emby.sami {
  tls internal
  reverse_proxy http://192.168.254.100:8096
}
```

Then:
```bash
caddy reload --config C:\caddy\Caddyfile
```

## Docker-Compose Full Stack

Deploy Emby + monitoring:

```yaml
version: '3.8'
services:
  emby:
    image: lscr.io/linuxserver/emby:latest
    container_name: emby
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=America/New_York
    volumes:
      - ./emby:/config
      - /media/movies:/data/movies
      - /media/tv:/data/tv
    ports:
      - "8096:8096"
    restart: unless-stopped
```

Deploy:
```bash
docker-compose up -d
```

Then use App Selector to add reverse proxy!

## Next Steps After Deployment

1. **Initial Setup**: Visit `https://emby.sami` and complete wizard
2. **Add Libraries**: Settings → Library → Add Media Library
3. **Install Clients**: Get Emby apps for your devices
4. **Configure Transcoding**: Settings → Transcoding (enable hardware if supported)
5. **Setup Users**: Settings → Users → Add User

## Need Help?

- Full guide: See [EMBY_DEPLOYMENT.md](EMBY_DEPLOYMENT.md)
- API docs: See [api/README.md](api/README.md)
- General setup: See [DEPLOYMENT_GUIDE.md](DEPLOYMENT_GUIDE.md)

## One-Liner Docker + Dashboard Deploy

```bash
# Start Emby
docker run -d --name=emby -p 8096:8096 -e TZ=America/New_York -v ./emby:/config lscr.io/linuxserver/emby:latest

# Then open https://status.sami and use App Selector!
```

That's it! 🎬
