We have just released Activiti Core and Activiti Cloud 7.0.0.Beta1to Maven Centraland we wanted to highlight the new Cloud Native capabilities of Activiti Cloud. For those who haven’t followed what we have been doing over the last year, Activiti Cloud is a set of Cloud Native components designed from the ground up to work in distributed environments. We have chosen Kubernetesas our main deployment infrastructure and we are using Spring Cloud/Spring Bootalong with Dockerfor containerization of these components.
We have gone through a very valuable journey, meeting very passionate developers, communities and existing and potential customers who are looking to leverage these technologies (and business automation solutions) to reduce time to market and improve business agility in the Cloud. We have also contributed with these communities, making sure that the Open Source projects that we consume get back our valuable feedback and contributions.
As part of the first Beta1 release, we are providing 4 foundational Building Blocks
Activiti Cloud Runtime Bundle
Activiti Cloud Query
Activiti Cloud Audit
Activiti Cloud Connectors
These Building Blocks are Spring Boot Starters that can be attached to any Spring Boot (2.x) application. These Building Blocks are enhanced with Spring Cloud functionalities which provide the Cloud Native capabilities.
By using these components you can create Activiti Cloud applications that:
Can be scaled independently based on demand
Can be managed in completely isolated cycles
Can be upgraded and maintained independently
Can provide domain specific features using the right tool for the job
On this blog post, we wanted to show how to get started by deploying an example set of these building blocks in Kubernetes. We strongly recommend having a real Kubernetes Cluster such as GKE, PKS or EKS. We have tested the content of this blog post in AWS (Using Kops, PKS, GKE and also with Jenkins X)
Let’s get our hands dirty with Kubernetes, HELM and Activiti Cloud.
Kubernetes Deployment & HELM Charts
The quickest and easiest way to deploy things to Kubernetes is by using HELM charts. HELM, as described by their own documentation, is: “a tool that streamlines installing and managing Kubernetes applications. Think of it like apt/yum/homebrew for Kubernetes.”
As part of the Beta1 release, we have created a set of hierarchical HELM charts that can be used to deploy several components, some related to infrastructure (such as SSO and Gateway) and some Application specific components like Runtime Bundle, Audit Service, Query Service and a Cloud Connector.
This “Activiti Cloud Full Example” deploys the following components:
One important thing to notice is that each of the Activiti Cloud components can be used independently. This example is intended to show a large-scale deployment scenario. You can start small with a Runtime Bundle (which provides the process and task runtimes), but if you want to scale things up you need to know what you are aiming for, and this charts shows you exactly that.
Now, moving forward you will need to download and install the following tools:
One more thing that we need to do in order to be able to expose our services to be accessed from outside the cluster is to set up an Ingress Controller, which will automatically create routes to the internal services that we want to expose, in order to do this we just need to run the following command:
| helm install stable/nginx-ingress
Now that NGINX Ingress Controller is being deployed, we need to wait for it to expose itself using a Public IP. We need this Public IP to interact with our services from outside the cluster. You can find this IP by running the following command:
| kubectl get services
Notice that you might need to run kubectl get services serveral times until you can see the External IP for your ingress controller. If you see PENDING, wait for a few seconds and run the command again.
We will use nip.ioas DNS service to map our services to this External IP which will follow the following format: ..nip.io
Deploying Activiti Cloud Full Example
Now that we have our Cluster in place, HELM installed and an Ingress Controller to access our services from outside the cluster we are ready to deploy the Activiti Cloud Full Example HELM Chart.
The first step is to register the Activiti Cloud HELM charts into HELM. We do this by running the following commands:
The next step is to parameterize your deployment to your cluster. The Activiti Cloud Full Example Chart can be customized to turn on and off different features, but there is one mandatory parameter that needs to be provided which is the external domain name that is going to be used by this installation.
This will trigger the deployment process, and you need to wait until the services are up and running. You can check this by running:
| kubectl get pods
Notice the READY column 1/1 in all the pods, that means that we have 1 pod in Kubernetes running our service. It is also important to notice that HELM created a release of our CHART. Because we haven’t specified a name for this release HELM choose one random name, in my case, it was: bumptious-yak. This means that we can manage this release independently of other Activiti Cloud Applications that we want to deploy using the same approach. You can run helm list and then helm delete to remove all the Activiti Cloud Services for this release.
In order to access to your services now, you can run the following command:
| kubectl get ingress
Interacting with your Application
We recommend to download our Activiti Cloud Postman collection for Postman (https://www.getpostman.com) from our Activiti Cloud Examples repository:
Before calling any service you will need to create a new Environment in Postman. You can do that by going to the Manage Environmenticon (cog)
Then “Add” a new environment and add a name to it. Now you need to configure the variables for the environment: “gateway”, “idm” and “realm”
For gateway you need to copy the url associated with your Ingress, the same for idm which is SSO and IDM using Keycloak. For the realm enter “activiti”:
Click Save or Update and then you are ready to start using that Environment. Make sure that you select the environment in the dropdown of the right:
As shown in the previous screenshot, if you go to the keycloakdirectory and select the “getKeycloakToken for testuser”you will get the token which will be used to authenticate further requests. Notice that this token is time sensitive and it will be automatically invalidated so you might need to get it again if you start getting unauthorized errors.
Once you get the token for a user, you can interact with all the user endpoints. For example, you can create a request to see which Process Definitions are deployed inside our Example Runtime Bundle:
Now you can also start a new Process Instance from our SimpleProcess:
You can check that the audit service contains the events associated to the just started process instance.
And that the query service already contains information about the process execution:
You are now ready to start consuming these services to automate your own business processes.
Finally, you can access to all services Swagger documentation by pointing your browser to:
All our services are using SpringFox to generate this documentation and provide a UI for it.
In this blog post we have seen how to get started with Activiti Cloud and more specifically with the Activiti Cloud HELM charts in GKE. If you are not familiar with Kubernetes, Docker and GKE this might look like a lot of new information and it is our mission to simplify all the steps covered in these getting started guide. For that reason, we recommend you to checkout the Jenkins Xproject, which greatly simplifies the first two sections about creating clusters and configuring the basic infrastructure for your projects.
As part of the Activiti Cloud initiative we are making sure that we follow best practices coming from the Kubernetes, Docker and Spring Cloud communities and we are contributing back with fixes and feedback to make this technology stack the best for Cloud Native applications.