Runnerty is an open source process orchestrator written in nodejs. It allows us to plan and configure workflows easily, providing a big amount of features.
In this article I am going to explain how it works and why it can helps you.
What is a process and a workflow?
First thing we have to understand is what is a process and a workflow. A process is an action or operation and a workflow is a serie of processes conected and directed to some end.
These are some examples of typical workflows in every system:
- Automatic backups
- Database operations
- Files operations
- ETL (Extract, transform, load)
Based in four concepts
Runnerty is based in four concepts; Chains, executors, notifiers and triggers. To start configuring and planing our workflows we will have to understand how runnerty use this four components.
A chain is just a set of processes. The place where we are going to configure or processes, establishing dependencies between them, sharing data from one process to the others, etc.
The executors are runnerty plugins that allows us to do different opperations with our processes without writing a single line of code.
For example, we could execute an instruction in our Mysql database just configuring the Mysql Runnerty executor. Or send an email with the mail executor just indicating who and the text of the message.
There are a lot of executors already developed that you can use just installing them with npm.
Another awesome feature of runnerty is the possibility to get notified when an event occurs in our chain or processes. For example, we would like to know when a process of our chain fails.
As the executors, the notifiers are plugins which Runnerty use for this end. we can get notified via telegram, slack, etc, in different events of the processes or chain, (start, end, fail, retry, etc).
Once we know that we can config a chain with our processes using the runnerty executors to execute operations and notifiers to know when something happen in our processes, it just left to know how we can indicate when out chain has to start.
Ad hoc, runnerty provides another kind of plugins called triggers. The triggers fires our chains and can do that in several ways. For example every hour, or in an specific date, or when a file is left in a directory, or when a new user is inserted in a Firebase database.
Hands on code
Do you find interesting what runnerty can do? Let’s follow the quick-start they have to get in touch with the code.
Installing runnerty and cloning the repo:
To install runnerty in our system all we need is to have node v8.9.4
npm install runnerty -g
Now we can clone the quick-start repo and go into the project:
git clone https://github.com/runnerty/runnerty-quick-start
This repo contains a simple chain with just one process, this process only executes an echo using the shell executor. The chain is fired every minute using the scheduler trigger:
Let’s have a look at the files:
package.json. Here we can see the runnerty modules installed as dependencies, if we want to add more executors, triggers or notifiers we just have to install them via npm.
config.json. In this file is where we are going to add the configurations for our executors, notifiers and triggers:
As we can see in the file there are only two configurations, for the shedule trigger and for the shell executor.
plan.json. Finnally in this file is where our chain and processes are:
"name":"Chain one sample",
"schedule_interval":"*/1 * * * *"
At the first level of the chain we have the general data of the chain (name and id) and in the triggers section we find the usage of the shcheduler trigger. In this case the interval given indicates that the chain is going to be executed every minute.
Below we find the processes array, in this section is where all the processes are configured:
"name": "Proccess One",
"command": "echo Runnerty: hello world!"
"EXECUTION @GETVALUE(PROCESS_ID) - AT @GETDATE('YYYY-MM-DD HH:mm:ss')\n @GETVALUE(PROCESS_EXEC_MSG_OUTPUT)"
As we can see there is only one process planed, it uses the shell executor executing an echo.
Having a look at the output property it is indicating to write the output of ther process in a file.
To executes this chain we just have to run runnerty in the project directory. And in the next minute will see how the test.log file is created with to output of the process.
This is the easiest example of runnerty usage, it only shows a minimal part of its potential. Runnerty is a very powerful tool which provides awesome features to create and manage workflows:
- A large amount of executor, notifier and triggers to develop processes without writing code and connect them with several servicies and platforms.
- Notifications on events to always know what is happening.
- Simple and advanced dependencies between processes and chains.
- Params and credential centralization.
- Auto-gestioned logs.
- Language independence.
- Easy scalable
I really encourage you to have a look at the runnerty documentation (http://docs.runnerty.io) and find more information and tutorials.