Tuesday, November 1, 2016

Into'ing Kubernetes (k8s)

Kubernetes (k8s) is an open source platform for automating container operations such as deployment, scheduling and scalability across a cluster of nodes.  If you are familiar with Docker container technology to deploy your containers, then consider Docker as a low level component used internally by Kubernetes to deploy containers.

 - Managing application containers, using Kubernetes 
 - Manage deploying, scaling, and updating your applications

A Kubernetes cluster consists of two types of resources:
  • Master coordinates the cluster - scheduling applications, maintaining applications' desired state, scaling applications, and rolling out new updates.
  • Nodes are the workers that run applications - Each node has a Kubelet, which is an agent for managing the node and communicating with the Kubernetes master. The node should also have tools for handling container operations, such as Docker or rkt.
Masters manage the cluster and the nodes are used to host the running applications.
When you deploy applications on Kubernetes, you tell the master to start the application containers. The master schedules the containers to run on the cluster's nodes. The nodes communicate with the master using the Kubernetes API, which the master exposes. End users can also use the Kubernetes API directly to interact with the cluster.
A Kubernetes cluster can be deployed on either physical or virtual machines.

Try out kubernetes interactive tutorial :

Thursday, October 27, 2016

Docker to run your applications

Begin with a simple sample;
Sample 1 : Running a PHP application 

Echo “Hello user”;

FROM php:7.0-apache
COPY src/ /var/www/html
├── dockerfile
└── src
    └── index.php

Build: docker build -t myhelloapp .
Run: docker run -v /home/thilini/Desktop/docker/src/:/var/www/html/ myhelloapp
docker run -p 80:80 -v /home/thilini/Desktop/docker/src/:/var/www/html/ myhelloapp

Sample 2 : Running a Java application

docker file
FROM java:7
COPY src/ /usr/src/myapp
WORKDIR /usr/src/myapp
RUN javac HelloWorld.java
CMD ["java", "HelloWorld"]
docker build -t my-java-app .
docker run -it --rm --name my-running-app my-java-app


List containers : docker ps 
Verify the image was built successfully : docker ps -a OR docker ps --all
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS      PORTS NAMES

List docker images : docker images 
REPOSITORY          TAG                   IMAGE ID            CREATED             SIZE 

Remove unwanted docker containers : rm {container_ID}

Thursday, June 9, 2016

Adding business rules to your enterprise applications

Business rules help to determine the flow of your processes based on a group of rules you define.

Compared to traditional systems, the addition of business rules to you application has the following advantages.
  • Shortened development time
  • Changes can be made faster, with a lower risk
  • Rules are externalized and easily shareable among multiple applications
  • Lowers the cost for modifying the business logic
  • Increase the Line of Business (LOB) control over implemented decision logic for compliance and business management.
  • Reduce/remove the reliance on IT for changes in the production systems.
  • Improve process efficiency.
Business Rules capabilities in the WSO2 middleware platform brings the agility of business rules to your SOA toolkit. Based on a solid platform for hosting business rules, WSO2 business rules excel at extending the capabilities of your SOA.

It's used to define, deploy, execute, monitor and maintain the variety and complexity of decision logic that is used by operational systems within an enterprise.

SOA is the most prominent architectural pattern used to integrate heterogeneous systems. Therefore if the business decisions written as rules can be exposed as services then business rules can also be integrated to SOA systems.

Tuesday, June 7, 2016

Start a Process Instance using the BPMN REST API

Request endpoint to start a BPMN process instance

Request type: 

Request Body:  

Request body (start by process definition Id):

   "variables": [
        "value":"This is a variable"

Request body (start by process definition key):

   "variables": [
        "value":"This is a variable"

Starting the process instance via an ESB proxy service (with PayloadFactory Mediator)

<?xml version="1.0" encoding="UTF-8"?>

<proxy xmlns="http://ws.apache.org/ns/synapse"
       transports="https http"


//Calling the request endpoint
         <http method="POST"

//PayloadFactory Mediator transforms or replaces the contents of a message. Configuring 
the format of the request/response and mapping it to the arguments provided.

         <payloadFactory media-type="json">
   "variables": [
        "value":"This is a variable"

//Passing basic-auth credentials to invoke the secured service in BPS. Another way is to 
get these information from the secure vault.

         <property name="Authorization"
                   expression="fn:concat('Basic ', base64Encode('admin:admin'))"

         <property name="Content-Type"