deploy: scripts Gitea push + SSH server deploy + nginx web + OpenClaw messages + RUNBOOK
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
32
deploy/README.md
Normal file
32
deploy/README.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# deploy/
|
||||
|
||||
Scripts et messages prêts pour déploiement DauphinCraft quand réseau .86/.89 accessible.
|
||||
|
||||
## Fichiers
|
||||
|
||||
| Fichier | Rôle |
|
||||
|---|---|
|
||||
| `push_to_gitea.sh` | Push code + release v0.1.0 sur Gitea .86 |
|
||||
| `deploy_server_ssh.sh` | Déploie serveur UDP:7777 via SSH sur VM cible |
|
||||
| `deploy_web_nginx.sh` | Upload landing page sur nginx |
|
||||
| `openclaw_messages.md` | Messages copy-paste pour orchestrer via OpenClaw |
|
||||
| `RUNBOOK.md` | Ordre d'exécution complet + troubleshooting |
|
||||
| `install.sh` | Script d'installation côté serveur Linux |
|
||||
| `dauphincraft.service` | Unit systemd pour le serveur |
|
||||
|
||||
## Usage rapide
|
||||
|
||||
```bash
|
||||
cd /c/Users/flopp/Nextcloud2/DauphinCraft
|
||||
|
||||
# Phase 1 — Gitea
|
||||
bash deploy/push_to_gitea.sh
|
||||
|
||||
# Phase 2 — Serveur
|
||||
bash deploy/deploy_server_ssh.sh
|
||||
|
||||
# Phase 3 — Web
|
||||
bash deploy/deploy_web_nginx.sh
|
||||
```
|
||||
|
||||
Voir [RUNBOOK.md](RUNBOOK.md) pour le détail complet.
|
||||
89
deploy/RUNBOOK.md
Normal file
89
deploy/RUNBOOK.md
Normal file
@@ -0,0 +1,89 @@
|
||||
# RUNBOOK — Déploiement DauphinCraft en production
|
||||
|
||||
## Prérequis
|
||||
- Accès réseau VM .86 (Gitea) et VM .89 (OpenClaw)
|
||||
- Credentials : flagabat/SuperTeam2026! (ou floppyrj45)
|
||||
- `sshpass` installé OU `plink`/`pscp` dans le PATH
|
||||
|
||||
## Ordre d'exécution
|
||||
|
||||
### Phase 1 — Push code Gitea (.86)
|
||||
```bash
|
||||
cd /c/Users/flopp/Nextcloud2/DauphinCraft
|
||||
bash deploy/push_to_gitea.sh
|
||||
```
|
||||
Vérifier : `http://192.168.1.86:3000/flagabat/dauphincraft/releases/tag/v0.1.0`
|
||||
|
||||
---
|
||||
|
||||
### Phase 2 — Déploiement serveur dédié
|
||||
```bash
|
||||
bash deploy/deploy_server_ssh.sh
|
||||
```
|
||||
Vérifier sur la VM cible :
|
||||
```bash
|
||||
systemctl status dauphincraft
|
||||
```
|
||||
Test réseau :
|
||||
```bash
|
||||
nc -zvu <SERVER_IP> 7777
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Phase 3 — Landing page web
|
||||
```bash
|
||||
bash deploy/deploy_web_nginx.sh
|
||||
```
|
||||
Vérifier : `curl http://192.168.1.86/` répond 200.
|
||||
|
||||
---
|
||||
|
||||
### Phase 4 — Discord via OpenClaw
|
||||
Suivre `deploy/openclaw_messages.md` dans l'ordre :
|
||||
1. Message 1 — ping Silver Surfer
|
||||
2. Message 4 — créer catégorie + channels Discord
|
||||
3. Message 2 — VM si non existante
|
||||
4. Message 3 — inbox deploy (après Phase 1 et 2)
|
||||
5. Message 5 — webhook Gitea → #build-logs
|
||||
6. Message 6 — description catégorie
|
||||
|
||||
---
|
||||
|
||||
### Phase 5 — Sphinx doc (optionnel)
|
||||
Upload `docs/_build/html/*` vers nginx :
|
||||
```bash
|
||||
sshpass -p SuperTeam2026! scp -r docs/_build/html/* flagabat@192.168.1.86:/var/www/dauphincraft/docs/
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Variables d'environnement (override)
|
||||
| Variable | Défaut | Usage |
|
||||
|---|---|---|
|
||||
| `GITEA_URL` | `http://192.168.1.86:3000` | URL Gitea |
|
||||
| `GITEA_USER` | `flagabat` | User Gitea |
|
||||
| `GITEA_PASS` | `SuperTeam2026!` | Password Gitea |
|
||||
| `REPO_NAME` | `dauphincraft` | Nom repo |
|
||||
| `SERVER_HOST` | `192.168.1.89` | IP serveur jeu |
|
||||
| `SERVER_USER` | `flagabat` | User SSH serveur |
|
||||
| `SERVER_PASS` | `SuperTeam2026!` | Password SSH |
|
||||
| `WEB_HOST` | `192.168.1.86` | IP nginx |
|
||||
| `WEB_ROOT` | `/var/www/dauphincraft` | Racine web |
|
||||
|
||||
Exemple override :
|
||||
```bash
|
||||
SERVER_HOST=192.168.1.95 bash deploy/deploy_server_ssh.sh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
| Symptôme | Solution |
|
||||
|---|---|
|
||||
| SSH timeout | Vérifier route IP et subnet |
|
||||
| Gitea 401 | Vérifier password ou générer jeton API dans Gitea Settings |
|
||||
| Port 7777 fermé | `ufw allow 7777/udp` ou `firewall-cmd --add-port=7777/udp` |
|
||||
| systemd fail | `journalctl -u dauphincraft -n 50` |
|
||||
| sshpass absent | `apt install sshpass` ou utiliser plink (PuTTY) |
|
||||
| Release ID vide | Vérifier git tag `v0.1.0` existe sur master |
|
||||
52
deploy/deploy_server_ssh.sh
Normal file
52
deploy/deploy_server_ssh.sh
Normal file
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
SERVER_HOST="${SERVER_HOST:-192.168.1.89}"
|
||||
SERVER_USER="${SERVER_USER:-flagabat}"
|
||||
SERVER_PASS="${SERVER_PASS:-SuperTeam2026!}"
|
||||
PROJECT_DIR="${PROJECT_DIR:-$(dirname "$0")/..}"
|
||||
DEPLOY_DIR="/tmp/dauphincraft_deploy_$$"
|
||||
|
||||
cd "$PROJECT_DIR"
|
||||
|
||||
# Vérifier artifacts
|
||||
[ -f builds/DauphinCraft-Server-v0.1.tar.gz ] || { echo "ERREUR: builds/DauphinCraft-Server-v0.1.tar.gz manquant"; exit 1; }
|
||||
[ -f deploy/install.sh ] || { echo "ERREUR: deploy/install.sh manquant"; exit 1; }
|
||||
[ -f deploy/dauphincraft.service ] || { echo "ERREUR: deploy/dauphincraft.service manquant"; exit 1; }
|
||||
|
||||
# Fonctions SSH/SCP avec password
|
||||
run_remote() {
|
||||
if command -v sshpass >/dev/null; then
|
||||
sshpass -p "$SERVER_PASS" ssh -o StrictHostKeyChecking=no "$SERVER_USER@$SERVER_HOST" "$@"
|
||||
elif command -v plink >/dev/null; then
|
||||
echo "y" | plink -ssh -pw "$SERVER_PASS" "$SERVER_USER@$SERVER_HOST" "$@"
|
||||
else
|
||||
echo "ERREUR: sshpass ni plink disponibles"; exit 1
|
||||
fi
|
||||
}
|
||||
copy_remote() {
|
||||
if command -v sshpass >/dev/null; then
|
||||
sshpass -p "$SERVER_PASS" scp -o StrictHostKeyChecking=no "$1" "$SERVER_USER@$SERVER_HOST:$2"
|
||||
elif command -v pscp >/dev/null; then
|
||||
echo "y" | pscp -pw "$SERVER_PASS" "$1" "$SERVER_USER@$SERVER_HOST:$2"
|
||||
else
|
||||
echo "ERREUR: scp ni pscp disponibles"; exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
echo "=== Création dossier distant ==="
|
||||
run_remote "mkdir -p $DEPLOY_DIR"
|
||||
|
||||
echo "=== Upload artifacts ==="
|
||||
copy_remote "builds/DauphinCraft-Server-v0.1.tar.gz" "$DEPLOY_DIR/"
|
||||
copy_remote "deploy/install.sh" "$DEPLOY_DIR/"
|
||||
copy_remote "deploy/dauphincraft.service" "$DEPLOY_DIR/"
|
||||
|
||||
echo "=== Extract + install ==="
|
||||
run_remote "cd $DEPLOY_DIR && tar xzf DauphinCraft-Server-v0.1.tar.gz && chmod +x install.sh DauphinCraftServer.x86_64 run_server.sh 2>/dev/null && sudo -S ./install.sh" <<< "$SERVER_PASS"
|
||||
|
||||
echo "=== Vérif service ==="
|
||||
run_remote "systemctl status dauphincraft.service --no-pager 2>&1 | head -15"
|
||||
run_remote "ss -uln | grep 7777"
|
||||
|
||||
echo "=== Deploy terminé ==="
|
||||
41
deploy/deploy_web_nginx.sh
Normal file
41
deploy/deploy_web_nginx.sh
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
WEB_HOST="${WEB_HOST:-192.168.1.86}"
|
||||
WEB_USER="${WEB_USER:-flagabat}"
|
||||
WEB_PASS="${WEB_PASS:-SuperTeam2026!}"
|
||||
WEB_ROOT="${WEB_ROOT:-/var/www/dauphincraft}"
|
||||
PROJECT_DIR="${PROJECT_DIR:-$(dirname "$0")/..}"
|
||||
|
||||
cd "$PROJECT_DIR"
|
||||
[ -d web ] || { echo "ERREUR: web/ manquant"; exit 1; }
|
||||
|
||||
# Tarball de la page
|
||||
tar czf /tmp/dauphincraft_web.tar.gz -C web .
|
||||
|
||||
# Fonctions SSH
|
||||
run_remote() {
|
||||
if command -v sshpass >/dev/null; then
|
||||
sshpass -p "$WEB_PASS" ssh -o StrictHostKeyChecking=no "$WEB_USER@$WEB_HOST" "$@"
|
||||
elif command -v plink >/dev/null; then
|
||||
echo "y" | plink -ssh -pw "$WEB_PASS" "$WEB_USER@$WEB_HOST" "$@"
|
||||
else
|
||||
echo "ERREUR: sshpass ni plink disponibles"; exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Upload tarball
|
||||
echo "=== Upload web assets ==="
|
||||
if command -v sshpass >/dev/null; then
|
||||
sshpass -p "$WEB_PASS" scp -o StrictHostKeyChecking=no /tmp/dauphincraft_web.tar.gz "$WEB_USER@$WEB_HOST:/tmp/"
|
||||
elif command -v pscp >/dev/null; then
|
||||
echo "y" | pscp -pw "$WEB_PASS" /tmp/dauphincraft_web.tar.gz "$WEB_USER@$WEB_HOST:/tmp/"
|
||||
else
|
||||
echo "ERREUR: scp ni pscp disponibles"; exit 1
|
||||
fi
|
||||
|
||||
# Extract + rechargement nginx
|
||||
echo "=== Extract + reload nginx ==="
|
||||
run_remote "sudo mkdir -p $WEB_ROOT && sudo tar xzf /tmp/dauphincraft_web.tar.gz -C $WEB_ROOT && sudo chown -R www-data:www-data $WEB_ROOT && sudo nginx -t && sudo systemctl reload nginx"
|
||||
|
||||
echo "=== Web deployé sur http://$WEB_HOST ==="
|
||||
69
deploy/openclaw_messages.md
Normal file
69
deploy/openclaw_messages.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# Messages OpenClaw pour DauphinCraft
|
||||
|
||||
## Message 1 — Ping initial OpenClaw (test connectivité)
|
||||
**Cible** : `agent:main:discord:channel:1495446723290599554` (Silver Surfer)
|
||||
**Via** :
|
||||
```
|
||||
openclaw sessions send "agent:main:discord:channel:1495446723290599554" "Hello Silver Surfer — projet DauphinCraft prêt au déploiement. Status check."
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Message 2 — Demande création VM Linux
|
||||
**Via** :
|
||||
```
|
||||
openclaw sessions send "agent:main:ops" "CREATE_VM: name=dauphincraft-srv, os=debian12, cpu=1, ram=1024, disk=5G, ip=192.168.1.XX (à choisir)"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Message 3 — Dépose du binaire serveur dans inbox
|
||||
**Via** : fichier déposé dans `~/.openclaw/workspace/inbox/dauphincraft_deploy.json`
|
||||
|
||||
Contenu du fichier :
|
||||
```json
|
||||
{
|
||||
"action": "deploy_game_server",
|
||||
"project": "dauphincraft",
|
||||
"artifact_url": "http://192.168.1.86:3000/flagabat/dauphincraft/releases/download/v0.1.0/DauphinCraft-Server-v0.1.tar.gz",
|
||||
"target_vm": "dauphincraft-srv",
|
||||
"port": 7777,
|
||||
"systemd_service": "dauphincraft.service",
|
||||
"install_script": "install.sh"
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Message 4 — Catégorie Discord "DauphinCraft"
|
||||
**Via** :
|
||||
```
|
||||
openclaw sessions send "agent:main:discord:labo" "CREATE_CATEGORY: name=DauphinCraft, channels=[annonces,bugs,features,build-logs,serveur-status]"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Message 5 — Webhook Gitea → Discord build-logs
|
||||
**Via** : message Silver Surfer
|
||||
```
|
||||
openclaw sessions send "agent:main:discord:channel:1495446723290599554" "Setup webhook Gitea repo dauphincraft → Discord channel #dauphincraft-build-logs pour notifier commits + releases."
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Message 6 — Description catégorie
|
||||
**Via** : Silver Surfer
|
||||
```
|
||||
openclaw sessions send "agent:main:discord:channel:1495446723290599554" "Mets une description à la catégorie DauphinCraft : 'Jeu voxel sous-marin multi — serveur: <IP>:7777 — download: <URL>'."
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Ordre recommandé
|
||||
1. Message 1 (ping test)
|
||||
2. Message 4 (créer channels Discord)
|
||||
3. Message 2 (VM si pas déjà existante)
|
||||
4. Exécuter `deploy/push_to_gitea.sh` (code + release)
|
||||
5. Message 3 (inbox deploy)
|
||||
6. Message 5 (webhook)
|
||||
7. Message 6 (description)
|
||||
56
deploy/push_to_gitea.sh
Normal file
56
deploy/push_to_gitea.sh
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
# Push DauphinCraft vers Gitea .86
|
||||
set -e
|
||||
|
||||
GITEA_URL="${GITEA_URL:-http://192.168.1.86:3000}"
|
||||
GITEA_USER="${GITEA_USER:-flagabat}"
|
||||
GITEA_PASS="${GITEA_PASS:-SuperTeam2026!}"
|
||||
REPO_NAME="${REPO_NAME:-dauphincraft}"
|
||||
PROJECT_DIR="${PROJECT_DIR:-$(dirname "$0")/..}"
|
||||
|
||||
cd "$PROJECT_DIR"
|
||||
|
||||
# 1. Créer repo via API (idempotent)
|
||||
echo "=== Création repo $REPO_NAME ==="
|
||||
curl -s -u "$GITEA_USER:$GITEA_PASS" -X POST "$GITEA_URL/api/v1/user/repos" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"name\":\"$REPO_NAME\",\"description\":\"DauphinCraft — Minecraft-like sous-marin\",\"private\":false,\"auto_init\":false}" \
|
||||
| head -5 || true
|
||||
|
||||
# 2. Ajouter remote Gitea
|
||||
GITEA_REMOTE="$GITEA_URL/$GITEA_USER/$REPO_NAME.git"
|
||||
git remote remove gitea 2>/dev/null || true
|
||||
git remote add gitea "http://$GITEA_USER:$GITEA_PASS@${GITEA_REMOTE#http://}"
|
||||
|
||||
# 3. Push
|
||||
echo "=== Push master vers Gitea ==="
|
||||
git push -u gitea master
|
||||
|
||||
# 4. Créer release v0.1.0 via API
|
||||
echo "=== Création release v0.1.0 ==="
|
||||
RELEASE_JSON=$(curl -s -u "$GITEA_USER:$GITEA_PASS" -X POST "$GITEA_URL/api/v1/repos/$GITEA_USER/$REPO_NAME/releases" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"tag_name":"v0.1.0","target_commitish":"master","name":"v0.1.0 — First beta","body":"## Première beta publique\n\n- Monde voxel procédural sous-marin\n- Dauphin contrôleur, écholocation\n- Inventaire + 5 recettes craft\n- Mobs: poissons, méduses, requin\n- Multijoueur ENet 16 joueurs\n- Ambiance shaders + audio CC0\n\nDownload Windows + Serveur Linux ci-dessous.","draft":false,"prerelease":true}')
|
||||
echo "$RELEASE_JSON" | head -10
|
||||
RELEASE_ID=$(echo "$RELEASE_JSON" | grep -oP '"id":\s*\K\d+' | head -1)
|
||||
|
||||
# 5. Upload artifacts
|
||||
if [ -n "$RELEASE_ID" ]; then
|
||||
echo "=== Upload client Windows ==="
|
||||
[ -f builds/DauphinCraft.exe ] && curl -s -u "$GITEA_USER:$GITEA_PASS" -X POST \
|
||||
"$GITEA_URL/api/v1/repos/$GITEA_USER/$REPO_NAME/releases/$RELEASE_ID/assets?name=DauphinCraft-v0.1-win64.exe" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary "@builds/DauphinCraft.exe" | head -3
|
||||
[ -f builds/DauphinCraft.pck ] && curl -s -u "$GITEA_USER:$GITEA_PASS" -X POST \
|
||||
"$GITEA_URL/api/v1/repos/$GITEA_USER/$REPO_NAME/releases/$RELEASE_ID/assets?name=DauphinCraft-v0.1.pck" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary "@builds/DauphinCraft.pck" | head -3
|
||||
echo "=== Upload serveur Linux ==="
|
||||
[ -f builds/DauphinCraft-Server-v0.1.tar.gz ] && curl -s -u "$GITEA_USER:$GITEA_PASS" -X POST \
|
||||
"$GITEA_URL/api/v1/repos/$GITEA_USER/$REPO_NAME/releases/$RELEASE_ID/assets?name=DauphinCraft-Server-v0.1.tar.gz" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary "@builds/DauphinCraft-Server-v0.1.tar.gz" | head -3
|
||||
fi
|
||||
|
||||
echo "=== Terminé ==="
|
||||
echo "Release URL: $GITEA_URL/$GITEA_USER/$REPO_NAME/releases"
|
||||
Reference in New Issue
Block a user