The Score Prophet - The Infrastructure

How easy was it to deploy and host The Score Prophet?

As trainees new to the world of IT, we couldn’t even begin to imagine what was required to host such an application. With the help of IBM Cloud, however, we soon found out that it wasn’t just straightforward, but it was critical in ensuring that we could deliver our project in a timely manner.

The Score Prophet was made up a front-end web application, a back-end API service, and an underlying database.

We quickly decided that we had no interest in deploying and maintaining servers so a cloud-native approach to running each of these services was required. We also wanted to ensure that whatever we built could be portable, so we chose the following services from the IBM Cloud catalog:

IBM Cloud Service

Function

Compose for MongoDB

Underlying data repository for The Score Prophet

IBM Code Engine

Serverless application hosting for the front-end web application

IBM Functions

Serverless hosting of event-triggered code

IBM Toolchain

An application deployment tool utilising DevOps best practices.


Compose for MongoDB

Compose for MongoDB was up-and-running within seconds of a service provisioning request. But this was no ordinary MongoDB instance – it was highly available, fully replicated pair of instances with automatic backups configured. In short, there was no need to work out how to install and configure the platform as it just appeared, as if by magic.

NOTE: Compose for MongoDB has now been deprecated in favour of a new service offering: Databases for MongoDB.

IBM Code Engine

IBM’s Code Engine allowed us to deploy our web application components without the need to worry about issues such as server allocation and load balancing. Our dockerised applications could stretch to meet our players’ demands automatically by adding new docker instances as required.

We could see, at a glance, how much compute-resource we were using at any point in time with the user-friendly UI:

Compute Resource Usage Dashboard

We ran a series of load tests against the platform to determine at which point a second instance would be required to be instantiated. That point? Let’s just say we would need somewhere in the region of 25,000 players to trigger a second instance of our web application.

IBM Toolchain

Deploying our application to IBM Code Engine was relatively straightforward – we pointed IBM Code Engine at our GIT repository.

However, the use of IBM Toolchain allowed us to automate the process of continually deploying the latest version of our application.

The toolchain was configured to watch a specified branch in our GIT repository and automatically run through the following steps:

CI/CD Toolchain

Cloning the GIT repository, building the application, executing unit tests, containerizing the application, analysing the code for vulnerabilities, deploying the application and validating the health of the application were all automated with an average run-time from start to finish of just under 4 minutes.

Additionally, the rolling deployment process ensured there was no interruption in service.

IBM Functions

The Score Prophet has a need to pull real-time scores from a third-party service provider. To satisfy this need, small code snippets were developed and deployed to the IBM Functions service. This service allowed us to invoke the code snippets periodically and only when required. The service allows for 5,000,000 executions per month for free and we didn’t come close to requiring that number of executions.

The IBM Functions service allows for code snippets to be chained together into sequences. This allowed us to focus on small re-usable components that could perform functions such as:

  • Authenticate to third-party service
  • Retrieve latest scores from third-party service
  • Authenticate to The Score Prophet API service
  • Retrieve match information from The Score Prophet
  • Update match information in The Score Prophet

IBM Functions can be written in a variety of languages, i.e., Node.js, Python, Ruby, Go, Swift, Java, PHP, .NET. But we settled on Node.JS as it was familiar to us.

Summary

Building and maintaining servers is not our core competency and we never want it to be! The serverless approach to application deployment was trouble-free and an easy concept to grasp. Moreover, the cost of running the services described above is a fraction of what it would cost by building and maintaining our own servers.

In short, we have a robust service, that was quick to build, is continuously maintained, and is cheap to run. Win-Win-Win-Win.

You can play The Score Prophet for free at www.thescoreprophet.com.