v1.0 - Version stable: multi-PC, détection UI-DETR-1, 3 modes exécution
- Frontend v4 accessible sur réseau local (192.168.1.40) - Ports ouverts: 3002 (frontend), 5001 (backend), 5004 (dashboard) - Ollama GPU fonctionnel - Self-healing interactif - Dashboard confiance Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
93
server/install_prod_stack.sh
Executable file
93
server/install_prod_stack.sh
Executable file
@@ -0,0 +1,93 @@
|
||||
#!/usr/bin/env bash
|
||||
# server/install_prod_stack.sh
|
||||
#
|
||||
# Fiche #21 (prod): installation systemd + env + timers (healthcheck + retention)
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [[ "${EUID}" -ne 0 ]]; then
|
||||
echo "❌ Ce script doit être exécuté en root (sudo)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
INSTALL_DIR="${INSTALL_DIR:-/opt/rpa_vision_v3}"
|
||||
SERVICE_USER="${SERVICE_USER:-rpa}"
|
||||
|
||||
echo "========================================"
|
||||
echo "Installation RPA Vision V3 - PROD stack"
|
||||
echo "========================================"
|
||||
|
||||
# 1) Utilisateur
|
||||
if ! id "$SERVICE_USER" &>/dev/null; then
|
||||
echo "📝 Création utilisateur $SERVICE_USER"
|
||||
useradd --system --no-create-home --shell /bin/false "$SERVICE_USER"
|
||||
fi
|
||||
|
||||
# 2) Vérifier le répertoire
|
||||
if [[ ! -d "$INSTALL_DIR" ]]; then
|
||||
echo "❌ Répertoire $INSTALL_DIR introuvable." >&2
|
||||
echo " Copiez le projet dans $INSTALL_DIR puis relancez." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 3) Dossiers data/logs
|
||||
mkdir -p "$INSTALL_DIR/data" "$INSTALL_DIR/logs" "$INSTALL_DIR/data/runtime/health" "$INSTALL_DIR/data/archives"
|
||||
chown -R "$SERVICE_USER":"$SERVICE_USER" "$INSTALL_DIR/data" "$INSTALL_DIR/logs"
|
||||
|
||||
# 4) Env file
|
||||
mkdir -p /etc/rpa_vision_v3
|
||||
if [[ ! -f /etc/rpa_vision_v3/rpa_vision_v3.env ]]; then
|
||||
echo "📝 Création /etc/rpa_vision_v3/rpa_vision_v3.env (template)"
|
||||
cp "$INSTALL_DIR/deploy/systemd/rpa_vision_v3.env.example" /etc/rpa_vision_v3/rpa_vision_v3.env
|
||||
# Lecture nécessaire pour l'utilisateur systemd (rpa)
|
||||
chown root:"$SERVICE_USER" /etc/rpa_vision_v3/rpa_vision_v3.env
|
||||
chmod 640 /etc/rpa_vision_v3/rpa_vision_v3.env
|
||||
else
|
||||
echo "✅ Env file déjà présent : /etc/rpa_vision_v3/rpa_vision_v3.env"
|
||||
# Si un ancien chmod 600 root:root traîne, on sécurise sans casser systemd
|
||||
chown root:"$SERVICE_USER" /etc/rpa_vision_v3/rpa_vision_v3.env || true
|
||||
chmod 640 /etc/rpa_vision_v3/rpa_vision_v3.env || true
|
||||
fi
|
||||
|
||||
# 4.b) Génération automatique des secrets/tokens (anti-oubli)
|
||||
chmod +x "$INSTALL_DIR/server/bootstrap_secrets_env.sh" "$INSTALL_DIR/server/validate_secrets.sh" 2>/dev/null || true
|
||||
echo "🔐 Génération automatique des secrets/tokens (si placeholder)"
|
||||
"$INSTALL_DIR/server/bootstrap_secrets_env.sh" /etc/rpa_vision_v3/rpa_vision_v3.env
|
||||
"$INSTALL_DIR/server/validate_secrets.sh" /etc/rpa_vision_v3/rpa_vision_v3.env
|
||||
|
||||
# 5) systemd units
|
||||
echo "📝 Installation unités systemd"
|
||||
cp "$INSTALL_DIR"/deploy/systemd/*.service /etc/systemd/system/
|
||||
cp "$INSTALL_DIR"/deploy/systemd/*.timer /etc/systemd/system/
|
||||
|
||||
# 6) Exécutables
|
||||
chmod +x "$INSTALL_DIR/server/healthcheck.sh" || true
|
||||
|
||||
# 7) logrotate (optionnel)
|
||||
if [[ -d /etc/logrotate.d ]]; then
|
||||
cp "$INSTALL_DIR/deploy/logrotate/rpa-vision-v3" /etc/logrotate.d/rpa-vision-v3
|
||||
fi
|
||||
|
||||
systemctl daemon-reload
|
||||
|
||||
# 8) Enable
|
||||
systemctl enable rpa-vision-v3-api.service
|
||||
systemctl enable rpa-vision-v3-dashboard.service
|
||||
systemctl enable rpa-vision-v3-healthcheck.timer
|
||||
systemctl enable rpa-vision-v3-artifact-retention.timer
|
||||
|
||||
# Worker external : on enable mais l'API doit être configurée en external (env)
|
||||
systemctl enable rpa-vision-v3-worker.service || true
|
||||
|
||||
echo ""
|
||||
echo "✅ Install terminé. Prochaines étapes :"
|
||||
echo "1) Vérifier (et si besoin ajuster) : nano /etc/rpa_vision_v3/rpa_vision_v3.env"
|
||||
echo " - Tokens générés automatiquement (RPA_TOKEN_*, AUTOHEAL_ADMIN_TOKEN)"
|
||||
echo " - Secrets (ENCRYPTION_PASSWORD, SECRET_KEY)"
|
||||
echo "2) Choisir le mode worker : RPA_PROCESSING_WORKER=thread|external|disabled"
|
||||
echo "3) Démarrer :"
|
||||
echo " systemctl start rpa-vision-v3-api rpa-vision-v3-dashboard rpa-vision-v3-worker"
|
||||
echo "4) Vérifier :"
|
||||
echo " systemctl status rpa-vision-v3-api rpa-vision-v3-dashboard rpa-vision-v3-worker"
|
||||
echo " journalctl -u rpa-vision-v3-api -f"
|
||||
echo ""
|
||||
Reference in New Issue
Block a user