Swing Between Serverless and Serverful — Deploying Kumologica in DigitalOcean

Kumologica
5 min readDec 19, 2023

Embracing serverless technology has become the norm, but should we overlook the serverful landscape? The answer is no. Numerous use cases still find relevance in the serverful realm. Many enterprises continue to leverage containers as they transition towards serverless architectures. Kumologica serves as a versatile low-code tool that seamlessly integrates into both environments without requiring any changes to the implementation.

Primarily adopted by enterprises, Kumologica facilitates rapid development and deployment of serverless services through a low-code approach. This article will explore the process of taking a service originally developed for serverless compute platforms like AWS Lambda or Azure Functions and adapting it for Dockerization, ultimately deploying it as a container.

For those who are new to Kumologica I would recommend to go through our articles and youtube videos to get an insight.

Training & Certification
For a limited time, Kumologica offers free online certification
for developers on https://training.kumologica.com/

Plan

We will be building a simple hello world service and wrapping it as a docker image. Then deploy the image as a container in Digital Ocean PaaS as an App.

Pre-requisite

We would need the following tools and setup to complete the implementation.

  1. Kumologica Designer
  2. Docker
  3. Account in Digital Ocean

Implementation

We are now ready to start our build and deployment our first Kumologica flow on container.

Build

Let’s start the development of service by opening the designer. Open the designer using the following command kl open.

Drag and drop an EvenListener node from the palette to the canvas. Click open the configuration and provide the below details.

Provider : NodeJS
Verb : GET
Path : /hello
Display Name : [GET] /hello

Now drag and drop a Logger node from pallet to canvas and wire it after the EventListener node.

Display name : Log_Entry
level : INFO
Message : Inside the service
Log Format : String

Drag and drop the EventListenerEnd node to the canvas wire it to the Logger node and provide the following configuration.

Display Name : Success
Payload : {"status" : "HelloWorld"}
ContentType : application/json

The flow has been completed. It’s time to containerize it using Docker.

Dockerizing

Before starting to dockerize ensure that you have docker installed in your machine. To dockerize the flow open the project folder and place the following Dockerfile on the root project folder.

Dockerfile

FROM node:16-alpine 
WORKDIR /app
COPY package*.json ./
RUN npm install
ENV PATH /app/node_modules/.bin:$PATH
COPY . .
EXPOSE 1880
CMD ["node","index.js"]

Note: The above Dockerfile is very basic and can be modified according to your needs.

Now we need to add another file that treats Kumologica flow to run as an NodeJS express app.

Create an index.js file with the following Javascript content. Replace the “your-flow.json” with the name of the flow.json in your project folder.

const { NodeJsFlowBuilder } = require('@kumologica/runtime');
new NodeJsFlowBuilder('your-flow.json').listen();

Final folder structure would look as shown below.

Project Root (Hello World)-
|-- package.json
|-- helloworld-flow.json
|-- Dockerfile
|-- index.js

To build the image, go to the root of the project folder and run the following command from a command line in Windows or a terminal in Mac.

docker build . -t hello-kl-docker-app

Now the docket image is built. Let’s check the image locally by running the following command.

docker images

Let’s test the image running the image locally by executing the following command.

docker run -p 1880:1880 hello-kl-docker-app

Check the container by running the following command

docker ps -a

You should now see the container name and ID listed. Now we are ready to push the image to any registry of your choice.

We will now push the image into docker hub. For this we will login using docker login. And then push using docker push command.

docker login [OPTIONS] [SERVER]
docker push [OPTIONS] NAME[:TAG]

Deployment

As we are done with containerization part of Kumologica flow now its time for deploying into Digital Ocean platform.

Once we login into Digital Ocean Account go to Manage tab and select Apps.

Next Click on Create App.

Select the Docker Hub and provide the Repository and Tag associated with your HelloWorld docker image.

Select the Review and select HTTP Port and edit it to change the default port from 8080 to 1880 since container is having the port as 1880. Click Create Resource.

Once deployed you can copy the live URL provided by DigitalOcean for the helloworld service app and invoke it from any REST Client of your choice.

Try it

The above hello world service with the Dockerfile is available in the following git repo.

https://github.com/KumologicaHQ/kumologica-helloworld-docker

Closing Note

Thanks for reading. I hope you like this article. Feel free to like, comment or share this article with your friends. For more depth understanding of Kumologica solution checkout our official documentation at kumologica.com

--

--

Kumologica

Kumologica is the first low-code development solution that makes your integration services run on serverless compute regardless the cloud provider.