mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 11:09:18 +02:00
fix: deploy-server.sh cleans up legacy posterg configs and prunes old xamxam backups
This commit is contained in:
@@ -48,6 +48,21 @@ chown -R www-data:xamxam /var/www/xamxam/storage/cache
|
||||
chmod -R 2775 /var/www/xamxam/storage/cache
|
||||
ok "Cache dirs: created and owned by www-data:xamxam"
|
||||
|
||||
# ── Step 1b: htpasswd file ──────────────────────────────────────────────────────
|
||||
printf "\n📋 Step 1b: Checking htpasswd file...\n"
|
||||
echo "--------------------------------------"
|
||||
|
||||
if [ -f "/etc/nginx/.htpasswd-xamxam" ]; then
|
||||
ok "htpasswd file exists: /etc/nginx/.htpasswd-xamxam"
|
||||
elif [ -f "/etc/nginx/.htpasswd-posterg" ]; then
|
||||
cp /etc/nginx/.htpasswd-posterg /etc/nginx/.htpasswd-xamxam
|
||||
chmod 644 /etc/nginx/.htpasswd-xamxam
|
||||
ok "Migrated .htpasswd-posterg → .htpasswd-xamxam"
|
||||
else
|
||||
warn "No htpasswd file found — admin panel will return 403 until one is created"
|
||||
warn "Run: sudo htpasswd -c /etc/nginx/.htpasswd-xamxam <username>"
|
||||
fi
|
||||
|
||||
# ── Step 2: Nginx config ──────────────────────────────────────────────────────
|
||||
printf "\n📋 Step 2: Deploying nginx configuration...\n"
|
||||
echo "--------------------------------------------"
|
||||
@@ -72,6 +87,15 @@ if [ -L "/etc/nginx/sites-enabled/posterg" ]; then
|
||||
ok "Removed legacy sites-enabled/posterg symlink"
|
||||
fi
|
||||
|
||||
# Remove legacy posterg config and all its backups from sites-available
|
||||
for f in /etc/nginx/sites-available/posterg /etc/nginx/sites-available/posterg.backup.*; do
|
||||
[ -f "$f" ] && rm "$f" && ok "Removed legacy $f"
|
||||
done
|
||||
|
||||
# Keep only the 2 most recent xamxam backups, delete older ones
|
||||
ls -t /etc/nginx/sites-available/xamxam.backup.* 2>/dev/null | tail -n +3 | xargs -r rm --
|
||||
ok "Pruned old xamxam config backups (kept 2 most recent)"
|
||||
|
||||
if [ ! -L "/etc/nginx/sites-enabled/xamxam" ]; then
|
||||
ln -s /etc/nginx/sites-available/xamxam /etc/nginx/sites-enabled/xamxam
|
||||
ok "Created sites-enabled symlink"
|
||||
|
||||
Reference in New Issue
Block a user