V0.1 de la migration vers systemd

This commit is contained in:
Mathis 2026-07-12 15:01:47 +02:00
parent b23c0dde53
commit 016ac85bc7
9 changed files with 142 additions and 24 deletions

View file

@ -17,9 +17,6 @@ PROCESS_NAME = "kuby"
# webhook de logs Discord
DISCORD_LOG_URL = "https://discord.com/api/webhooks/1482148910888652910/IA9CcOWtjGswbuxMaOu_6uaclv5zojZo4ttxtV6RYyZzJ9gW7BF7xp_Zv3oPIjYEuh8o"
# Chemin vers PM2
PM2_BINARY = "/home/discord/.nvm/versions/node/v24.15.0/bin/pm2"
# Bot Local Proxy (Relai vers le Cog de ton bot)
BOT_LOCAL_URL = "http://127.0.0.1:5001/bot_event"
@ -88,13 +85,8 @@ def run_mep_logic(author, commit_msg, branch="main"):
if use_rsync:
subprocess.run(["rsync", "-a", "--exclude=.git", "--exclude=venv", "--exclude=.venv", "--exclude=__pycache__", f"{target_path}/", f"{PROJECT_PATH}/"], check=True)
# 3. PM2 Restart
subprocess.run(
[PM2_BINARY, "restart", PROCESS_NAME],
check=True,
capture_output=True,
text=True
)
# 3. Redémarrage via systemd
subprocess.run(["systemctl", "restart", "kuby-bot.service"], check=True, capture_output=True, text=True)
duration = (datetime.now() - start_time).total_seconds()
msg = f"✅ **Déploiement réussi en {duration:.2f}s**\nLe bot est à jour sur Forgejo et redémarré."