Wednesday, August 9, 2017

Cloud Foundry and Kubernetes for Beginners

Cloud Foundry and Kubernetes are probably the most prominent technologies for cloud infrastructure development, they have a very different set of goals and as such they follow significantly different solution design approaches.

Cloud Foundry is a traditional Platform-as-a-Service technology, with a specific design orientation towards enterprise-scale resources and privileges management. It follows a top-down approach, where your primary component is a CF "cloud" instance. Within a CF cloud you create organizations and spaces, which are bound to resource quota plans. Quota plans include both computing (CPU/RAM/instances) resources and external services resources (e.g. database storage).

CF users are assigned to organizations and can deploy/monitor their applications based on their roles. There is a list of CF supported development languages/frameworks, called buildpacks . Developers/release managers can deploy and monitor their applications using the Cloud Foundry command line client. CF application instances run on Linux containers, on a CF platform you get the same level of scalability/isolation that you can find on most containerized application platforms.

CF does a clear distinction between applications and services, on CF parlance, a service is an abstract resource that can be instantiated and bound to applications. Services are available from a CF's service catalog «named marketplace per it's usual format on public clouds», example of CF services are object storage, SQL dbs, nonsql, bigdata / deep learning APIs, messaging, etc.

There are many CF powered PaaS providers, as an IBMer I am more familiar with IBM's offering, BlueMix . Bluemix provides a very large and diverse catalog of services, some which rely on IBM exclusive technology. In any case, Cloud Foundry is an open source project, which means you can deploy your own CF instance, exploring your existing infrastructure and adapting services per your requirements.

Kubernetes is an application container orchestration technology, with a specific design orientation towards application containers management and integration. It follows a bottom-up approach, where your primary component is the "pod", a "pod" is a group of one or more containers that can be deployed into a Kubernetes cluster. Pod's are most commonly composed using Docker images. There is no default organization structure in a Kubernetes cluster, in order to achieve resource control on an organization level you will need to setup Kubernetes namespaces with resource quotas and roles.

Developers/release managers (which can have namespaces bound roles) can deploy/monitor their container images. There is no Kubernetes specific list of images for application language/frameworks support, you will need to select/deploy/compose the pod with images bundling the required base O.S. image, SDK and applications.

Kubernetes does not have an explicit distinction between applications and services, a Kubernetes pod can be either an application fronted (e.g. nodejs) or a back-end (e.g. postgresql), or both. A Kubernetes service is as network level of abstraction, used to define a TCP service from the container that should be exposed externally.

There are many Kubernetes distributions and services providers, and there are also several PaaS solutions (e.g. RedHat's OpenShift) built on top of Kubernetes. IBM is also on the Kubernetes train on it's cloud platform. Kubernetes clusters are available as a CF service on BlueMix . Kubernetes is also an Open Source project, you can try it or build your own infrastructure.

Roundup
Cloud Foundry is a platform-as-a-service platform, with an explicit organization structure and resource management control system, CF provides officially supported SDKs, services are available as a different level of abstraction, services instances can be created and bound to applications. CF application instances are run within a self-healing elastic containerized platform.

Kubernetes is container-orchestration platform, capable of running services on container based images (most commonly Docker). It provides the freedom and responsibility for running a wide range of components and services that are bundled into images. It provides optional resource control facilities. Kubernetes is a self-healing elastic containerized platform.

The best option between a CF app or a Kubernetes pod will depend a lot on the application requirements, team size, skills and other business requirements.

Wednesday, August 2, 2017

When m(IRC) and ANSI C were popular

It was 2005, I was amazed with internet chats, both as an user, and as a computer programming enthusiast. m(IRC), an Internet Relay Chat application was probably the most popular chat app. For some young people, at that time, being "online" was not merely about having an internet connection, it was about being online on "mIRC". Sometimes people actually scheduled to be "online" together. Having a continuous internet connection at home was still a luxury for many.

As many of the early internet services and related software, installing and managing an IRC network was a complex activity, as such, most IRC chat networks were managed by large university groups and internet service providers. This was where I got in, improving the server side software, making it easier and more flexible to use for every body.

IRC chat networks provided both chat rooms and private messaging. Users were identified by their chosen nickname, and the chat rooms «named IRC channels» had moderation features. IRC servers kept all is users and channels information only in memory. When servers were restarted all this information was lost To overcome this, many IRC networks implemented IRC "registration" services, these services worked as "robots" which assigned  control over nicknames and chat-rooms, keeping that data on a persistent database, there services were also frequently extended with extra features like offline messaging.

I believed that there was a great potential for more advanced IRC services, using web/mail integration features which I was not able to find in the existing software. That was when I decided to develop an IRC Services software from scratch. 

I didn't kept any record about the initial development time-line and I was not familiar with any open source version control system at the time. "PTlink IRC Services 3" was released around June 2005, containing around 20k lines of ANSI C code.

It featured a C library providing an event driven API for all the IRC server protocol handling. For example, for an "on connect" message service, you would only need to bind your C function to the NEW_USER event, and from your function, you would use the irc_SendNotice() to delivery a message.

Services were provided as a set of modules, these modules were implemented as shared object libraries that could be dynamic loaded/reloaded, this is something that you currently find on most software, modules/plugins support.

Last but not least, the data store back-end was MySQL, while most IRC services were still using file based custom formats. This also allowed the development of a minimal web interface.

In 2006 the development was halted, mostly because I lost ownership over the ptlink.net domain which was bound to the software, and due to the trending lose of popularity of IRC.

It is a bit sad when you spend some hundred hours of development, specially open source, and it gets into a dead end. Nevertheless developing an event driven C library, with a modular IRC services integrator was a very challenging and exciting personal experience.