WIP: Notifications and application usage

This commit is contained in:
Andras Bacsai
2022-05-17 10:14:06 +02:00
parent 1ec620be4b
commit 35b31dce2b
15 changed files with 349 additions and 128 deletions

View File

@@ -421,6 +421,21 @@ export async function checkContainer(
return containerFound;
}
export async function getContainerUsage(engine: string, container: string): Promise<any> {
const host = getEngine(engine);
try {
const { stdout } = await asyncExecShell(
`DOCKER_HOST="${host}" docker container stats ${container} --no-stream --no-trunc --format "{{json .}}"`
);
return JSON.parse(stdout);
} catch (err) {
return {
MemUsage: 0,
CPUPerc: 0,
NetIO: 0
};
}
}
export async function stopCoolifyProxy(
engine: string
): Promise<{ stdout: string; stderr: string } | Error> {

View File

@@ -14,3 +14,12 @@ export const features: Readable<{ latestVersion: string; beta: boolean }> = read
});
export const isTraefikUsed: Writable<boolean> = writable(false);
export const status: Writable<any> = writable({
application: {
isRunning: false,
isExited: false,
loading: false,
initialLoading: true
}
});