fix: backup/restore Caddy certs to /opt/backup/certificates/
This commit is contained in:
parent
f8468270af
commit
9b71a13197
1 changed files with 18 additions and 0 deletions
18
deploy.sh
18
deploy.sh
|
|
@ -41,6 +41,15 @@ if [ "$GREENFIELD" = true ]; then
|
||||||
systemctl disable $SERVICE_NAME 2>/dev/null || true
|
systemctl disable $SERVICE_NAME 2>/dev/null || true
|
||||||
rm -f /etc/systemd/system/$SERVICE_NAME.service
|
rm -f /etc/systemd/system/$SERVICE_NAME.service
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
|
|
||||||
|
# Backup Caddy certs before destroying
|
||||||
|
CADDY_CERTS="$TARGET_DIR/data/caddy/caddy/certificates"
|
||||||
|
if [ -d "$CADDY_CERTS" ]; then
|
||||||
|
mkdir -p "$BACKUP_DIR/certificates"
|
||||||
|
cp -r "$CADDY_CERTS"/* "$BACKUP_DIR/certificates/" 2>/dev/null || true
|
||||||
|
echo "[INFO] Caddy certificates backed up"
|
||||||
|
fi
|
||||||
|
|
||||||
podman rm -f caddy authelia 2>/dev/null || true
|
podman rm -f caddy authelia 2>/dev/null || true
|
||||||
|
|
||||||
if [ -d "$TARGET_DIR" ]; then
|
if [ -d "$TARGET_DIR" ]; then
|
||||||
|
|
@ -110,6 +119,15 @@ if [ "$GREENFIELD" = true ]; then
|
||||||
|
|
||||||
# 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"
|
||||||
|
|
||||||
|
# Restore Caddy certs from backup if available
|
||||||
|
if [ -d "$BACKUP_DIR/certificates/acme-v02" ]; then
|
||||||
|
mkdir -p "$CADDY_CERTS"
|
||||||
|
cp -r "$BACKUP_DIR/certificates"/* "$CADDY_CERTS/" 2>/dev/null || true
|
||||||
|
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/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"
|
podman-compose -f "$TARGET_DIR/compose/authelia.yaml" up -d 2>&1 || echo "[WARN] Authelia deploy had issues"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue