fix(gitea): ordonnancer tailscale avant rsyslog, retirer gcompat

configure_rsyslog_forwarder() cible SYSLOG_TARGET, un nom MagicDNS.
Il tournait avant configure_tailscale_proxy() dans install_inside_lxc()
et update_inside_lxc() : au moment où rc-service rsyslog start
s'exécutait, tailscale up n'avait pas encore tourné, le nom ne
résolvait pas, et omfwd démarrait cassé jusqu'à un redémarrage manuel.
Pire avec TS_AUTHKEY absent : configure_tailscale_proxy() retourne tôt
avec un warning, et rsyslog restait cassé jusqu'à ce que l'opérateur
relance après son tailscale up manuel.

configure_tailscale_proxy est désormais appelée avant
configure_rsyslog_forwarder dans les deux fonctions. Comme la
résolution MagicDNS peut prendre quelques secondes après tailscale up,
ajoute une attente bornée (30s) sur getent hosts "$SYSLOG_TARGET" avant
de démarrer rsyslog — même pattern que le start_pre() de
gitea-runner/install.sh. Non bloquant : au-delà du délai, un
avertissement est affiché et rsyslog démarre quand même (l'opérateur
peut relancer le script une fois la résolution effective).

Retire aussi gcompat des dépendances apk (couche de compatibilité
glibc, résidu de l'approche binaire téléchargé abandonnée au profit de
apk add gitea — précisément ce que l'en-tête du script explique vouloir
éviter) et remplace apk list -I (parcourt tout l'index des paquets) par
apk info -e -v gitea (interrogation directe du paquet) dans le MOTD et
le message de fin de update_inside_lxc.
This commit is contained in:
Damien
2026-08-01 18:16:57 +02:00
parent f71abf9b23
commit 1d94d57403
+28 -6
View File
@@ -289,6 +289,24 @@ EOF
rc-update add rsyslog default >/dev/null 2>&1 || true rc-update add rsyslog default >/dev/null 2>&1 || true
rc-service rsyslog status >/dev/null 2>&1 && rc-service rsyslog stop rc-service rsyslog status >/dev/null 2>&1 && rc-service rsyslog stop
# SYSLOG_TARGET is a MagicDNS name; omfwd resolves it once at rsyslog
# startup, so starting before Tailscale has come up and propagated the
# name would leave the forwarder silently broken until the next restart.
# Same bounded-wait pattern as gitea-runner/install.sh's start_pre().
# configure_tailscale_proxy() must already have run by the time we get
# here — do not reorder that.
local tries=0
until getent hosts "$SYSLOG_TARGET" >/dev/null 2>&1; do
tries=$((tries + 1))
if (( tries > 30 )); then
log_warn "Could not resolve ${SYSLOG_TARGET} after 30s — starting rsyslog anyway."
log_warn "Forwarding will stay broken until the name resolves and rsyslog is restarted (rerun this script)."
break
fi
sleep 1
done
rc-service rsyslog start rc-service rsyslog start
} }
@@ -477,7 +495,7 @@ install_inside_lxc() {
check_gitea_channel check_gitea_channel
log_info "Installing dependencies..." log_info "Installing dependencies..."
apk add --no-cache bash curl jq ca-certificates openssl gcompat openrc tailscale >/dev/null apk add --no-cache bash curl jq ca-certificates openssl openrc tailscale >/dev/null
log_info "Installing gitea + gitea-openrc..." log_info "Installing gitea + gitea-openrc..."
apk add --no-cache gitea gitea-openrc >/dev/null apk add --no-cache gitea gitea-openrc >/dev/null
@@ -496,6 +514,10 @@ install_inside_lxc() {
wait_for_gitea_ready wait_for_gitea_ready
create_admin_user create_admin_user
configure_tailscale_proxy
# SYSLOG_TARGET is a MagicDNS name — must run after configure_tailscale_proxy
# so the tailnet (and MagicDNS) is actually up by the time rsyslog starts.
configure_rsyslog_forwarder configure_rsyslog_forwarder
log_info "Configuring logrotate for ${GITEA_LOG_DIR}/gitea.log..." log_info "Configuring logrotate for ${GITEA_LOG_DIR}/gitea.log..."
@@ -514,8 +536,6 @@ EOF
enable_tty1_autologin enable_tty1_autologin
configure_tailscale_proxy
log_info "Configuring MOTD..." log_info "Configuring MOTD..."
# /etc/profile.d/ runs for every interactive login shell — works for both # /etc/profile.d/ runs for every interactive login shell — works for both
# the auto-login tty and Tailscale SSH. Quoted heredoc: every variable is # the auto-login tty and Tailscale SSH. Quoted heredoc: every variable is
@@ -528,7 +548,7 @@ TS_FQDN=$(tailscale status --json 2>/dev/null | awk -F'"' '
') ')
[[ -z "$TS_FQDN" ]] && TS_FQDN="$(hostname).ts.net" [[ -z "$TS_FQDN" ]] && TS_FQDN="$(hostname).ts.net"
GITEA_VERSION=$(apk list -I 2>/dev/null | awk '/^gitea-[0-9]/{print $1; exit}' | sed 's/^gitea-//') GITEA_VERSION=$(apk info -e -v gitea 2>/dev/null | sed 's/^gitea-//')
[[ -z "$GITEA_VERSION" ]] && GITEA_VERSION="unknown" [[ -z "$GITEA_VERSION" ]] && GITEA_VERSION="unknown"
if rc-service gitea status >/dev/null 2>&1; then if rc-service gitea status >/dev/null 2>&1; then
@@ -593,10 +613,12 @@ update_inside_lxc() {
rc-service gitea start rc-service gitea start
wait_for_gitea_ready wait_for_gitea_ready
configure_rsyslog_forwarder
configure_tailscale_proxy configure_tailscale_proxy
# SYSLOG_TARGET is a MagicDNS name — must run after configure_tailscale_proxy
# so the tailnet (and MagicDNS) is actually up by the time rsyslog starts.
configure_rsyslog_forwarder
log_info "Gitea version: $(apk list -I 2>/dev/null | awk '/^gitea-[0-9]/{print $1; exit}')" log_info "Gitea version: $(apk info -e -v gitea 2>/dev/null)"
log_info "Update complete." log_info "Update complete."
} }