Originally published on strongloop.com
When we build APIs and microservices nowadays, we choose a cloud as the target for deployment. Cloud has long gone beyond being just hosting providers. Infrastructures such as Docker and Kubernetes have completely changed the paradigm of how applications work and operate. To unleash the full power of cloud, there are a few important perspectives that require efforts to make your application cloud native. At LoopBack, we kicked off the journey to provide integration and guidance aligned with CNCF to make your API and microservice applications cloud native throughout the life cycle. This blog summarizes what we have explored and achieved so far to illustrate how you can go cloud native with LoopBack 4.
Key Perspectives of Going Cloud Native
We have looked into the following areas to understand how to make a LoopBack application cloud native and assess what it takes to improve LoopBack framework to be a good citizen of the cloud ecosystem.
Package and compose applications for cloud native deployment - Docker/Kubernetes/Helm
The shopping example started as a monolithic application in early versions. It has been refactored and improved over time to make the application modular.
We did some experiments to decompose
loopback4-example-shopping into microservices, package them as Docker containers, and deploy them into a Kubernetes cluster. The whole story can be read here.
- Break down an application into multiple microservices
- Enable efficient communication between microserices
- Update the application to adapt to configuration for resources in the Kubernetes environment
- Build Docker images for each packages
- Organize deployment of docker containers as a single unit using an Helm chart
- Deploy to Minikube or IBM Cloud
Enable developers to have end-to-end cloud native development and deployment - Kabanero/Appsody - LoopBack stack
Developers are often disconnected from the cloud environment during the development phase, with code only verified on a developer's local machine. Bad surprises may rise late in the cycle when deployment and tests happen in the cloud against that code.
Kabanero is created to address such concerns. The following is quoted from Kabanero's web site:
Kabanero is an open source project focused on bringing together foundational open source technologies into a modern microservices-based framework. Developing apps for container platforms requires harmony between developers, architects, and operations. Today’s developers need to be efficient at much more than writing code. Architects and operations get overloaded with choices, standards, and compliance. Kabanero speeds development of applications built for Kubernetes while meeting the technology standards and policies your company defines. Design, develop, deploy, and manage with speed and control!
To learn how Kabanero works, head here.
To bring the LoopBack offering to the Kabanero experience, we have introduced an Appsody Stack for LoopBack 4.
The Node.js LoopBack stack extends the Node.js stack and provides a powerful solution to build open APIs and microservices in TypeScript with LoopBack, an open source Node.js API framework. It is based on LoopBack 4.
Go here for more details.
Provide observability - health/metrics/tracing/logging
Observability is critical to the success of cloud native microservices. To make LoopBack a good citizen of Kubernetes based cluster, we have been rolling out extensions to integrate with health, metrics, tracing, and logging capabilities, based on projects at CNCF.
Released experimental features
- Health readiness/liveness check endpoints https://github.com/strongloop/loopback-next/tree/master/extensions/health
- Metrics instrumentation and Prometheus reporting: https://github.com/strongloop/loopback-next/tree/master/extensions/metrics
New features proposed
- Distributed tracing with Jaeger - https://github.com/strongloop/loopback-next/tree/tracing/extensions/tracing
- Distributed logging with Fluentd - https://github.com/strongloop/loopback-next/tree/logging/extensions/logging
Allow graceful shutdown of Kubernetes Pods
LoopBack 4 applications hosted by Kubernetes Pods can be requested to shutdown per provisioning needs by the cluster. The life-cycle and hand-share are described here.
- Proposed features
- Handle http keep-alive connections and allow graceful shutdown upon application.stop()
- Improve state transitions and allow shutdown hooks for applications
With the investigation and experiment, we were able to deploy
loopback4-example-shopping as an application with cloud native microservices to a Kubernetes cluster hosted by IBM Cloud. The LoopBack stack for Kabanero/Appsody is released. There are also pull requests under reviews to close gaps and add new facilities. We're very excited that LoopBack 4 is going cloud native and we're even more interested in seeing LoopBack applications going cloud native with us. Please join us on the journey.
LoopBack's success depends on you. We appreciate your continuous support and engagement to make LoopBack even better and meaningful for your API creation experience. Please join us and help the project by:
- Reporting issues.
- Contributing code and documentation.
- Opening a pull request on one of our "good first issues".