March 11, 2021 By Henrik Loeser 3 min read

How to use IBM Cloud Code Engine for GitHub traffic analytics.

Some years back, we introduced an IBM Cloud solution tutorial for GitHub traffic analytics based on Cloud Foundry and IBM Cloud Functions. A Cloud Functions action is triggered daily to collect traffic data. The action stores the data in a Db2 database. Users can then analyse the data in a Python Flask app served by Cloud Foundry.

Today, that same solution scenario and app are still available, but they are served by IBM Cloud Code Engine. Code Engine is a fully managed, serverless platform that runs your containerized workloads, including web apps, microservices, event-driven functions or batch jobs. The slightly renamed tutorial — “Serverless web app and eventing for data retrieval and analytics” — demonstrates how the existing app can be containerized and both served as web app and and used to process the daily data collection event:

Solution architecture for serverless web app and eventing.

Serverless application

Serverless computing is an approach to computing that offloads responsibility for common infrastructure management tasks (e.g., scaling, scheduling, patching, provisioning, etc.) to cloud providers and tools, allowing engineers to focus their time and effort on the business logic specific to their applications or process. It is also the computing model utilized by Code Engine. With that, it is a great fit for the solution scenario discussed in the tutorial. 

Users can access the web application to look at and analyse GitHub traffic data (see [1] in the architecture diagram above). The app itself relies on the IBM Cloud App ID security service to authenticate users. It also stores the traffic data and other app data in an IBM Db2 on Cloud database (see [2]). Moreover, the app is triggered daily (see [3]) to collect new traffic data from GitHub (see [4]). Since the web application is only needed infrequently and the data collection happens once a day, the solution benefits from the serverless compute model and its automatic up- and downscaling of resources (autoscaling). When not in use, there are no costs.

Containerized solution

The code for this tutorial is available in a GitHub repository. In the tutorial, we set up a Code Engine project with an app. We configure the app to be built as container image from the code on GitHub. The container image is stored in the IBM Cloud Container Registry. From there, it is fetched by Code Engine and used to deploy a revision of our app.

Only few steps are needed to set up everything and deploy the app and it required services. Once done, the traffic data is collected daily and you can start analyzing it in the app — either as data tables or with a chart like the one below:

Line chart with daily views for GitHub repositories.

Summary

The solution for analysing GitHub traffic statistics is a good fit for IBM Cloud Code Engine. It has scheduled daily collection of traffic data (eventing) and the actual web app is infrequently used (serving). Thus, it benefits from the serverless compute model and its automatic up- and downscaling of resources (autoscaling). When not in use, there are no costs. The container deployment directly off the git repository makes it easy to use.

If you have feedback, suggestions, or questions about this post, please reach out to me on Twitter (@data_henrik) or LinkedIn

Was this article helpful?
YesNo

More from Cloud

How a US bank modernized its mainframe applications with IBM Consulting and Microsoft Azure

9 min read - As organizations strive to stay ahead of the curve in today's fast-paced digital landscape, mainframe application modernization has emerged as a critical component of any digital transformation strategy. In this blog, we'll discuss the example of a US bank which embarked on a journey to modernize its mainframe applications. This strategic project has helped it to transform into a more modern, flexible and agile business. In looking at the ways in which it approached the problem, you’ll gain insights into…

The power of the mainframe and cloud-native applications 

4 min read - Mainframe modernization refers to the process of transforming legacy mainframe systems, applications and infrastructure to align with modern technology and business standards. This process unlocks the power of mainframe systems, enabling organizations to use their existing investments in mainframe technology and capitalize on the benefits of modernization. By modernizing mainframe systems, organizations can improve agility, increase efficiency, reduce costs, and enhance customer experience.  Mainframe modernization empowers organizations to harness the latest technologies and tools, such as cloud computing, artificial intelligence,…

Modernize your mainframe applications with Azure

4 min read - Mainframes continue to play a vital role in many businesses' core operations. According to new research from IBM's Institute for Business Value, a significant 7 out of 10 IT executives believe that mainframe-based applications are crucial to their business and technology strategies. However, the rapid pace of digital transformation is forcing companies to modernize across their IT landscape, and as the pace of innovation continuously accelerates, organizations must react and adapt to these changes or risk being left behind. Mainframe…

IBM Newsletters

Get our newsletters and topic updates that deliver the latest thought leadership and insights on emerging trends.
Subscribe now More newsletters