fix(deploy): déléguer le redéploiement du dashboard à l hôte
This commit is contained in:
@@ -4,6 +4,8 @@ Le script `healthcheck-apps.sh` est exécuté par le timer systemd toutes les ci
|
||||
|
||||
Le dernier rapport est écrit dans `/var/lib/manus-apps-health/latest.txt`. Les anomalies sont aussi consignées dans le journal système avec le tag `manus-apps-health`.
|
||||
|
||||
Les pushes Gitea du dépôt `manus-dashboard` ne recréent jamais le conteneur depuis lui-même. Le webhook dépose une demande atomique, surveillée par `manus-dashboard-self-deploy.path`, puis le service hôte exécute le redéploiement. Cette séparation évite l’arrêt du client Docker avant le démarrage du conteneur de remplacement.
|
||||
|
||||
Après mise à jour Git, installer ou actualiser le service avec :
|
||||
|
||||
```bash
|
||||
|
||||
24
ops/deploy-dashboard-from-host.sh
Normal file
24
ops/deploy-dashboard-from-host.sh
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
# Déploie le dashboard depuis l’hôte systemd, jamais depuis le conteneur lui-même.
|
||||
set -Eeuo pipefail
|
||||
|
||||
readonly APP_DIR="/opt/manus-deploy/apps/manus-dashboard"
|
||||
readonly REQUEST_FILE="${APP_DIR}/.deployment-request"
|
||||
readonly PROCESSING_FILE="${APP_DIR}/.deployment-request.processing"
|
||||
readonly LOCK_FILE="/run/manus-dashboard-self-deploy.lock"
|
||||
|
||||
exec 9>"${LOCK_FILE}"
|
||||
flock -n 9 || exit 0
|
||||
[[ -f "${REQUEST_FILE}" ]] || exit 0
|
||||
mv "${REQUEST_FILE}" "${PROCESSING_FILE}"
|
||||
|
||||
restore_request() {
|
||||
[[ -f "${PROCESSING_FILE}" ]] && mv "${PROCESSING_FILE}" "${REQUEST_FILE}"
|
||||
}
|
||||
trap restore_request ERR
|
||||
|
||||
cd "${APP_DIR}"
|
||||
git pull --ff-only origin main
|
||||
docker compose up -d --build
|
||||
rm -f "${PROCESSING_FILE}"
|
||||
logger -p daemon.info -t manus-dashboard-self-deploy "Dashboard redéployé depuis le service hôte"
|
||||
@@ -7,9 +7,13 @@ readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
install -D -m 0750 "${SCRIPT_DIR}/healthcheck-apps.sh" /opt/manus-deploy/scripts/healthcheck-apps.sh
|
||||
install -D -m 0644 "${SCRIPT_DIR}/manus-apps-health.service" /etc/systemd/system/manus-apps-health.service
|
||||
install -D -m 0644 "${SCRIPT_DIR}/manus-apps-health.timer" /etc/systemd/system/manus-apps-health.timer
|
||||
install -D -m 0750 "${SCRIPT_DIR}/deploy-dashboard-from-host.sh" /opt/manus-deploy/scripts/deploy-dashboard-from-host.sh
|
||||
install -D -m 0644 "${SCRIPT_DIR}/manus-dashboard-self-deploy.service" /etc/systemd/system/manus-dashboard-self-deploy.service
|
||||
install -D -m 0644 "${SCRIPT_DIR}/manus-dashboard-self-deploy.path" /etc/systemd/system/manus-dashboard-self-deploy.path
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl enable --now manus-apps-health.timer
|
||||
systemctl enable --now manus-dashboard-self-deploy.path
|
||||
# Un échec de contrôle doit rester visible dans systemd, sans bloquer l’installation du timer.
|
||||
systemctl start manus-apps-health.service || true
|
||||
systemctl status manus-apps-health.service --no-pager || true
|
||||
|
||||
9
ops/manus-dashboard-self-deploy.path
Normal file
9
ops/manus-dashboard-self-deploy.path
Normal file
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Surveille les demandes de redéploiement du Manus Dashboard
|
||||
|
||||
[Path]
|
||||
PathExists=/opt/manus-deploy/apps/manus-dashboard/.deployment-request
|
||||
Unit=manus-dashboard-self-deploy.service
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
13
ops/manus-dashboard-self-deploy.service
Normal file
13
ops/manus-dashboard-self-deploy.service
Normal file
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Redéploiement hôte du Manus Dashboard
|
||||
After=docker.service network-online.target
|
||||
Requires=docker.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/opt/manus-deploy/scripts/deploy-dashboard-from-host.sh
|
||||
Restart=on-failure
|
||||
RestartSec=1min
|
||||
TimeoutStartSec=10min
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
Reference in New Issue
Block a user