backend: harden rootless app lifecycle orchestration
This commit is contained in:
@@ -431,6 +431,17 @@ fi
|
||||
|
||||
# Rootless podman prerequisites (run as root, configures for archipelago user)
|
||||
log "Setting up rootless podman prerequisites..."
|
||||
if ! command -v catatonit >/dev/null 2>&1; then
|
||||
log "Installing catatonit for Podman init support..."
|
||||
if command -v apt-get >/dev/null 2>&1; then
|
||||
apt-get update >>"$LOG" 2>&1 || true
|
||||
apt-get install -y catatonit >>"$LOG" 2>&1 || true
|
||||
elif command -v dnf >/dev/null 2>&1; then
|
||||
dnf install -y catatonit >>"$LOG" 2>&1 || true
|
||||
elif command -v apk >/dev/null 2>&1; then
|
||||
apk add catatonit >>"$LOG" 2>&1 || true
|
||||
fi
|
||||
fi
|
||||
# Allow binding to ports >= 80 (rootless default is 1024)
|
||||
if ! grep -q "unprivileged_port_start=80" /etc/sysctl.d/99-rootless-podman.conf 2>/dev/null; then
|
||||
echo "net.ipv4.ip_unprivileged_port_start=80" > /etc/sysctl.d/99-rootless-podman.conf
|
||||
@@ -612,7 +623,7 @@ if ! $DOCKER ps --format '{{.Names}}' 2>/dev/null | grep -qE 'bitcoin-knots|arch
|
||||
-v /var/lib/archipelago/bitcoin:/home/bitcoin/.bitcoin \
|
||||
"${BITCOIN_KNOTS_IMAGE}" \
|
||||
$BTC_EXTRA_ARGS \
|
||||
-printtoconsole=1 -dbcache=$BTC_DBCACHE -par=0 -maxconnections=125 2>>"$LOG"; then
|
||||
-printtoconsole=1 -dbcache=$BTC_DBCACHE -par=0 -maxconnections=125 -rpcthreads=16 -rpcworkqueue=256 2>>"$LOG"; then
|
||||
log "Bitcoin Knots started"
|
||||
else
|
||||
log "Bitcoin Knots failed (may already exist)"
|
||||
@@ -1202,7 +1213,13 @@ fi
|
||||
track_container "nginx-proxy-manager"
|
||||
if ! $DOCKER ps --format '{{.Names}}' 2>/dev/null | grep -q portainer; then
|
||||
log "Creating Portainer..."
|
||||
mkdir -p /var/lib/archipelago/portainer
|
||||
mkdir -p /var/lib/archipelago/portainer/compose
|
||||
chown -R archipelago:archipelago /var/lib/archipelago/portainer 2>/dev/null || true
|
||||
if [ ! -e /data ]; then
|
||||
ln -s /var/lib/archipelago/portainer /data 2>/dev/null || true
|
||||
elif [ -d /data ] && [ ! -L /data ] && [ ! -e /data/compose ]; then
|
||||
ln -s /var/lib/archipelago/portainer/compose /data/compose 2>/dev/null || true
|
||||
fi
|
||||
$DOCKER run -d --name portainer --restart unless-stopped \
|
||||
--health-cmd="curl -sf http://localhost:9000/ || exit 1" --health-interval=120s --health-timeout=5s --health-retries=3 \
|
||||
--memory=$(mem_limit portainer) \
|
||||
@@ -1210,7 +1227,8 @@ if ! $DOCKER ps --format '{{.Names}}' 2>/dev/null | grep -q portainer; then
|
||||
--security-opt no-new-privileges:true \
|
||||
-p 9000:9000 \
|
||||
-v /var/lib/archipelago/portainer:/data \
|
||||
-v /var/run/podman/podman.sock:/var/run/docker.sock \
|
||||
-v /var/lib/archipelago/portainer/compose:/data/compose \
|
||||
-v /run/user/$(id -u archipelago)/podman/podman.sock:/var/run/docker.sock \
|
||||
"$PORTAINER_IMAGE" 2>>"$LOG" || true
|
||||
fi
|
||||
track_container "portainer"
|
||||
@@ -1232,7 +1250,7 @@ if ! $DOCKER ps --format '{{.Names}}' 2>/dev/null | grep -q tailscale; then
|
||||
-v /var/lib/archipelago/tailscale:/var/lib/tailscale \
|
||||
-e TS_STATE_DIR=/var/lib/tailscale \
|
||||
"$TAILSCALE_IMAGE" \
|
||||
sh -c 'tailscaled --tun=userspace-networking & sleep 2; tailscale web --listen 0.0.0.0:8240 & wait' 2>>"$LOG" || true
|
||||
sh -c 'tailscaled --tun=userspace-networking & for i in $(seq 1 30); do [ -S /var/run/tailscale/tailscaled.sock ] && break; sleep 1; done; tailscale web --listen 0.0.0.0:8240 & wait' 2>>"$LOG" || true
|
||||
fi
|
||||
track_container "tailscale"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user