From 229281a44ea24639edbe86c54bf9a1e798b694a9 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello Date: Fri, 22 Mar 2024 16:15:26 -0600 Subject: [PATCH 1/9] Use env var SSD_DEVICE to pass SSD to container --- .github/workflows/github-actions-test.yml | 1 + docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/github-actions-test.yml b/.github/workflows/github-actions-test.yml index ec289c2d..99472949 100644 --- a/.github/workflows/github-actions-test.yml +++ b/.github/workflows/github-actions-test.yml @@ -75,6 +75,7 @@ jobs: source ./env.template export MOCK_SIGAN=1 export MOCK_SIGAN_RANDOM=1 + export SSD_DEVICE=/dev/nvme0n1 docker-compose build --no-cache docker-compose up -d diff --git a/docker-compose.yml b/docker-compose.yml index 4987bce3..834a1a75 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -86,7 +86,7 @@ services: - SYS_ADMIN # required for ^ with NVMe drives devices: - /dev/bus/usb:/dev/bus/usb:rw - - /dev/nvme0n1:/dev/nvme0n1:ro + - ${SSD_DEVICE}:/dev/nvme0n1:ro extra_hosts: - "${MANAGER_FQDN}:${MANAGER_IP}" command: /entrypoints/api_entrypoint.sh From ee3b3111f7299fe49f2ae195c177d82c79482382 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello Date: Fri, 22 Mar 2024 16:16:14 -0600 Subject: [PATCH 2/9] Add default SSD_DEVICE=/dev/nvme0n1 --- env.template | 2 ++ 1 file changed, 2 insertions(+) diff --git a/env.template b/env.template index f78e123e..96cd14a0 100644 --- a/env.template +++ b/env.template @@ -88,6 +88,8 @@ SSL_KEY_PATH=sensor01.pem USB_DEVICE=Tektronix +# Device made available to SCOS Plugins, e.g. for getting SMART data +SSD_DEVICE=/dev/nvme0n1 # Debug dependant settings if $DEBUG; then From 645b0349fdfe499d93baab9a1baa8147fba62edb Mon Sep 17 00:00:00 2001 From: Anthony Romaniello Date: Fri, 22 Mar 2024 16:18:59 -0600 Subject: [PATCH 3/9] Configure API container shared memory size with env var --- docker-compose.yml | 7 +++---- env.template | 4 ++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 834a1a75..2f9e79d1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,7 +23,7 @@ services: interval: 6s timeout: 3s retries: 1 - shm_size: '16gb' + shm_size: ${API_SHM_SIZE} restart: always depends_on: db: @@ -59,8 +59,8 @@ services: - IN_DOCKER=1 - IPS - MAX_DISK_USAGE - - MOCK_SIGAN - - MOCK_SIGAN_RANDOM + - MOCK_SIGAN=1 + - MOCK_SIGAN_RANDOM=1 - PATH_TO_CLIENT_CERT - PATH_TO_VERIFY_CERT - POSTGRES_PASSWORD @@ -71,7 +71,6 @@ services: - SIGAN_POWER_SWITCH - SIGAN_POWER_CYCLE_STATES - RUNNING_MIGRATIONS - - USB_DEVICE expose: - '8000' volumes: diff --git a/env.template b/env.template index 96cd14a0..5eebc6d1 100644 --- a/env.template +++ b/env.template @@ -91,6 +91,10 @@ USB_DEVICE=Tektronix # Device made available to SCOS Plugins, e.g. for getting SMART data SSD_DEVICE=/dev/nvme0n1 +# Size of shared memory for API container (/dev/shm), used for parallel processing +# See https://docs.docker.com/compose/compose-file/compose-file-v3/#shm_size +API_SHM_SIZE='16gb' + # Debug dependant settings if $DEBUG; then GUNICORN_LOG_LEVEL=debug From 027b572e9415752f18311021e7f340fb9dc062f4 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello Date: Fri, 22 Mar 2024 16:27:25 -0600 Subject: [PATCH 4/9] remove unnecessary quotes --- env.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/env.template b/env.template index 5eebc6d1..9a7075a1 100644 --- a/env.template +++ b/env.template @@ -93,7 +93,7 @@ SSD_DEVICE=/dev/nvme0n1 # Size of shared memory for API container (/dev/shm), used for parallel processing # See https://docs.docker.com/compose/compose-file/compose-file-v3/#shm_size -API_SHM_SIZE='16gb' +API_SHM_SIZE=16gb # Debug dependant settings if $DEBUG; then From 48148333b90828ce00394a597817deb2c9b400e6 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello Date: Fri, 22 Mar 2024 18:34:25 -0400 Subject: [PATCH 5/9] add SSD_DEVICE and API_SHM_SIZE to README --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 4bd31ab4..afd4c446 100644 --- a/README.md +++ b/README.md @@ -312,6 +312,8 @@ settings in the environment file: - ADMIN_EMAIL: Email used to generate admin user. Change in production. - ADMIN_NAME: Username for the admin user. - ADMIN_PASSWORD: Password used to generate admin user. Change in production. +- API_SHM_SIZE: Size to allocate shared memory (`/dev/shm`) in the API container. This + is currently used to allocate shared memory for parallel processing of IQ data with Ray. - AUTHENTICATION: Authentication method used for scos-sensor. Supports `TOKEN` or `CERT`. - BASE_IMAGE: Base docker image used to build the API container. These docker @@ -373,6 +375,9 @@ settings in the environment file: [WebRelay](https://github.com/NTIA/Preselector) that may be used to power cycle the signal analyzer if necessary. Note: specifics of power cycling behavior are implemented within the signal analyzer implementations or actions. +- SSD_DEVICE: The device (e.g., `/dev/sda/`) which is mapped to `/dev/nvme0n1` within + the API container. This is currently only used to retrieve SSD SMART diagnostics (in + SCOS Actions). - SSL_CA_PATH: Path to a CA certificate used to verify scos-sensor client certificate(s) when authentication is set to CERT. - SSL_CERT_PATH: Path to server SSL certificate. Replace the certificate in the From d3c541bc6bc3c6ea530c47e126a6879cba8e27d3 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello Date: Fri, 22 Mar 2024 18:35:44 -0400 Subject: [PATCH 6/9] remove testing changes --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2f9e79d1..8a80f175 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -59,8 +59,8 @@ services: - IN_DOCKER=1 - IPS - MAX_DISK_USAGE - - MOCK_SIGAN=1 - - MOCK_SIGAN_RANDOM=1 + - MOCK_SIGAN + - MOCK_SIGAN_RANDOM - PATH_TO_CLIENT_CERT - PATH_TO_VERIFY_CERT - POSTGRES_PASSWORD From c795c983ffe1510dac0c9c0668b1a3712e4d2c4c Mon Sep 17 00:00:00 2001 From: Anthony Romaniello Date: Fri, 22 Mar 2024 18:36:29 -0400 Subject: [PATCH 7/9] remove redundant environment variable setting --- .github/workflows/github-actions-test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/github-actions-test.yml b/.github/workflows/github-actions-test.yml index 99472949..ec289c2d 100644 --- a/.github/workflows/github-actions-test.yml +++ b/.github/workflows/github-actions-test.yml @@ -75,7 +75,6 @@ jobs: source ./env.template export MOCK_SIGAN=1 export MOCK_SIGAN_RANDOM=1 - export SSD_DEVICE=/dev/nvme0n1 docker-compose build --no-cache docker-compose up -d From 340588cbdde78a5327f76951e67305e365e54ff7 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello Date: Fri, 10 May 2024 08:46:41 -0600 Subject: [PATCH 8/9] Automatically get SSD_DEVICE --- env.template | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/env.template b/env.template index 75a64e89..037b7b02 100644 --- a/env.template +++ b/env.template @@ -2,7 +2,6 @@ # Copy env.template to env and modify - # Mark all the following variables for export set -o allexport @@ -88,7 +87,7 @@ SSL_CERT_PATH=sensor01.pem SSL_KEY_PATH=sensor01.pem # Device made available to SCOS Plugins, e.g. for getting SMART data -SSD_DEVICE=/dev/nvme0n1 +SSD_DEVICE="$(lsblk -I 8 -npdo KNAME)" # Size of shared memory for API container (/dev/shm), used for parallel processing # See https://docs.docker.com/compose/compose-file/compose-file-v3/#shm_size From 5875313a2132c900895c8d6cd145ecfa0bea9442 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello Date: Fri, 10 May 2024 09:24:23 -0600 Subject: [PATCH 9/9] Fix SSD_DEVICE default for github actions runner --- .github/workflows/github-actions-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/github-actions-test.yml b/.github/workflows/github-actions-test.yml index ec289c2d..2a426ff7 100644 --- a/.github/workflows/github-actions-test.yml +++ b/.github/workflows/github-actions-test.yml @@ -75,6 +75,7 @@ jobs: source ./env.template export MOCK_SIGAN=1 export MOCK_SIGAN_RANDOM=1 + export SSD_DEVICE=/dev/sda docker-compose build --no-cache docker-compose up -d