-
Notifications
You must be signed in to change notification settings - Fork 15
Tutorial 1: Run SCOS with a Mock Signal Analyzer
This tutorial provides instructions for running SCOS Sensor locally, without requiring any additional hardware. This is a great way to get started exploring the functionality of SCOS Sensor. If you have a signal analyzer available, you can instead follow Tutorial 2.
- Linux computer (ARM devices, such as Raspberry Pi, are not currently supported)
- Python 3.9 or newer
- Docker and Docker Compose
- Git
Normal usage of SCOS Sensor requires a signal analyzer, such as a spectrum analyzer or software-defined radio, to be connected to the host computer. For the purposes of development and code testing, it is helpful to be able to run the SCOS Sensor stack without having a signal analyzer, preselector, or other sensor hardware available. To support this possibility, SCOS Sensor and its plugins implement mocks: Python classes which stand in for the missing hardware. A developer using a mock signal analyzer is able to make and test code changes using only a Linux computer.
-
Install Git, Docker, and Docker Compose. Additionally, install Python (support versions shown above). You may wish to use a virtual environment
-
Download SCOS Sensor by cloning the GitHub repository:
git clone https://github.com/NTIA/scos-sensor.git
-
Copy the template environment variables file SCOS Sensor provides a file
env.template
which provides default values for environment variables configured to run SCOS Sensor in a development environment on your local system. See Configuring SCOS Sensor for details about each of these options. For now, we will make a copy of this file, which we will then modify and use.cp env.template ./env
-
Enable the mock signal analyzer Open up the new file
env
with a text editor of your choosing, and add the following:MOCK_SIGAN=1 # Enables mock signal analyzer MOCK_SIGAN_RANDOM=1 # Enables randomization of data produced by the mock signal analyzer
-
Apply environment variable changes Before we can start SCOS Sensor, we need to ensure that the environment variables are set. To use the environment variables from our newly-created and modified file, run:
source ./env
-
Create the sensor certificate. A script is provided to generate a certificate authority (CA) and localhost SSL certificate for the sensor. The CA and sensor certificate will have dummy values for the subject and password, and should only be used for testing purposes. This testing setup will allow you to connect to the SCOS Sensor web API from the same computer where it is hosted. To create a certificate specific to your host and organization, see the Security page.
bash ./scripts/create_localhost_cert.sh
-
Build and run the Docker containers
docker compose build docker compose up -d
Optionally, you can also view the Docker container logs:
docker compose logs -f
-
Log in to the browseable API Once the Docker containers are up and running, browse to [https://localhost](https://localhost] using your favorite web browser. Log in using the form when prompted. Unless modified in the
env
file, the default credentials are:Username: admin Password: password
-
Explore SCOS Sensor
Congratulations! You're now looking at the root page of the browseable API. From here, all API endpoints are discoverable. Take a look at the status or capabilities pages, or run an action from the schedule page.