Taken from the documentation:
It enables the users to create, develop, and model TOSCA service templates (i.e., RADON models), representing the applications that will be deployed using the RADON Orchestrator. The GMT is able to interact with files and folders from RADON IDE's "modeling-project". It offers also the feature to create and export a TOSCA CSAR file of a selected RADON Model to the Eclipse Che workspace to process it using other RADON tools or deploy it using the RADON Orchestrator.
You use the tool as an usability layer on top to maintain your TOSCA files in a graphical and intuitive user interface. The graphical web-editor can be used to represent the different nodes, and their dependencies, that should be deployed using RADON's TOSCA orchestrator. Thereby, GMT stores all TOSCA entities in a defined folder structure, which is accessible through the RADON IDE (modeling-project).
The example application is based on AWS and different modeling entities used for the AWS cloud provider.
All the necessary nodes can be found under the namespace radon.nodes.aws
at the palette on the left.
In our example, all the entities we need are available:
- API Gateway
- Lambda functions
- DynamoDB table
- AWS Platform
The animation below shows how to model the different nodes:
After running the rest of this lab exercise, you will have a model that looks similar to this one:
- Open GMT from the workspaces tab on the right-hand side of the RADON IDE (
radon-gmt
button): - Create a new TOSCA Service Template, as shown in the screenshot below:
You may use whichever namespace you want to store your new service template (e.g.,
your_organization.servicetemplates
) or use the same as projected (e.g.,example.org.tosca.servicetemplates
). Using your own namespace you can keep all your service templates in the same place. - Give it a name (e.g.,
serverless-todo
) and clickAdd
. - In the new view, click on the
Topology Template
tab, and clickOpen Editor
.
All the necessary TOSCA node types can be found under the namespace radon.nodes.aws
at the palette.
The ServerlessToDoListAPI application consists of the following node types:
- 1 AwsApiGateway
- 5 AwsLambdaFunction
- 1 AwsDynamoDBTable
- 1 AwsPlatform
- Model all the different nodes we need by dragging them into the canvas from the left pane
Having the nodes without specific properties will not help us much, so we need to input the correct configuration for this to work. By selecting a node, the edit pane can be used to populate the different properties. GMT provides a real time error detection to prevent the user from filing false entries.
Populate all the nodes with the correct properties:
AwsPlatform
displayName: "AwsPlatform"
properties:
name: "AWS"
region: "eu-central-1"
AwsAPIGateway
displayName: "AwsApiGateway"
properties:
name: "ServerlessToDoListAPI"
api_version: "1.0.0"
api_description: "a simple serverless API example"
AwsDynamoDBTable
displayName: "ItemsTable"
properties:
hash_key_name: "id"
read_capacity: 1
write_capacity: 1
hash_key_type: "STRING"
name: "items"
AwsLambdaFunction (get)
displayName: "GetTodoItem"
properties:
handler: "get.handler"
name: "get-todo"
runtime: "nodejs12.x"
statement_id: "get-stmt"
zip_file: "1cea0130441318a22cee6904ea971a"
env_vars: {"TODOS_TABLE":"items"}
AwsLambdaFunction (Create)
displayName: "CreateTodoItem"
properties:
handler: "create.handler"
name: "create-item"
runtime: "nodejs12.x"
statement_id: "create-stmt"
zip_file: "36f24b63abeb3a7f70a1f1ca42077e"
env_vars: {"TODOS_TABLE":"items"}
AwsLambdaFunction (list)
displayName: "ListTodoItem"
properties:
handler: "list.handler"
name: "list-item"
runtime: "nodejs12.x"
statement_id: "list-stmt"
zip_file: "9f9fd845ed2f3b061136179467ba5f"
env_vars: {"TODOS_TABLE":"items"}
AwsLambdaFunction (update)
displayName: "UpdateTodoItem"
properties:
handler: "update.handler"
name: "update-item"
runtime: "nodejs12.x"
statement_id: "update-stmt"
zip_file: "0b2516f89dbd44dc1bd03712e81db7"
env_vars: {"TODOS_TABLE":"items"}
AwsLambdaFunction (delete)
displayName: "DeleteTodoItem"
properties:
handler: "delete.handler"
name: "delete-item"
runtime: "nodejs12.x"
statement_id: "delete-stmt"
zip_file: "07714624b3dd0c78502024164411a7"
env_vars: {"TODOS_TABLE":"items"}
All the function nodes require source code attached to be useful.
On the tab Artifacts
, the artifacts that accompany the lambda function can be attached either by uploading a file or by referencing a URL from FunctionHub.
- Activate the
Artifacts
view for the canvas. - On each AWS Lambda node, attach an artifact of the type
zip
with the following URL for each:- Get:
http://cloudstash.io/artifact_download/1cea0130441318a22cee6904ea971a
- Create:
http://cloudstash.io/artifact_download/36f24b63abeb3a7f70a1f1ca42077e
- List:
http://cloudstash.io/artifact_download/9f9fd845ed2f3b061136179467ba5f
- Update:
http://cloudstash.io/artifact_download/0b2516f89dbd44dc1bd03712e81db7
- Delete
http://cloudstash.io/artifact_download/07714624b3dd0c78502024164411a7
- Get:
- Under properties for each node, make sure that the value corresponds with the value after
/artifact_download
in the url above.
All nodes have some capabilities they offer and some requirements they need from others.
As an example the requirement of the AwsLambdaFunction node HostedOn
has to be matched with the capability of AwsPlatform node host
.
The animation below shows how to use GMT to create such relationships.
- For all nodes besides
AwsPlatform
, they should have a requirement relationship from theirHostedOn
to the formershost
capability. - For all Lambda functions, the requirement of
ConnectsTo
has to be matched with the capability of the DynamoDBTable nodedatabase_endpoint
. AwsApiGateway
needs to have a requirement relationship ofInvoker
to all Lambda functions capabilityInvokable
.-
For all of the five relationships, some properties needs to be attached, listed below:
Get
properties: endpoint: "/todos/{id}" http_methods: "get"
Create
properties: endpoint: "/todos" http_methods: "post"
List
properties: endpoint: "/todos" http_methods: "get"
Update
properties: endpoint: "/todos/{id}" http_methods: "put"
Delete
properties: endpoint: "/todos/{id}" http_methods: "delete"
-
- When done, click
Save
, and your model is ready to be deployed.
At the end of this, you should have a project looking something like this:
From here, you may create a TOSCA CSAR of the modeled application.
Cloud Service Archive (CSAR) files are TOSCA’s exchange format. A CSAR is essentially a ZIP archive following a certain directory layout and contains all necessary files and templates to execute the deployment of the modeled application.
- Go back to the TOSCA Management UI and open the Service Templates view.
- Search for your service template and open it.
- In the service template detail view, you may may click on
Export
andExport to IDE
to output the generated file to the RADON IDE. - Go back to the RADON IDE.
You'll find the generated CSAR in the project folder
radon-csars
(e.g.,ServerlessToDoListAPITestingExample.csar
).
If you got stuck, the example application has already been modelled in the service templates section called ServerlessToDoListAPITestingExample
.
The TOSCA file of the above service template can be found here.
The generated CSAR is self-contained as it contains all type definitions, implementation and deployment artifacts as well as the TOSCA service template itself to deploy the application by a TOSCA-compliant orchestrator. Head over to xOpera section to deploy your model.