Start with flint's automation engine
Automation of IT processes can be a huge time saver. Unfortunately beginning with automation can be quite challenging and expensive.
I was really excited when I heard from my friends at Infiverve that they have released an orchestration tool called flint.
Flint is an automation platform that uses Groovy and Ruby to create automated services. One of their big advantages is, that all workflows are stored within a Git repository. So it is easy to test and deploy different versions of your workflows.
Let’s get started and see how it works…
What’s in the Box
Once you have installed flint you can login to your server at http://yourflintserver:3500. After login you will see the dashboard which gives you an overview about your automation platform.
- Grid — Shows you all the nodes that are currently configured. It acts as a cluster and jobs will be distributed between all active nodes. As long as one node in your grid is working you have a running automation platform.
- Flintbox — A link to a Git repository that stores all workflows (called Flintbits) for one purpose.
- Connectors — Let you talk to external systems. Sample connector types include: HTTP, Database, SSH, Amazon EC2 and many more.
- Listeners — Listen to the world. Right now MQTT and IMAP Listeners are available.
- Scheduler — Run your workflows periodically. Configuration is based on Cron Syntax.
- Global Config — Store and share connection strings or parameters across all workflows.
- TOD — The Trigger On Demand console lets you run and test your workflows. Great for debugging and development.
- User Management — Create and manage different user accounts.
Start Coding
First create a new Git repository. For this example we create a new public repository on GitHub. You can also use your private Git Server if you want.
Now you can add your repository as new Flintbox on your grid. Don’t forget to enable your new Flintbox.
Let’s create a simple hello.groovy flintbit:
log.info "Hello World"
Now let’s run it in flint. Open the TOD console, enter flintsample:basic:hello.groovy as flintbit name, enable logging on the LOGS tab and press run.
That was easy - right?
Now let’s make it a bit more dynamic:
name = input.get("name") ?: "World"
log.info "Hello " + name
Start Talking
We can now run basic flintbits and handle input data. It’s now time to interact with the outside world. Let’s create a flintbit that calls OpenWeatherMap to get the current temperature and humidity based on a City provided by an input parameter.
First we need to create a new HTTP connector. Then create a new flintbit called weather.groovy:
import groovy.json.*
def apiKey = config.global("weather.key")
def city = input.get("city")
def url="http://api.openweathermap.org/data/2.5/weather?q=" + city + "&appid=" + apiKey + "&units=metric"
def wResponse=call.connector("OpenWeather")
.set("method","get")
.set("url",url)
.set("timeout",5000)
.sync()
def myBody = wResponse.body
def jsonSlurper = new JsonSlurper()
def myWeather = jsonSlurper.parseText(myBody)
log.info "Humidity: " + myWeather.main.humidity + "%"
log.info "Temp: " + myWeather.main.temp + "°C"
output.set("Wetter", "${myWeather.weather.main}")
output.set("Temp", myWeather.main.temp.toString())
We read the API Key from a global configuration object with config.global("weather.key") — this makes sure the API configuration is stored in a single place and can be used by more than one flintbit.
Conclusion
Flint is a really promising automation platform with a lot of potential. It’s easy to get started with automation and it has a really small resource footprint in your environment. A lot of connectors are already there and some more are coming. Flint can be a game changer and can make process automation more widely available for a lot of users.