fix: run all containers as master user (rootless)
This commit is contained in:
parent
fc066da921
commit
7868322af3
1 changed files with 7 additions and 17 deletions
24
deploy.sh
24
deploy.sh
|
|
@ -50,8 +50,8 @@ if [ "$GREENFIELD" = true ]; then
|
||||||
echo "[INFO] Caddy certificates backed up"
|
echo "[INFO] Caddy certificates backed up"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
podman rm -f caddy authelia 2>/dev/null || true
|
sudo -u master podman rm -f caddy authelia 2>/dev/null || true
|
||||||
podman pod 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
|
if [ -d "$TARGET_DIR" ]; then
|
||||||
chattr -R -i "$TARGET_DIR" 2>/dev/null || true
|
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/"
|
cp -r "$SCRIPT_DIR/config/www"/* "$TARGET_DIR/www/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy language files
|
|
||||||
if [ -d "$SCRIPT_DIR/lng" ]; then
|
|
||||||
cp -r "$SCRIPT_DIR/lng" "$TARGET_DIR/lng"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Deploy Caddy + Authelia
|
# Deploy Caddy + Authelia
|
||||||
echo "[5/5] Deploying Caddy and Authelia..."
|
echo "[5/5] Deploying Caddy and Authelia..."
|
||||||
mkdir -p "$TARGET_DIR/data/caddy"
|
mkdir -p "$TARGET_DIR/data/caddy"
|
||||||
|
|
@ -138,8 +133,8 @@ if [ "$GREENFIELD" = true ]; then
|
||||||
echo "[INFO] Restored Caddy certificates from backup"
|
echo "[INFO] Restored Caddy certificates from backup"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
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/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/authelia.yaml" up -d 2>&1 || echo "[WARN] Authelia deploy had issues"
|
||||||
|
|
||||||
# Basic launcher config
|
# Basic launcher config
|
||||||
cp -r "$SCRIPT_DIR/config/nextworkspace"/* "$TARGET_DIR/config/nextworkspace/" 2>/dev/null || true
|
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
|
ExecStart=$TARGET_DIR/$BINARY_NAME
|
||||||
WorkingDirectory=$TARGET_DIR
|
WorkingDirectory=$TARGET_DIR
|
||||||
Restart=always
|
Restart=always
|
||||||
User=root
|
User=master
|
||||||
Group=root
|
Group=master
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
@ -185,11 +180,6 @@ else
|
||||||
echo "[4/5] Swapping binary..."
|
echo "[4/5] Swapping binary..."
|
||||||
cp "$BINARY_NAME" "$TARGET_DIR/$BINARY_NAME"
|
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
|
# Ensure AUTHELIA_SECRET is in .env
|
||||||
AUTHELIA_SECRET=$(grep -oP 'session_secret: \K.*' "$TARGET_DIR/config/authelia/configuration.yml" 2>/dev/null || echo "")
|
AUTHELIA_SECRET=$(grep -oP 'session_secret: \K.*' "$TARGET_DIR/config/authelia/configuration.yml" 2>/dev/null || echo "")
|
||||||
if [ -n "$AUTHELIA_SECRET" ]; then
|
if [ -n "$AUTHELIA_SECRET" ]; then
|
||||||
|
|
@ -200,7 +190,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[5/5] Restarting services..."
|
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
|
systemctl restart $SERVICE_NAME
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue