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:
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 ==="
|
||||
Reference in New Issue
Block a user