Tag Archives: paas

Adding mysql service to your local PaaS (cf-dev)

I wanted to get the flavor of a PaaS (Platform as a Service), so I installed the Cloud Foundry Developer version (cf-dev) which can be installed on a machined with enough RAM (min – 8 GB, more better), processing power, space (min 80GB, more better) and a fast internet (a lots of downloads required). If you don’t know about PaaS then I suggest you to read my earlier blog on the cloud.

After installing the cf-dev you can deploy your application easily, but this cf-dev does not have any service in it; not even the database. So, if you want deploy database enabled application in your  cf-dev then you need to follow the given instructions to install the database service in cf-dev –

Prerequisite – this guide assumes that you have a cf-dev installed in a Ubuntu (other distro should also work)

Preface:

Before start, one might think why do we need to have a complex mechanism to just to enable database service. But in reality this is done the way it is to enable variety of services to be added to cloud foundry in a service provider/service type agnostic way. Cloud foundry does not care about what you are providing, it just want a way to provision and track the usage so that it can provide a given service as per user demand and track the usage to bill for it. In this way, cloud foundry ensures that the service provider getting paid for their service and the user can quickly and easily use many services by paying. Cloud foundry treats database service as one of such services.

In this mechanism we need a middle-man to facilitate an uniform interface between the cloud foundry and the service providers. This middle-man or the component is known as “service broker” in cloud foundry. A service must expose itself to cloud foundry via service broker. It has a well defined interface.

So, In order to enable mysql database service, we need to setup a mysql-broker to talk with cloud foundry. Fortunately cloud foundry provides the cf-mysql-broker for this task.

  • Get the mysql release from the cloud foundry

git clone https://github.com/cloudfoundry/cf-mysql-release.git

  •  After cloning, cd into the directory and fetch the pre-built mysql release by invoking the update script. By executing the following commands you are essentially downloading the binary release of the mysql service for cloud foundry. Once downloaded use “bosh upload release” command to upload the binaries to the cloud foundry. In the last command make sure to choose the value of N according to your cf-dev version. If you are using the latest cf-dev, just use the highest value of N available in that folder. This N denotes the release version of the cf-mysql.

cd cf-mysql-release
git checkout master
./scripts/update
bosh upload release releases/cf-mysql-<N>.yml

  • Now, we need to deploy the mysql to our IaaS. For this reason we need a deployment manifest. As we are using cf-dev so our IaaS is most probably virtualbox with bosh-lite as cloud-infrastructure interface. So, we need to generate the deployment manifest for the bosh-lite to start the deployment.

./scripts/generate-bosh-lite-manifest
bosh deploy

  • after some times mysql will be deployed. check the deployment with “bosh vms” command. You should be able to see two table, and can identify the mysql nodes there. The first table will be cf-dev components.

bosh vms

Here is my pc’s screenshot for bosh vms output, showing the second table only –

screenshot-from-2016-11-05-16-48-06

  • We are almost there. We have cf-dev and mysql service with cf-mysql-broker. Now we need to register the mysql service to the cf-dev. This registration will allow the admin to provide mysql service on demand to applications. The most easiest way to register the mysql to the cf-dev is to run following command –

bosh run errand broker-registrar

after the command successfully completed you can check if your mysql service is registered in the cf-dev or not by running following command

cf marketplace

screenshot-from-2016-11-05-17-03-27

You should be able to see the mysql service there. It indicates that you can now lend on demand database usage to an application.

That is it for today, in future I will show how to provision (on-demand lend) mysql service to an application and how the application can use it.

If you have any comment or suggestion, please leave a comment.

 


			

Demystifying the Cloud (IaaS/PaaS/SaaS)

So, I got a chance to work on a product which was based on social networking. And before I joined the team, they were using Heroku, a cloud-based platform. At that time, I was wondering, what the hell is Heroku? how does it work? Eventually I came to know that they are a PaaS provider. Now again I was wondering, what the hell is this cloud business? After a lot of reading and studying some papers(!), I think I now understand the buzz words of the cloud, the IaaS, the PaaS and the SaaS.
To understand the cloud business you first have to understand the lifecycle of an actual product which is aimed for a significant amount of users. Below is an abstracted flow of a development-deployment cycle:

development-deployment-cycle

We, the developer are mostly interested in developing the system, applying bug-fixes, adding new features and not interested in deploying the system in the actual environment. Deployment mainly related to DevOps guys, and they have a hard time managing it. Because they need to make sure the correct library is running which are required by our developed application, patching the system if any critical bug was fixed and upgrading the whole system if required. And to be honest we, the developers know, these are a painful and time-consuming task.

Now suppose we are to develop and deploy a product. From high level after deployment the overall system would look like something like below:

overall

At the highest level, our app is running, which is providing the actual experience to its user. But the application is obviously running on a platform depending upon a set of libraries of frameworks. And again the OS or the platform itself is running over actual hardware. So, in order to deploy the application we have to know different specific requirements from different perspective (e,g : which CPU, how much RAM, how much bandwidth from Hardware perspective).

Enter IaaS:

Now what if we don’t want to manage the hardware part of our high-level view? Hardware can be viewed as infrastructure which facilitates our application growth/deployment. And if you don’t want to manage them, just go to someone who provides them as a service, A.K.A Infrastructure as a service provider, hence IaaS provider. There are many IaaS providers, amazon, google, microsoft (azure), vmware, rakespace etc.

If you pay the IaaS they will provide you with VM (Virtual Machine) of your desired OS, CPU, RAM, network bandwidth and then you don’t have to manage them, they will manage the VM for you.
Now our overall view becomes a less complicated than before:

IaaS-overall

 

Enter PaaS:

A lot of pain was abated but still there is room for serious pain. We still need to install the correct library, manage them and update them if any security patches are released by them. Also, there are some complex dependency tree for some high-level languages. They are painful to maintain. If one broke, all of them crumble down. So, now we would like to remove this pain also. Enter PaaS A.K.A Platform as a service. You just buy any popular PaaS solution and it will have all the dependencies your application need. You upload your code, your app is instantly deployed into the real world. It is just the dream come true!

There should be a lot of PaaS providers, but I know only about heroku and pivotal.

So, with PaaS our overall view looks like below:

pass-overall

 

Enter SaaS:

Now, what if our employer thinks that they don’t need our cool software, they don’t want to invest money to continuously manage it, improve it; instead they just want to use it. Well sadly for us, SaaS A.K.A Software as service provides such application to the user. And sadly we also use it 🙂 . Google Docs is a fine example of SaaS, you can buy their premium service and you will get the whole suit for your corporation without investing any money to develop it, manage it or to deploy it.

 

I hope my examples were clear enough to demystify the Cloud. One may infer that SaaS is deployed over PaaS. But be aware, that might not be the case. But it is possible to do so and in fact, it is logical to do so.

If you have any suggestion or comment, please leave them in the comment section.

The images were used for demonstration purpose and are registered trademark of their  respective company.