|IMPORTANT: Since the first publication of the Mutant Monitoring System we have made a number of updates to the concepts and code presented in the blog series. You can find the latest version now in ScyllaDB University. Click here to be directed to the new version.|
This is part 16 of a series of blog posts that provides a story arc for ScyllaDB Training.
In the previous post, we covered the different data types that one can use in their database tables and learned how to store binary files in ScyllaDB with a simple Java application. After learning about storing binary files, Division 3 hired a team of Node.js developers to create the Mutant Monitoring Web Console. The web console has a central interface that displays photos of the mutants and their basic information, as well as tracking information such as heat, telepathy, speed, and current location. To get started, let’s go to the terminal and bring up ScyllaDB and the Mutant Monitoring Web Console.
Bringing Up the Containers
The first step is to clone the scylla-code-samples repository and change to the mms-webconsole directory from the terminal.
git clone https://github.com/scylladb/scylla-code-samples.git
Now we can build and run the containers:
docker-compose up -d
After roughly 60 seconds, the existing MMS data automatically imports into ScyllaDB. Now let’s access the web console and see what it has to offer.
Accessing the Web Console
The web console can be accessed at http://127.0.0.1. Once in, you should see the screen below. The web console has the ability to upload photos from your computer for a mutant in the catalog. Before we can do that, we will need to add the binary blob columns to the catalog keyspace. This can be done by clicking on Keyspaces -> Alter.
Next, we can view the Mutant Catalog by clicking on Mutant -> Catalog. Notice how the mutant information is displayed but there are no pictures? Let’s change that by clicking on the empty image for the first mutant.
In this image below, we can see the latest tracking details for the mutant, change the image, edit the mutant’s details from the catalog, and delete the mutant from the catalog. To change the picture, click on “Change Image” and select a file from your computer to use for that mutant. When finished, click on Mutant-> Catalog to see the updated list of mutants with the correct pictures. Repeat the process for the other two mutants.
To add a Mutant, click on Mutant -> Add Mutant. Enter the details for the mutant followed by clicking on the Add Mutant button. To see the updated Catalog, click on Mutant -> Catalog. The default image for newly added mutants is a question mark and you can feel free to change it.
Another feature of the web console is that it has a built-in load generator that can populate the tracking keyspace with data. Even after a mutant is added to the Mutant Catalog, tracking data continues to be generated. To start the load generator, click Tools -> Start Load Generator
After the load generator is started, you can view the tracking details in the web console and see the location, heat, speed, and telepathy powers change for each mutant every couple of seconds by clicking on Mutant -> Catalog and by selecting a mutant.
Exploring the Code of the Web Console
The Mutant Monitoring Web Console is a simple Node.js application that serves basic HTTP requests to perform the operations discussed earlier.
The /upload request retrieves the photo that you uploaded from the web console and runs a query on the ScyllaDB cluster to insert the data. The /pictures request retrieves all the data from the mutant catalog. The /delete request deletes the mutant from the catalog and the /edit request stores the updated details for the mutant. The /tracking request retrieves all of the tracking data from the ScyllaDB cluster and displays it on the web console
In the excerpt below, you can see the code for each HTTP request served by the web console interacting with ScyllaDB
In this post, we discussed why Division 3 wanted to create a central interface to monitor the mutants and went over the new Mutant Monitoring Web Console. The web console easily lets users add or change photos, edit details, and view tracking information for each mutant. Please be safe out there and use this great new tool to keep our people safe!
- Learn more about ScyllaDB from our product page.
- See what our users are saying about ScyllaDB.
- Download ScyllaDB. Check out our download page to run ScyllaDB on AWS, install it locally in a Virtual Machine, or run it in Docker.