From 230ae0a412269474b71f8e230c35563f0534adc3 Mon Sep 17 00:00:00 2001 From: Stavros Date: Sun, 26 Nov 2023 11:17:11 +0200 Subject: [PATCH] fix(worker): remount / to /host/root --- docker-compose.dev.yml | 1 + docker-compose.prod.yml | 1 + packages/cli/assets/docker-compose.yml | 1 + packages/worker/src/services/system/system.executors.ts | 3 ++- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 6946ca60..ff732da9 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -80,6 +80,7 @@ services: # Dev mode - ${PWD}/packages/worker/src:/app/packages/worker/src # Production mode + - /:/host/root:ro - /proc:/host/proc:ro - /var/run/docker.sock:/var/run/docker.sock - ${PWD}/.env:/app/.env diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 309eaf22..0e0a5db5 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -76,6 +76,7 @@ services: environment: NODE_ENV: production volumes: + - /:/host/root:ro - /proc:/host/proc - /var/run/docker.sock:/var/run/docker.sock - ${PWD}/.env:/app/.env diff --git a/packages/cli/assets/docker-compose.yml b/packages/cli/assets/docker-compose.yml index 54a14b84..e5d6d40d 100644 --- a/packages/cli/assets/docker-compose.yml +++ b/packages/cli/assets/docker-compose.yml @@ -78,6 +78,7 @@ services: NODE_ENV: production volumes: # Core + - /:/host/root:ro - /proc:/host/proc - /var/run/docker.sock:/var/run/docker.sock # App diff --git a/packages/worker/src/services/system/system.executors.ts b/packages/worker/src/services/system/system.executors.ts index 80f63421..38d43414 100644 --- a/packages/worker/src/services/system/system.executors.ts +++ b/packages/worker/src/services/system/system.executors.ts @@ -36,7 +36,8 @@ export class SystemExecutors { this.logger.error(`Unable to read /host/proc/meminfo: ${e}`); } - const [disk0] = await si.fsSize(); + const disks = await si.fsSize(); + const disk0 = disks.find((disk) => disk.mount.startsWith('/host/root')); return { cpu: { load: currentLoad },