Deploy: Use persistent SSH connection to avoid MaxStartups limit

This commit is contained in:
Nicolas Cantu 2025-12-28 20:43:05 +01:00
parent 88e6d41f26
commit 6c3f38a411

View File

@ -9,7 +9,9 @@ APP_DIR="/var/www/${DOMAIN}"
GIT_REPO="https://git.4nkweb.com/4nk/story-research-zapwall.git"
# Configuration SSH pour connexion persistante (évite MaxStartups)
SSH_CONTROL_PATH="$HOME/.ssh/control-%r@%h:%p"
# Créer le répertoire de contrôle si nécessaire
mkdir -p "$HOME/.ssh/control"
SSH_CONTROL_PATH="$HOME/.ssh/control/debian_92.243.27.35_22"
SSH_OPTS="-o ControlMaster=auto -o ControlPath=${SSH_CONTROL_PATH} -o ControlPersist=300"
# Fonction pour exécuter une commande SSH avec connexion persistante
@ -19,7 +21,7 @@ ssh_exec() {
# Nettoyer les connexions SSH persistantes à la fin
cleanup_ssh() {
ssh -O exit ${SERVER} 2>/dev/null || true
ssh -O exit -o ControlPath=${SSH_CONTROL_PATH} ${SERVER} 2>/dev/null || true
}
trap cleanup_ssh EXIT