Full codebase including API server (32 modules + routes), dashboard frontend, DashCA certificate distribution, installer script, and deployment skills.
155 lines
3.8 KiB
Markdown
155 lines
3.8 KiB
Markdown
# Deploy Service Skill
|
|
|
|
Deploy Docker containers with complete infrastructure integration (DNS, reverse proxy, dashboard).
|
|
|
|
## When to Use This Skill
|
|
|
|
Activate this skill when the user wants to:
|
|
- Deploy a Docker container
|
|
- Set up a new service
|
|
- Install an application
|
|
- Add a service to the dashboard
|
|
- Run/start/spin up a container
|
|
|
|
## Workflow
|
|
|
|
### 1. Understand Requirements
|
|
|
|
Parse the user's request to identify:
|
|
- Service name (Emby, Jellyfin, Nginx, etc.)
|
|
- Port preferences (if specified)
|
|
- Subdomain preferences (if specified)
|
|
- Volume/storage requirements
|
|
|
|
### 2. Deploy Docker Container
|
|
|
|
Use appropriate Docker image and configuration:
|
|
|
|
```bash
|
|
docker run -d \
|
|
--name <service-name> \
|
|
-p <host-port>:<container-port> \
|
|
-v <host-path>:<container-path> \
|
|
-e <ENV_VAR>=<value> \
|
|
--restart unless-stopped \
|
|
<image:tag>
|
|
```
|
|
|
|
**Get the service IP/host:**
|
|
- If using port mapping → use `localhost` or `127.0.0.1` + host port
|
|
- If using bridge network → get container IP with `docker inspect`
|
|
|
|
### 3. Integrate with Infrastructure
|
|
|
|
Call the automation API (single call does everything):
|
|
|
|
```bash
|
|
curl -X POST http://localhost:3001/api/automation/service/create \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"name": "Display Name",
|
|
"subdomain": "subdomain",
|
|
"ip": "service.ip.address",
|
|
"port": "exposed_port",
|
|
"ttl": 300,
|
|
"token": "ca5f88874d8d8545f387787a7c82a66e39fc61294e38762acd76fc52c2c40d2a",
|
|
"zone": "sami",
|
|
"createDns": true,
|
|
"logo": "/assets/service.png"
|
|
}'
|
|
```
|
|
|
|
This creates:
|
|
- ✓ DNS record (subdomain.sami → IP)
|
|
- ✓ Caddy reverse proxy config
|
|
- ✓ Dashboard entry
|
|
|
|
### 4. Verify & Report
|
|
|
|
- Check container: `docker ps | grep <name>`
|
|
- Test URL: `curl -k https://<subdomain>.sami`
|
|
- Report to user: "Service deployed at https://subdomain.sami"
|
|
|
|
## Common Services
|
|
|
|
### Emby
|
|
```bash
|
|
docker run -d --name emby \
|
|
-p 8096:8096 \
|
|
-v /path/config:/config \
|
|
-v /path/media:/media \
|
|
--restart unless-stopped \
|
|
emby/embyserver:latest
|
|
```
|
|
Then: subdomain=emby, ip=localhost, port=8096
|
|
|
|
### Jellyfin
|
|
```bash
|
|
docker run -d --name jellyfin \
|
|
-p 8096:8096 \
|
|
-v /path/config:/config \
|
|
-v /path/media:/media \
|
|
--restart unless-stopped \
|
|
jellyfin/jellyfin:latest
|
|
```
|
|
Then: subdomain=jellyfin, ip=localhost, port=8096
|
|
|
|
### Portainer
|
|
```bash
|
|
docker run -d --name portainer \
|
|
-p 9000:9000 \
|
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
-v portainer_data:/data \
|
|
--restart unless-stopped \
|
|
portainer/portainer-ce:latest
|
|
```
|
|
Then: subdomain=portainer, ip=localhost, port=9000
|
|
|
|
### Nginx
|
|
```bash
|
|
docker run -d --name nginx \
|
|
-p 8080:80 \
|
|
-v /path/html:/usr/share/nginx/html \
|
|
--restart unless-stopped \
|
|
nginx:alpine
|
|
```
|
|
Then: subdomain=nginx or web, ip=localhost, port=8080
|
|
|
|
### Uptime Kuma
|
|
```bash
|
|
docker run -d --name uptime-kuma \
|
|
-p 3001:3001 \
|
|
-v uptime-kuma:/app/data \
|
|
--restart unless-stopped \
|
|
louislam/uptime-kuma:1
|
|
```
|
|
Then: subdomain=uptime, ip=localhost, port=3001
|
|
|
|
## DNS Token
|
|
|
|
**DNS2 Admin Token:** `ca5f88874d8d8545f387787a7c82a66e39fc61294e38762acd76fc52c2c40d2a`
|
|
|
|
Always use this token in the automation API calls.
|
|
|
|
## Key Points
|
|
|
|
1. **Always use automation API** - it handles DNS + Caddy + Dashboard in one call
|
|
2. **Port mapping** - Host port can differ from container port
|
|
3. **Use localhost** - When using `-p` port mapping, target is `localhost:<host-port>`
|
|
4. **Check conflicts** - Verify port is available before deploying
|
|
5. **Meaningful names** - Subdomain should match service name
|
|
6. **Verify success** - Check container logs if issues arise
|
|
|
|
## Example
|
|
|
|
**User:** "Deploy Emby and put it on my dashboard"
|
|
|
|
**Actions:**
|
|
1. Deploy Emby container on port 8096
|
|
2. Call automation API with:
|
|
- name: "Emby"
|
|
- subdomain: "emby"
|
|
- ip: "localhost"
|
|
- port: "8096"
|
|
3. Verify and report: "Emby deployed at https://emby.sami"
|