voice-agent/.claude/skills/ssh-deploy.md
Christian Mueller c5808dbf55 feat: add Proxmox LXC skill for container provisioning
- New /proxmox-lxc skill: create, configure, and manage LXC containers
  on Proxmox servers via API and SSH
- Includes Node.js/Docker base setup, Nginx reverse proxy templates
- Integrated into /ssh-deploy and /workflow orchestrator
- New workflow: /workflow provision for full LXC + deploy pipeline
- Added PVE config section to project.env.template

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 21:54:12 +01:00

87 lines
2.3 KiB
Markdown

---
name: ssh-deploy
description: Remote-Deployment und Debugging via SSH auf Linux Test-Maschinen
user_invocable: true
---
Du bist ein SSH-Deploy-Agent für Remote-Testing und Deployment auf Linux-Servern.
## KONFIGURATION
```
SSH_HOST=$SSH_HOST
SSH_PORT=$SSH_PORT (default: 22)
SSH_USER=$SSH_USER
SSH_KEY_PATH=$SSH_KEY_PATH (default: ~/.ssh/id_rsa)
DEPLOY_PATH=$DEPLOY_PATH (default: /var/www/app)
```
## DEPLOYMENT-PROZESS
1. SSH-Verbindung testen: `ssh -i $SSH_KEY_PATH -p $SSH_PORT $SSH_USER@$SSH_HOST "echo ok"`
2. Backup erstellen: `tar -czf backup_$(date +%Y%m%d_%H%M%S).tar.gz $DEPLOY_PATH`
3. Code synchronisieren (rsync oder git pull)
4. Dependencies installieren: `npm ci --production`
5. Build ausführen: `npm run build`
6. Service neu starten
7. Health-Check durchführen
### Rsync-Deploy
```bash
rsync -avz --delete \
--exclude 'node_modules' \
--exclude '.env' \
--exclude '.git' \
--exclude 'logs' \
-e "ssh -i $SSH_KEY_PATH -p $SSH_PORT" \
./ $SSH_USER@$SSH_HOST:$DEPLOY_PATH/
```
### Docker-Deploy
```bash
ssh -i $SSH_KEY_PATH $SSH_USER@$SSH_HOST << 'EOF'
cd $DEPLOY_PATH
docker compose pull
docker compose up -d --build
docker compose ps
EOF
```
## DEBUGGING-BEFEHLE
```bash
# Logs
ssh ... "tail -100 $DEPLOY_PATH/logs/error.log"
ssh ... "pm2 logs --lines 100"
ssh ... "journalctl -u myapp --since '1 hour ago'"
ssh ... "docker logs --tail 100 container_name"
# Prozess-Status
ssh ... "pm2 status" | "systemctl status myapp" | "docker ps"
# System-Ressourcen
ssh ... "df -h && free -m && uptime"
# Ports
ssh ... "ss -tlnp"
# Health-Check
ssh ... "curl -sf http://localhost:3000/health"
```
## ROLLBACK
Bei fehlgeschlagenem Deployment:
1. Letztes Backup finden: `ls -la backup_*.tar.gz`
2. Wiederherstellen: `tar -xzf backup_<timestamp>.tar.gz -C /`
3. Service neu starten
4. Health-Check
## PROXMOX-LXC INTEGRATION
Wenn die Zielmaschine ein Proxmox LXC-Container ist:
- Nutze `/proxmox-lxc` um einen neuen Container zu erstellen
- Danach diesen Skill (`/ssh-deploy`) mit der LXC-IP als SSH_HOST nutzen
- Snapshots statt tar-Backups: `pct snapshot $VMID snap-before-deploy`
## SICHERHEIT
- SSH-Key niemals im Repository
- Key-Permissions: `chmod 600 ~/.ssh/id_rsa`
- Nur auf Test/Staging deployen - NICHT Produktion ohne explizite Bestätigung
- Vor Deployment immer Backup erstellen