Tutorial 1: Scepter setup and configuration
This is the first tutorial in a five-part series. By the end of the fifth and
final tutorial, our aim is to have set up both Scepter and Javelin to work on
our machines. Then, by configuring the two to communicate, we can create a full
engineering workbench which allows the user to send a ping to a ‘satellite’ and
receive a message back via the workbench.
During this tutorial, we will introduce you to Scepter, the OSSO Command and
Control API. This tutorial will take you through how we were able to set up
Scepter to work both locally on our machine and remotely on a local network,
and how to send some basic commands.
Workbench overview
To begin, install the Scepter package from GitLab using any installation method
(this tutorial was written using a simple ZIP file download on a Linux Ubuntu
OS, however any standard installation of the repository will be sufficient.)
You will also need to download and install PostgreSQL 11+, the database software
for this API. It is assumed that you have installed and configured PostgreSQL to
your system prior to continuing on to the next step of the tutorial. For those
who haven't, some helpful links are provided below.
Operating system compatability
Environment setup
To run the code, it is recommended that a virtual environment is used. This will
prevent any conflicts between Scepter's configuration and the pre-existing
dependencies on your computer. To create the virtual environment and install the
required packages, use the following commands in the
scepter-master
directory.Along with this, the database environment file,
example.env
will need to be
copied from the scepter-master
directory to the scepter
directory and be renamed
.env
. You will eventually need to update this file to match your own Postgres
database, however, it acts as a good example and starting point.Once this is complete, you will need to run an update to your database. To do
this, use the following terminal commands from the
scepter-main
directory.
Before running these commands, ensure that the configuration file in the Scepter
directory is updated to match your Postgres setup (i.e. your username and password,
etc.)Alternatively, you may wish to speed up the above process by simply running the
following shell script file from the
scepter-master
directory.Modify the file paths
The last step in this process runs a test on the Scepter installation to check
for any errors or missing components in the installation. It is recommended that
users do this for every new installation of Scepter.
Running Scepter
Once the setup is complete, Scepter can be activated by running the following
command from the
scepter
directory.The terminal should then print out the following (or similar) messages.
Talking to Scepter (local)
Scepter is designed to take requests and respond in the HTTP format. With each
request, Scepter requires a series of headers to ensure that the correct
information is given to right people. There are three headers, the content type,
user number, and user access token. Since Scepter is being run locally in this
tutorial, you can simply use the series of headers below with their requests.
To make life easier, it is recommended that you make requests to Scepter via a
Python script. To do this, install the
Requests
and PPrint libraries as they
will be used in the remainder of the tutorial.
To install the packages on Linux Ubuntu OS, use the following commands in the terminal.
The first command we will go through gets a list of satellites in your database.
We get to this by accessing the satellite endpoint of Scepter by running the
following lines in Python.
User's should then receive the following message (or similar) in the terminal.
Talking to Scepter (remote)
As previously mentioned, this tutorial was written using a Linux OS. All the
methods, commands and coding has been designed around this. It is not supported
for other operating systems.
To talk to Scepter remotely, a similar process will be followed. Since Scepter
runs on the ‘0.0.0.0’ host, it is able to communicate wih other devices on the
same network. To send a command via another device, first check that your
firewall isn't blocking the connection port (by default, this is port 5000).
If this is clear, you should be able to update the URL in the above script to
be able to access Scepter on another computer.
The same command as above becomes:
The response should be the same as the local response. Some important tips to
note when doing this for the first time:
- Ensure the correct IP address is being used (this could change if your internet connection changes).
- Ensure the correct port is being used (will be port 5000 by default).
- Check the computer's firewall settings in case there is a blockage in one of the ports (inbound or outbound)
Basic Scepter examples
The following section will show users how to reach and communicate with some
other Scepter endpoints. These will be done using a local host server under a
similar setup to the scripts seen above. For a full extensive outline, see the
Introduction.
Get a single satellite
You will notice when using the above command, when there is more than one or two
satellites in the database, the terminal response can get large. Scepter does
have the ability to return the information for a particular satellite via the
use of the satellite's ID. This can be done for the following script.
Create a new satellite
If the satellite is successfully added, a message should appear in the terminal
with the following format:
Update a satellite
To update a satellite's information, a similar process can be used. However,
Scepter doesn't require you to rewrite all the fields seen above. To update a
satellite, the only mandatory fields to be updated are the NORAD and NSSDC ID's.
Along with this, the input requires the satellite name and description fields
along with the fields to be updated. An example of this can be seen in the script
below.
Again, following this, you should receive a message in the terminal with the format.
Along with this, there is a subsection below provided to help you with the
formatting of the querystring input.
Conclusion
This concludes the tutorial. For more information, see the source code or
documentation on Scepter. The next tutorial will take
you through setting up Javelin.
Additional resources
To help you get familiar with the inputs and the formats required in the requests
above, some helpful scripts have been provided. All code from this tutorial is
also summarized and compiled within the Tutorial 1 package in the OSSO Tutorials
folder.
New satellite input format
The code below was made to help you out with creating a new satellite. For more
information on the inputs, you should see the Scepter documentation.
TLE input format
The code below was made to help with the
Two Line Element (TLE) input
for the Satellite endpoint. It should be used in conjunction with the above and/or
below scripts.
Update satellite input format
The code below was made to help you with the update. It is written in a similar
style as above and includes the necessary fields plus a single updated field to
the input. Note, you are allowed to update multiple fields in one request.
Table of contents