Reader small image

You're reading from  Blockchain for Enterprise

Product typeBook
Published inSep 2018
Reading LevelBeginner
PublisherPackt
ISBN-139781788479745
Edition1st Edition
Languages
Concepts
Right arrow
Author (1)
Narayan Prusty
Narayan Prusty
author image
Narayan Prusty

Narayan Prusty is a full-stack developer. He works as a consultant for various start-ups around the world. He has worked on various technologies and programming languages but is very passionate about JavaScript, WordPress, Ethereum, Solr, React, Cordova, MongoDB, and AWS. Apart from consulting for various start-ups, he also runs a blog titled QNimate and a video tutorial site titled QScutter, where he shares information about a lot of the technologies he works on.
Read more about Narayan Prusty

Right arrow

Chapter 6. Building Quorum as a Service Platform

As the deployment of containerized applications using Kubernetes (K8s) is growing, it's the right time to learn how we can containerize Quorum for deploying to K8s. In this chapter, we will be building a Platform as a Service (PaaS) to make it easy to create Quorum networks. We will start with the fundamentals of cloud computing, Docker, and K8s, and end up with a Quorum as a Service (QaaS) platform. What we will build in this chapter is a minimalist Blockchain as a Service (BaaS), compared to the ones provided by various cloud platforms such as Azure, AWS, and BlockCluster.

In this chapter, we will cover the following topics:

What is cloud computing?

  • Difference between public, private, and hybrid clouds
  • Difference between IaaS, PaaS, and SaaS
  • What is Docker and the containerization of applications?
  • Introduction to microservices architecture
  • Understanding fundamentals of K8s and its advantages
  • Installing minikube on your local machine
  • Deploying a simple...

Introduction to cloud computing


In simple terms, cloud computing is the on-demand delivery of computing services (servers, storage, databases, networking, software, and more) over the internet. 

Cloud computing provides an easier way to access servers, storage, databases, and a broad set of application services over the internet. Cloud services platforms, such as Amazon Web Services and Microsoft Azure, own and maintain the network-connected hardware required for these application services, while you provision and use what you need by way of a web application.

Here are the advantages of cloud computing:

  • Cost: Cloud computing saves a lot of cost as you don't have to buy hardware and software. It also saves you the cost of setting up and running on-site data centers. Even if you set up your own data centers, you need IT experts who can manage them, and 24/7 electricity and cooling, which creates additional costs. Compared to this, cloud computing is very cheap. In cloud computing, you can only...

What are containers?


If you are using a PaaS or SaaS to create your application, then you will not come across containers because they take care of containerizing your application. PaaS simply lets you push the source code of your app to the cloud and it builds and runs the app for you. 

If you are using IaaS to build your application, then without containerizing your application, it will become next to impossible to scale and manage your application. Let's take a scenario and try to understand why we need containers.

In IaaS, to deploy your app you would need to perform the following steps:

Provision a Virtual Machines (VMs

  1. Install all the dependencies and runtime environments of the app 
  2. Run the app
  3. If the app starts receiving more traffic than the VM can handle, you will start creating new VMs and distribute the traffic using a load-balancer
  4. For every new VM, you need to follow the same procedure for installing the dependencies and runtime environments before running new instances of the app...

Understanding the microservices architecture


The microservices architecture is an application architecture adopted for building enterprise-level applications. To understand microservices architecture, it's important to first understand monolithic architecture, which is its opposite. In monolithic architecture, different functional components of the server-side application, such as payment processing, account management, push notifications, and other components, all blend together in a single unit.

For example, applications are usually divided into three parts. The parts are HTML pages or native UI that run on the user's machine, a server-side application that runs on the server, and a database that also runs on the server. The server-side application is responsible for handling HTTP requests, retrieving and storing data in a database, and executing algorithms. If the server-side application is a single executable (that is, running is a single process) that does all these tasks, then we say...

Diving into K8s


Once you have created a few Docker containers, you'll realize that something is missing. If you want to run multiple containers across multiple machines – which you'll need to do if you're using microservices—there is still a lot of work to do.

You need to start the right containers at the right time, figure out how they can talk to each other, handle storage considerations, and deal with failed containers or hardware. Doing all of this manually would be a nightmare. Luckily, that's where K8s comes in.

K8sis an open source container-orchestration platform, allowing large numbers of containers to work together in harmony, reducing the operational burden. It helps with things such as:

  • Running containers across many different machines.
  • Scaling up or down by adding or removing containers when demand changes.
  • Keeping storage consistent with multiple instances of an application.
  • Distributing load between the containers.
  • Launching new containers on different machines if something fails...

Building QaaS


Now let's start building a QaaS platform, this lets us deploy, create, and join networks with just a click of a button. As you are aware, starting a Quorum node requires a lot of manual steps, such as creating the genesis.json file, the static-nodes.json file, and enode. As we are aiming to automate all these steps, it would require us to write automation scripts to perform these steps. So instead of writing complicated automation scripts, we will use Quorum Network Manager (QNM), which allows users to create and manage Quorum networks easily without any manual steps. 

QNM is an open source wrapper for Quorum to make it easy to set up Quorum networks. When you are using QNM, you no longer have to worry about enode, wallets, the genesis file, the static-nodes.json file, and so on. You can find the official QNM repository at https://github.com/ConsenSys/QuorumNetworkManager. At the time of writing, the latest version of QNM is v0.7.5-beta

Note

Note that QNM currently works only...

Summary


In this chapter, we learned the basics of cloud computing and containerization through examples. We looked at the importance of containerization and how to containerize an application using Docker. We then saw the importance of K8s and how it makes it easy to build microservices-architecture-based applications. After that, we learned how to install minikube and deploy containers on K8s.

Finally, we used all the skills we learned to develop a QaaS as a Service using QNM. In the next chapter, we will create a basic UI for the QaaS that calls the K8s APIs to create and join networks. 

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Blockchain for Enterprise
Published in: Sep 2018Publisher: PacktISBN-13: 9781788479745
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Narayan Prusty

Narayan Prusty is a full-stack developer. He works as a consultant for various start-ups around the world. He has worked on various technologies and programming languages but is very passionate about JavaScript, WordPress, Ethereum, Solr, React, Cordova, MongoDB, and AWS. Apart from consulting for various start-ups, he also runs a blog titled QNimate and a video tutorial site titled QScutter, where he shares information about a lot of the technologies he works on.
Read more about Narayan Prusty