Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Docker Compose configuration entirely with environment variables #282

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
5 changes: 3 additions & 2 deletions .github/workflows/github-actions-test.yml
Expand Up @@ -75,8 +75,9 @@ jobs:
source ./env.template
export MOCK_SIGAN=1
export MOCK_SIGAN_RANDOM=1
docker compose build --no-cache
docker compose up -d
export SSD_DEVICE=/dev/sda
docker-compose build --no-cache
docker-compose up -d

- name: Wait for containers # wait for containers to finish starting
run: sleep 45
Expand Down
5 changes: 5 additions & 0 deletions README.md
Expand Up @@ -314,6 +314,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
Expand Down Expand Up @@ -379,6 +381,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
Expand Down
5 changes: 2 additions & 3 deletions compose.yaml
Expand Up @@ -21,7 +21,7 @@ services:
interval: 6s
timeout: 3s
retries: 1
shm_size: '16gb'
shm_size: ${API_SHM_SIZE}
restart: always
depends_on:
db:
Expand Down Expand Up @@ -72,7 +72,6 @@ services:
- STARTUP_CALIBRATION_ACTION
- RAY_INIT
- RUNNING_MIGRATIONS
- USB_DEVICE
expose:
- '8000'
volumes:
Expand All @@ -87,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
Expand Down
21 changes: 15 additions & 6 deletions env.template
Expand Up @@ -2,12 +2,11 @@

# Copy env.template to env and modify


# Mark all the following variables for export
set -o allexport

#Any names here will be added as additional users with the
#specified additional user password
# Any names here will be added as additional users with the
# specified additional user password
ADDITIONAL_USER_NAMES="" # comma separated
ADDITIONAL_USER_PASSWORD=""

Expand All @@ -18,15 +17,15 @@ ADMIN_PASSWORD=password

# set to CERT to enable scos-sensor certificate authentication
AUTHENTICATION=TOKEN
CALIBRATION_EXPIRATION_LIMIT=360

# Default callback api/results
# Set to CERT for certificate authentication
CALLBACK_AUTHENTICATION=TOKEN
# Set to false to disable SSL cert verification in the callback POST request
CALLBACK_SSL_VERIFICATION=false

#Set the number of seconds before timeout in postback when a scheduled
#action completes
# Set the number of seconds before timeout in postback when a scheduled
# action completes
CALLBACK_TIMEOUT=2

# SECURITY WARNING: don't run with debug turned on in production!
Expand Down Expand Up @@ -87,12 +86,22 @@ SSL_CA_PATH=scos_test_ca.crt
SSL_CERT_PATH=sensor01.pem
SSL_KEY_PATH=sensor01.pem

# Device made available to SCOS Plugins, e.g. for getting SMART data
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
API_SHM_SIZE=16gb

# Calibration action selection
# The action specified here will be used to attempt an onboard
# sensor calibration on startup, if no onboard calibration data
# is available on startup. The specified action must be available.
STARTUP_CALIBRATION_ACTION=SEA_CBRS_Calibrate_Baseline

# How many seconds until calibration data is considered stale
CALIBRATION_EXPIRATION_LIMIT=3600

# Debug dependant settings
if $DEBUG; then
GUNICORN_LOG_LEVEL=debug
Expand Down