v0.5.0: Backup bugfixes + monitoring page with metrics store
- Fix "Helyi mentés" showing "–" after controller restart by synthesizing
LastBackup from snapshot history and LastDBDump from dump files on disk
- New monitoring page (/monitoring) with system info, metrics charts, and
container resource overview
- SQLite metrics store (modernc.org/sqlite, pure Go, no CGO) with 60s
collection interval and 30-day auto-prune
- REST API endpoints: /api/metrics/system, /api/metrics/containers/summary,
/api/metrics/containers/{name}, /api/metrics/sysinfo
- Chart.js 4.4.7 embedded locally for offline environments
- System info provider reads hostname, OS, kernel, CPU, uptime from /proc
- Docker compose updated with /etc/os-release host mount
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -439,6 +439,40 @@ func (m *Manager) GetFullStatus(nextDBDump, nextBackup time.Time) *FullBackupSta
|
||||
for i, j := 0, len(m.cachedStatus.SnapshotHistory)-1; i < j; i, j = i+1, j-1 {
|
||||
m.cachedStatus.SnapshotHistory[i], m.cachedStatus.SnapshotHistory[j] = m.cachedStatus.SnapshotHistory[j], m.cachedStatus.SnapshotHistory[i]
|
||||
}
|
||||
|
||||
// Synthesize LastBackup from snapshot history if not in memory (e.g., after restart)
|
||||
if m.cachedStatus.LastBackup == nil && len(m.cachedStatus.SnapshotHistory) > 0 {
|
||||
latest := m.cachedStatus.SnapshotHistory[0] // already reversed, newest first
|
||||
m.cachedStatus.LastBackup = &BackupStatus{
|
||||
LastRun: latest.Time,
|
||||
Success: latest.Success,
|
||||
Snapshot: &SnapshotResult{
|
||||
SnapshotID: latest.SnapshotID,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// Synthesize LastDBDump from DumpFiles on disk if not in memory
|
||||
if m.cachedStatus.LastDBDump == nil && len(m.cachedStatus.DumpFiles) > 0 {
|
||||
var results []DumpResult
|
||||
var latestTime time.Time
|
||||
for _, f := range m.cachedStatus.DumpFiles {
|
||||
results = append(results, DumpResult{
|
||||
DB: DiscoveredDB{StackName: f.StackName, DBType: f.DBType, ContainerName: f.StackName},
|
||||
FilePath: f.FileName,
|
||||
Size: f.Size,
|
||||
})
|
||||
if f.ModTime.After(latestTime) {
|
||||
latestTime = f.ModTime
|
||||
}
|
||||
}
|
||||
m.cachedStatus.LastDBDump = &DBDumpStatus{
|
||||
LastRun: latestTime,
|
||||
Results: results,
|
||||
Success: true,
|
||||
}
|
||||
}
|
||||
|
||||
return m.cachedStatus
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user