Inhaltsverzeichnis
Runbook: Config-Backup
Durata: ~5 minuti
Ruolo: Sysadmin
Frequenza: Dopo ogni modifica, settimanale
Backup della configurazione Gateway e certificati.
Workflow
flowchart TD
A[Start] --> B[Identificare file]
B --> C[Creare archivio]
C --> D[Copiare su storage backup]
D --> E[Verificare integrita]
E --> F{OK?}
F -->|Si| G[Documentare]
F -->|No| H[Ripetere backup]
style G fill:#e8f5e9
style H fill:#ffebee
1. File da Salvare
| File/Cartella | Descrizione | Critico |
| ————– | ————– | ———- |
appsettings.json | Configurazione principale | v |
appsettings.Production.json | Override produzione | v |
certs/ | Certificati TLS | v |
data/*.db | Database SQLite | v |
.env | Variabili ambiente (se presente) | v |
2. Backup Manuale
Linux:
#!/bin/bash # backup-gateway.sh GATEWAY_DIR="/opt/data-gateway" BACKUP_DIR="/backup/gateway" DATE=$(date +%Y%m%d_%H%M%S) BACKUP_FILE="gateway-config-${DATE}.tar.gz" # Creare archivio tar -czvf "${BACKUP_DIR}/${BACKUP_FILE}" \ -C "${GATEWAY_DIR}" \ appsettings.json \ appsettings.Production.json \ certs/ \ data/ # Creare checksum sha256sum "${BACKUP_DIR}/${BACKUP_FILE}" > "${BACKUP_DIR}/${BACKUP_FILE}.sha256" # Eliminare backup vecchi (oltre 30 giorni) find "${BACKUP_DIR}" -name "gateway-config-*.tar.gz" -mtime +30 -delete echo "Backup creato: ${BACKUP_FILE}"
Windows (PowerShell):
# backup-gateway.ps1 $GatewayDir = "%GATEWAY_ROOT%" $BackupDir = "D:\Backup\Gateway" $Date = Get-Date -Format "yyyyMMdd_HHmmss" $BackupFile = "gateway-config-$Date.zip" # Creare archivio Compress-Archive -Path @( "$GatewayDir\appsettings.json", "$GatewayDir\appsettings.Production.json", "$GatewayDir\certs", "$GatewayDir\data" ) -DestinationPath "$BackupDir\$BackupFile" # Checksum Get-FileHash "$BackupDir\$BackupFile" -Algorithm SHA256 | Select-Object Hash | Out-File "$BackupDir\$BackupFile.sha256" # Eliminare backup vecchi (oltre 30 giorni) Get-ChildItem "$BackupDir\gateway-config-*.zip" | Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-30) } | Remove-Item Write-Host "Backup creato: $BackupFile"
3. Backup Automatizzato
Linux (Cron):
# /etc/cron.d/gateway-backup 0 2 * * * root /opt/scripts/backup-gateway.sh >> /var/log/gateway-backup.log 2>&1
Windows (Task Scheduler):
# Creare Task $Action = New-ScheduledTaskAction -Execute "PowerShell.exe" ` -Argument "-File %SCRIPTS_PATH%\backup-gateway.ps1" $Trigger = New-ScheduledTaskTrigger -Daily -At 2:00AM $Principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -RunLevel Highest Register-ScheduledTask -TaskName "Gateway Backup" ` -Action $Action -Trigger $Trigger -Principal $Principal
4. Backup su Storage Remoto
Rsync (Linux → NAS):
rsync -avz --delete \ /backup/gateway/ \ user@nas.example.com:/volume1/backups/gateway/
AWS S3:
aws s3 cp /backup/gateway/gateway-config-*.tar.gz \ s3://my-backups/gateway/ \ --storage-class STANDARD_IA
Azure Blob:
az storage blob upload \
--account-name mybackups \
--container-name gateway \
--file /backup/gateway/gateway-config-*.tar.gz \
--name gateway-config-$(date +%Y%m%d).tar.gz
5. Restore (Ripristino)
# Linux cd /opt/data-gateway tar -xzvf /backup/gateway/gateway-config-20241215.tar.gz # Ripristinare permessi chown -R datagateway:datagateway /opt/data-gateway chmod 600 /opt/data-gateway/certs/* # Riavviare Gateway sudo systemctl restart data-gateway
# Windows Expand-Archive -Path "D:\Backup\Gateway\gateway-config-20241215.zip" ` -DestinationPath "%GATEWAY_ROOT%" -Force Restart-Service -Name "DataGateway"
6. Checklist
| # | Punto di verifica | v |
| — | ———– | — |
| 1 | appsettings.json salvato | ☐ |
| 2 | Certificati salvati | ☐ |
| 3 | SQLite-DB salvati | ☐ |
| 4 | Checksum creato | ☐ |
| 5 | Copiato su storage remoto | ☐ |
| 6 | Restore testato | ☐ |
Troubleshooting
| Problema | Causa | Soluzione |
| ——— | ——— | ——– |
Permission denied | Permessi mancanti | Eseguire come root/Admin |
No space left | Spazio esaurito | Eliminare backup vecchi |
Checksum mismatch | Archivio corrotto | Ripetere backup |
| Restore fallito | Permessi errati | eseguire chown/chmod |
Best Practices
Regola 3-2-1 Backup:
- 3 copie dei dati
- 2 supporti diversi (locale + Cloud)
- 1 copia offsite
Runbook Correlati
- DSN-Export - Salvare definizioni DSN
- Rinnovare certificato - Salvare prima del rinnovo
- Avviare server - Dopo Restore
« <- Backup | -> DSN-Export »
Wolfgang van der Stille @ EMSR DATA d.o.o. - Data Gateway Professional
Zuletzt geändert: il 29/01/2026 alle 23:34