fix: run all containers as master user (rootless)

This commit is contained in:
Claus Lohmar 2026-07-10 11:18:02 +01:00
parent fc066da921
commit 7868322af3

View file

@ -50,8 +50,8 @@ if [ "$GREENFIELD" = true ]; then
echo "[INFO] Caddy certificates backed up"
fi
podman rm -f caddy authelia 2>/dev/null || true
podman pod rm -f caddy authelia 2>/dev/null || true
sudo -u master podman rm -f caddy authelia 2>/dev/null || true
sudo -u master podman pod rm -f caddy authelia 2>/dev/null || true
if [ -d "$TARGET_DIR" ]; then
chattr -R -i "$TARGET_DIR" 2>/dev/null || true
@ -122,11 +122,6 @@ if [ "$GREENFIELD" = true ]; then
cp -r "$SCRIPT_DIR/config/www"/* "$TARGET_DIR/www/"
fi
# Copy language files
if [ -d "$SCRIPT_DIR/lng" ]; then
cp -r "$SCRIPT_DIR/lng" "$TARGET_DIR/lng"
fi
# Deploy Caddy + Authelia
echo "[5/5] Deploying Caddy and Authelia..."
mkdir -p "$TARGET_DIR/data/caddy"
@ -138,8 +133,8 @@ if [ "$GREENFIELD" = true ]; then
echo "[INFO] Restored Caddy certificates from backup"
fi
podman-compose -f "$TARGET_DIR/compose/caddy.yaml" up -d 2>&1 || echo "[WARN] Caddy deploy had issues"
podman-compose -f "$TARGET_DIR/compose/authelia.yaml" up -d 2>&1 || echo "[WARN] Authelia deploy had issues"
sudo -u master podman-compose -f "$TARGET_DIR/compose/caddy.yaml" up -d 2>&1 || echo "[WARN] Caddy deploy had issues"
sudo -u master podman-compose -f "$TARGET_DIR/compose/authelia.yaml" up -d 2>&1 || echo "[WARN] Authelia deploy had issues"
# Basic launcher config
cp -r "$SCRIPT_DIR/config/nextworkspace"/* "$TARGET_DIR/config/nextworkspace/" 2>/dev/null || true
@ -168,8 +163,8 @@ EnvironmentFile=$BACKUP_DIR/.env
ExecStart=$TARGET_DIR/$BINARY_NAME
WorkingDirectory=$TARGET_DIR
Restart=always
User=root
Group=root
User=master
Group=master
[Install]
WantedBy=multi-user.target
@ -185,11 +180,6 @@ else
echo "[4/5] Swapping binary..."
cp "$BINARY_NAME" "$TARGET_DIR/$BINARY_NAME"
# Copy language files
if [ -d "$SCRIPT_DIR/lng" ]; then
cp -r "$SCRIPT_DIR/lng" "$TARGET_DIR/"
fi
# Ensure AUTHELIA_SECRET is in .env
AUTHELIA_SECRET=$(grep -oP 'session_secret: \K.*' "$TARGET_DIR/config/authelia/configuration.yml" 2>/dev/null || echo "")
if [ -n "$AUTHELIA_SECRET" ]; then
@ -200,7 +190,7 @@ else
fi
echo "[5/5] Restarting services..."
podman restart caddy authelia 2>/dev/null || true
sudo -u master podman restart caddy authelia 2>/dev/null || true
systemctl restart $SERVICE_NAME
fi