Introducing Kumologica CLI
Now you can develop your serverless flows using Kumologica CLI.
Join the DZone community and get the full member experience.
Join For FreeKumologica SDK release is a major milestone for Kumologica products to be used in an enterprise environment. It combines all products into a single npm package. It elevates the command line interface as a primary interface for running designer, building binaries, testing and deployments.
Kumologica SDK consists of 4 products:
- Kumologica Designer
- Kumologica Runtime
- Kumologica CLI
- Kumologica Node Development Kit
This article introduces Kumologica CLI commands to use Kumologica Designer.
Dependencies
Kumologica SDK is packaged and distributed as an npm module. The only dependencies are node js and npm.
Refer to your cloud provider documentation to what Node JS versions are supported by their serverless computing services.
SDK Installation
Kumologica SDK is available as an npm module. It is recommended to install it globally using the following command:
npm install -g @kumologica/sdk
Once installed, Kumologica CLI is available under kl command:
$ klkl <command>Commands:
kl build <provider> Build kumologica flow binaries
kl create Create a kumologica project
kl deploy <provider> Deploy kumologica flow binaries
kl doc <format> Generate documentation for kumologica flow
kl export <language> Export deployment scripts for kumologica flow
kl open [project_directory] Open Kumologica Designer
kl test [project_directory] Run test suiteOptions:
— version Show version number [boolean]
— help Show help [boolean]Not enough non-option arguments: got 0, need at least 1
Upgrading Kumologica SDK to the latest version is as simple as repeating the installation command.
Installing a specific version of SDK, for example, version 3.0.25:
npm install -g @kumologica/sdk@3.0.25
Creating Sample Project
There are 2 ways of creating a sample Kumologica project.
1. Using Kumologica CLI
To create a sample project using Kumologica CLI go to the directory where you would like to create a project and type the ‘create’ command:
# Create new Kumologica project
kl create -p example-project
This command creates a subdirectory: ‘example-project’ with kumologica project artefacts:
example-project-flow.json
package.json
2. Using Kumologica Designer
You can always create a sample project using Kumologica Designer. Simply press the ‘Home’ button on the toolbar and then ‘Create a new Kumologica project’. You will be prompted for the project name and root directory.
A new project will always use the fixed latest runtime version. For example at the time of writing this article latest version of Kumologica Runtime is 3.0.26 and the example-project has the following dependencies in the package.json file:
"dependencies": {
"@kumologica/runtime": "3.0.26"
}
Opening Designer
Kumologica Designer can be opened using the ‘open’ command:
# Open Kumologica Designer
kl open
If Kumologica Designer is opened for the first time, this command will ask for acceptance of terms and conditions and then open the welcome screen. This screen allows the creation of a new project or the opening of existing ones. Otherwise Kumologica Designer will automatically open the most recent project.
You can also open projects from the specified directory. Using the sample project example go to the example-project directory and run the command:
# Go to example-project directory
cd example-project# Open project in Kumologica Designer
kl open .
This will open an example project in Kumologica Designer regardless of what previous project was opened.
You can also use relative or fixed paths to open projects in Kumologica Designer:
kl open /Users/user/projects/example-project
Kumologica Runtime
Kumologica Designer automatically runs Kumologica Runtime in the background. This allows local testing of flows within the designer or outside, for example using the Postman tool or curl commands.
By default the Kumologica Runtime is running locally on port 1880, this allows to test example project API:
curl http://localhost:1880/hello
{"hello":"world"}
One of the enhancements introduced in the SDK release is the capability to run multiple instances of Kumologica Designer.
In such a case each embedded Kumologica Runtime will try to acquire the following available port numbers: 1881, 1882, etc.
The project panel in Kumologica Designer shows the port number, running status and version of the associated Kumologica Runtime.
Conclusion
Kumologica SDK is a major update of Kumologica products that simplifies the management of all components and also takes advantage of the rich capabilities of npm. The next articles will explore other CLI capabilities that enable the use of Kumologica in enterprise environments.
Opinions expressed by DZone contributors are their own.
Comments