Improve ops status diagnostics
All checks were successful
Build & Push Docker Image to Gitea Registry / build-and-push (push) Successful in 11s
All checks were successful
Build & Push Docker Image to Gitea Registry / build-and-push (push) Successful in 11s
This commit is contained in:
33
server.js
33
server.js
@@ -11,8 +11,8 @@ const PUBLIC_DIR = fs.existsSync(dockerPublicDir) ? dockerPublicDir : __dirname;
|
||||
const DOCKER_SOCKET = process.env.DOCKER_SOCKET || '/var/run/docker.sock';
|
||||
const WATCHTOWER_CONTAINER = process.env.WATCHTOWER_CONTAINER || 'watchtower';
|
||||
const DISK_TARGETS = [
|
||||
{ id: 'volume1', label: 'Volume 1', path: process.env.STATUS_VOLUME1_PATH || '/host/volume1' },
|
||||
{ id: 'volume2', label: 'Volume 2', path: process.env.STATUS_VOLUME2_PATH || '/host/volume2' },
|
||||
{ id: 'volume1', label: 'Volume 1', path: process.env.STATUS_VOLUME1_PATH || '/host/volume1', mount: '/volume1:/host/volume1:ro' },
|
||||
{ id: 'volume2', label: 'Volume 2', path: process.env.STATUS_VOLUME2_PATH || '/host/volume2', mount: '/volume2:/host/volume2:ro' },
|
||||
{ id: 'root', label: 'Root', path: '/' }
|
||||
];
|
||||
|
||||
@@ -164,7 +164,13 @@ function parseWatchtower(lines) {
|
||||
const timeMatch = line.match(/time="([^"]+)"/);
|
||||
const time = timeMatch?.[1] || null;
|
||||
|
||||
if (line.includes('Running a one time update.') || line.includes('Checking all containers')) {
|
||||
if (
|
||||
line.includes('Running a one time update.')
|
||||
|| line.includes('Checking all containers')
|
||||
|| line.includes('Found new')
|
||||
|| line.includes('Stopping /')
|
||||
|| line.includes('Creating /')
|
||||
) {
|
||||
current = current || { startedAt: time, found: [], warnings: [] };
|
||||
}
|
||||
|
||||
@@ -178,7 +184,7 @@ function parseWatchtower(lines) {
|
||||
current.warnings.push(line.replace(/^.*msg="/, '').replace(/"$/, ''));
|
||||
}
|
||||
|
||||
const done = line.match(/Session done" Failed=(\d+) Scanned=(\d+) Updated=(\d+)/);
|
||||
const done = line.match(/Session done(?:\\"|") Failed=(\d+) Scanned=(\d+) Updated=(\d+)/);
|
||||
if (done) {
|
||||
current = current || { startedAt: time, found: [], warnings: [] };
|
||||
current.finishedAt = time;
|
||||
@@ -190,7 +196,24 @@ function parseWatchtower(lines) {
|
||||
}
|
||||
}
|
||||
|
||||
return sessions.at(-1) || null;
|
||||
if (sessions.length) return sessions.at(-1);
|
||||
|
||||
const lastDoneLine = [...lines].reverse().find((line) => line.includes('Session done'));
|
||||
const done = lastDoneLine?.match(/Failed=(\d+) Scanned=(\d+) Updated=(\d+)/);
|
||||
if (done) {
|
||||
const time = lastDoneLine.match(/time="([^"]+)"/)?.[1] || null;
|
||||
return {
|
||||
startedAt: null,
|
||||
finishedAt: time,
|
||||
failed: Number(done[1]),
|
||||
scanned: Number(done[2]),
|
||||
updated: Number(done[3]),
|
||||
found: [],
|
||||
warnings: []
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function probeUrl(target) {
|
||||
|
||||
Reference in New Issue
Block a user