To get started with Flint, we have defined the standard "hello world" example.
This guide assumes that you have already installed flint locally on your workstation.
Create your first Flintbox
Flintbox is a collection of similar Flintbits in git repository
Flintbox is a git repository which contains or hold all the Flintbits (workflows written in Ruby or Groovy). These are the collection of similar types of Flintbits.
In production or remote Flint deployment, Flintbox is always cloned from git repository into the 'Flintbox' directory. In development setup and when running Flint locally, you can directly open and edit them in your favorite text editor.
We will create a Flintbox named 'mybox' under the 'flintbox' directory.
To create a Flintbox-
- Navigate to flint-x.x.x.x ( Flint installation directory )
- Navigate toflintboxdirectory
- Create a directory named 'mybox' to store flintbits.
- This can be performed by executing the below commands on a new terminal.
Flintbit = ruby or groovy scripts (workflows) developed and stored within Flintbox
Flintbit is a ruby or groovy script, which contains your business logic. It uses Flintbit functions to get input, call connectors and other Flintbits and finally to set output.
All Flintbits are accessible via RESTful APIs, thus making them micro-services.
To create a Flintbit, navigate tomyboxdirectory using your favorite code editor.
Create a ruby or groovy Flintbit under 'mybox' directory. You can copy paste the following code :
When you want to refer your Flintbit in Flint, you may use path convention used within Flint. This is simple and easy to remember where folder name (Flintbox) and Flintbits are separated by a colon (:) operator.
Following example shows the folder structure and path to refer the Flintbits
flintbox ├── mybox # our new flintbox ├── hello.groovy # mybox:hello.rb └── hello.rb # mybox:hello.groovy
Open the Flint console in the browser and navigate to Trigger on Demand [TOD] screen
Before running the Flintbit, we will enable the logs to be displayed on Flint console. This will show real-time logs from the running script. This is really useful while developing and debugging Flintbits.
Now that the logs are enabled let us run the Flintbit
Upon execution of Flintbit logs will be displayed as below
You may check the output of the Flintbit execution from the 'Output' tab
For more information on using the 'trigger on demand' console, please refer Trigger on Demand section.
That's great ! We have just executed our first Flintbit.
Execution of a Flintbit can be done via RESTful APIs. Flint REST API documentation can be found at REST API
You can access REST APIs by using any REST client or HTTP/REST Client library.
Once you are done with your development and testing. You can commit your Flintbox to git repository. This will enable you with-
- Version-control the automation workflows
- Share Flintbox with others and provide reusability
- Deploy it to Flint production environments
$ cd mybox $ git init
$ git add . $ git commit -m "hello world flintbits" $ git remote add origin https://github.com/username/mybox.git $ git push