Ground Station software for the Alpha CubeSat project
This is the Ground Station software for the Alpha CubeSat project. It is a full-stack web app developed using Python/Flask for the backend and React.js for the frontend UI.
The backend receives data from the RockBlock API, processes that data, and sends it to ElasticSearch. It is architected as a RESTful server with multiple modules that each provide functionality for specific services such as receiving telemetry, authentication, sending issuing commands, and viewing captures.
The frontend UI allows you to select commands using dropdowns, fill in any fields, validate them, and send them to the backend, which in turn uses RockBlock web services to send them to the CubeSat. Additional features include sending multiple commands at once, drag/drop command reordering, a log of previously sent commands, and an capture viewer for downlinked captures.
This repo is a rewrite (along with new features) of the previous version of the ground station software in Clojure.
- Python version >= 3.9
- NodeJS >= 18.0
- Python dependencies (run
pip install -r requirements.txt
) - React/JS dependencies (run
npm install
)
This section provides instructions on setting up the environment and running the ground software for local development/testing purposes.
Note: Alpha runs its ground software on Ubuntu Server, so if you are using something else, such as Windows, the locations of Elasticsearch and Kibana configuration files might be elsewhere.
-
Install ElasticSearch. ElasticSearch is what the ground system uses to store telemetry data received from the satellite. A guide for installation can be found in Elastic's documentation. Then, configure ElasticSearch as necessary (configuration at
/etc/elasticsearch/elasticsearch.yml
). By default Elasticsearch will listen onlocalhost:9200
. -
Install Kibana. Kibana is a visualization tool for creating graphics out of data in ElasticSearch. This will be useful for configuring alerts, graphs, and other aggregations of telemetry data. A guide for installation can be found in Kibana's documentation. Kibana can be configured as needed in the configuration file (at
/etc/kibana/kibana.yml
). By default Kibana will listen onlocalhost:5601
. -
Configure the Backend Server. Navigate to
cubesat-backend
and configure the backend by creating an.env
file in the folder. You will need to configure the following environmental variables:ROCKBLOCK_USER
,ROCKBLOCK_PASS
: The username and password of the RockBlock Web Services account used for receiving telemetry and sending commands.GS_ADMIN_PASS
: The password for the ground station's admin user.ELASTIC_USER
,ELASTIC_PASS
: The username and password of the Elasticsearch superuser account.ELASTIC_CERTS
: The filepath to Elasticsearch's HTTPS certificates, usually located in<elasticsearch base path>/config/certs/http_ca.crt
.
-
Run the Backend Server. Run the command
flask run
. This will start the backend server that listens for requests atlocalhost:5000
. On first run, it many neccessary to run theflask init-db
command to setup the user database. An interactive API documentation playground will also be generated when the development server is booted, which can be found at/docs
. -
Configure the Frontend. Navigate to
cubesat-frontend
and configure the frontned by creating an.env
file in the folder. You will need to configure the following environmental variables:REACT_APP_BASE_API_URL
: The URL of the backend server that the frontend makes API requests to.REACT_APP_KIBANA_URL
: The URL of the Kibana server (used to form the base URL for viewing normal reports in Kibana).REACT_APP_KIBANA_NR_DOC_ID
: The ID of the Kibanacubesat_normal_report
document (used to form the base URL for viewing normal reports in Kibana).
-
Run the Frontend UI. Once configured, run the command
npm start
(make sure the backend server is still running). This will start the fronend server which is assessable atlocalhost:3000
.
There are some tasks and configuration need to fully setup the production version of the ground station on a Linux machine. The files needed for this section can be found under the hosting-related/
folder.
- Setup Services. Ensure steps 1, 2, 3, and 5 from above have been completed. To import the Kibana dashboards, navigate to
<Kibana base URL>/app/management/kibana/objects
and importcubesat_dashboard.ndjson
andchipsat_dashboard.ndjson
. - Setup Backend and Frontend as Services. Copy the
gs-backend.service
andgs-ui.service
files into/etc/systemd/system/
. Modify theWorkingDirectory
path as needed. These files allow the ground station services to start automatically on boot. They also should automatically restart each process when the code is updated. Logs can be accessed throughjournalctl -u <gs-backend | gs-ui>.service --since today
. - Setup Nginx Reverse Proxy. Install Nginx, copy the
nginx-config.txt
file into/etc/nginx/sites-available
, and rename it todefault
. This assumes the services are running at thier default ports. Use Certbot to setup HTTPS and modify the domain name as needed. Copy the contents of thenginx_landing
folder to/usr/share/nginx/html/
. - Secure the Elastic Stack. Secure Elasticsearch and Kibana by going to their configuration files and adding
xpack.security.enabled: true
(should be enabled by default). Then, navigate to<Kibana base URL>/app/management/security/users
and add anadmin
user wih rolessuperuser
andkibana_system
. Create other users as needed. - Add Users to Ground Station UI. Navigate to
<GS base URL>/ui
and log in as theadmin
user (defined in backend config file). Click onSettings
in the upper right corner andADMIN: Edit Users
to create additional user logins.