cesium-automation

This repository documentation for Cesium Automation, a new age recurring tasks and IT workflow orchestration engine architected for the cloud. Cesium Automation is a code workflow automation platform (as opposed to no-code or low-code workflow automation platform) that allows you to write scripts in your favorite technologies and remotely execute them inside your environment in response to various events.

Signup and Use Cesium

You can signup and use Cesium at this link. More information is available at our marketing website

What use cases does Cesium Automation solve?

Cesium Automation helps you solve 2 key problems:

Examples for recurring workflows include data extraction, data movement (using FTP or S3 etc), data processing, periodic restacking, security scans etc.

Examples of IT request automation include scripts for handling things like resetting user LDAP credentials, user VPN access, granting ssh access to machines and reverting them after a set period etc. These scripts can be triggered programatically from the cloud through integrations with cloud based on service management tools like Jira.

Core Concepts

This section explains some of the key things required to work with Cesium Automation.

Deployment Model

Cesium Automation is designed to run in a hybrid model with the core orchestration service running as a SaaS service that is run and managed by us and a light weight daemon deployed on your infrastructure to run and track processes. This allows you to focus on using Cesium to solve key business problems while leaving the operational aspects of running the services and the database to us. The cloud component is refered to as Cesium core, Cesium Cloud or core scheduler in this documentation.

High Level Deployment Model

To run tasks and workflows inside your datacenter or cloud infrastructure, we do not require you to open any ports in your network or firewall. Cesium uses messages and queues to communicate commands and statuses across different systems.

The user needs to download a Task Executor and run it as a daemon process on any system in your infrastructure. The tasks and workflows will be executed on this machine by the task executor.

Entities

The core entities in Cesium are:

Workspace

The workspace is a way of organizing task executor and workflow into logical groups for easier management. If you have multiple teams within your company using Cesium , then you can try to create a workspace per team. Or if you are running workflows for different purposes, you can group them by purpose.

Task Executor

The task executor (sometimes also refered to as Tex in the documentation) is a software that must be downloaded and run on your infrastructure. The task executor:

Every task executor must be associated with a workspace. The task executor requires internet access to work correctly. The task executor initiates outbound network connections from the machine it is running on to the core scheduler in the cloud. Tex never accepts incoming requests from the internet and does not require you to open any ports in your network.

Requirements

Following are the requirements for running Tex:

Installation

The task executor can be run on Windows or any flavor of Linux. Here are the recommended best practices to run tex securely:

Running Tex

Use the following steps to run tex:

  1. Download the tex zip using the link on the download tex page
  2. Optionally create a user for tex with non-super user status.
  3. Unzip the contents into the location where you want to run tex like /opt/cesium/tex.
  4. Once the contents are unzipped into a folder, we will refer to this folder as TEX_HOME.
  5. Go to the web console of Cesium Automation and navigate to the specific task executor you are trying to run. There will be a button there to download the config file for this tex. Press it and save the file locally.
  6. Under TEX_HOME there is a folder called config with a single config file under it called tex-config.properties. Update the config values from the values you get from the file you downloaded earlier.
  7. You must now have a filled up config file that will look like this:
texId: ahasadadaasea
password: ek12this-is-a-secret-value
tenantRefId: 9abcd31l-1234-5678-1234-286dd73aec45
  1. Start script depends on the platform.
    1. On mac and Linux: run the start script: $TEX_HOME/bin/start-cesium-tex.sh . This will start tex as a background process and will write out logs under the logs folder. You can safely exit the user and the shell where you started the tex instance.
    2. On Windows: run the start script: $TEX_HOME/bin/start-cesium-tex.vbs

Downloading Tex

You can download tex from this page.

Workflow

The workflow is the most important entity in Cesium. When setting up the workflow you must input:

Once a workflow is configured, Cesium core scheduler creates a Workflow Run and sends out commands to execute the workflow. This happens irrespective of whether the task executor is running or not. If the task executor is running, it receives the messages and runs the specific workflow. The task executor sends periodic update on the status of the workflow run. You can also trigger a workflow to run on demand by using the dropdown in the actions column on the workflows page.

Workflow Trigger Types

A worfklow trigger is an event that kicks off the execution of a workflow. There are 3 main types of triggers that Cesium supports today:

Time based

This is a workflow that is expected to run at a regular time based frequency. These workflows can be configured using a cron expression.

Time based trigger configuration

Workflow Trigger

Workflows that use this trigger type are dependent on another workflow. When you select this option, the UI will show a dropdown containing the workflow that this workflow can be triggered by.

Workflow triggered configuration A workflow triggered by another workflow can be triggered in 2 modes:

Manual Trigger

A mannually run workflow can only be triggered in 2 ways:

Manually trigger workflow configuration

Examples of an API integration is the Jira App from Cesium that allows you to run a workflow in response to a webhook event from Jira. Read more about it in the Jira Integration page.

One special feature of manually triggered workflows is that they are allowed to have input variables that be added to the workflow defintion. These inputs can be passed to individual tasks in the workflow definition as variables.

Workflow Execution Rules

By default a workflow cannot have parallel runs. When a new workflow run is requested, it will not be executed if there is already a workflow run that is in requested or in-progress state. If you have configured a notification, then a notification will be sent with the existing status to the email address specified.

Workflow Definition

The workflow definition is the heart of the workflow. This is a Cesium specific way of representing an acyclic graph of tasks that need to be executed. The worflow definition is built using a graphical user interface.

Example of the workflow definition builder UX

A workflow definition is made up of 0 or more inputs and 1 or more tasks.

Inputs

Inputs are a way to pass variables to a workflow run dynamically at the time of the worklow being triggered. Inputs are only allowed for manually triggered workflows.

They can be passed as values to your tasks by adding them as args using the format ${inputs[<input_name>]} where <input_name> is the name given to the input.

Passing an input variable to a task

Tasks

A task in the workflow definition refers to a process that needs to be kicked off by tex.

A task type can one of a set of predefined types that Cesium supports. The current supported task types are:

Task Types

Each task type needs to be configured appropriately based on the configuration it requires. But there are some attributes that are common across all the task types.

Here is an explanation for each common attribute:

Name Type Meaning
name (required) String A descriptive name for this particular task. This will be shown in the UI in the workflow run details. Ideally this should be all small characters, with no spaces in between
taskType (required) Enumeration This is set when you choose the task type from the drop down
dependsOn (optional) Multiselect dropdown When adding multiple tasks in a workflow flow, you can define dependencies on the tasks so that they run in a specific order. If no depedency is specified, Tex might run them in any order including in parallel.

Task Types

The current supported task types are:

Shell Task

This is used to run:

Attributes:

PythonTask

This task type is used to run python scripts. Tex currently only supports running python3 scripts. If your task requires specific python libraries, you can define a requirements.txt in the code artifact zip file which lists all dependencies in the standard format. Tex will create a virtual env for this workflow which live inside the workflow folder. The virtual env will be activated each time this task needs to be executed. If you use absolute paths where the python scripts are under a folder not in the same folder as the requirements.txt, you can specify the path to the virtual env folder to be used for the script.

The attributes of a python task are:

Requirements:

Run Docker

Docker is a containerization technology. Using this task type you can run any docker image. The attributes required to configure a docker run are:

Requirements:

Workflow Run History

A workflow refers to a single run of the workflow. A workflow run is created whenever it is time to execute it (based on the configured cron) or it is executed on demand. Each workflow run will have the following attributes:

You can view the workflow run of a specific workflow by choosing the View History action in the workflows list or by clicking on the View History button on the details of a specific workflow.

Workflow Run Details

In workflow history, you can click on any row to see the details of a specific workflow run. The workflow run should show you the following details:

Workflow Run Details

Lifecyle of a workflow run

A workflow run goes through the following lifecycle:

Tenant Applications

Cesium allows you to create apps that can be used to invoke workflows on your own.

Creating an application

To create an application, navigate to settings and then to the appliactions settings. Click on the create new TenantApp. Enter a name and description Once an app is created it shows up in the list with an appId and an appSecret

Login and invocation of APIs

ALl APIs require a bearer token for authencation and authorization. To get a bearer token, you must do a login first. To login, you need to send a POST request to this URL:

https://app.cesiumautomation.com/cesium/api/v1/app/login
POST BODY:
{
    "tenantRefId":"542691f2-b6bf-49ee-a9f5-8b43f6339515",
    "appId":"l9l7thqgak",
    "appSecret": "this-is-a-secret-value"
}

The response for this will included a bearer JWT token like this:

{
    "tenantRefId": "542691f2-b6bf-1234-5678-910asad1213sada",
    "bearerToken": "Bearer abcdefghisjasadada.1231780safhajfjkar812930hdioasDHJSHAjdhad0900u9ue21u9eusdAHLDASDhh303241239489djaSD.JbtTQLMN9XY-LGPp4VdLjaA6UcwYf-PyykAAy1huf8I8IL5z8hTtxKBRAdpyJ771NGastH5Rt4jJhF_Zzg-hvQ"
}

Extract this bearer token and use it. An example of executing a workflow looks like this:

URL: https://app.cesiumautomation.com/cesium/api/graphql
Headers:
Authorization: "Bearer abcdefghisjasadada.1231780safhajfjkar812930hdioasDHJSHAjdhad0900u9ue21u9eusdAHLDASDhh303241239489djaSD.JbtTQLMN9XY-LGPp4VdLjaA6UcwYf-asadadIASIDHhnka1231311aAdasad-hvQ"
Method: POST

Graphql Query:
mutation($workflowId:String!,
$desc:String, $inputs:[InputKeyValuePair]){
  runWorkflowNow(workflowId:$workflowId, description: $desc,
  inputs:$inputs){
    success
    result {
      __typename
      ... on WFRun {
        runId
        scheduledTime
      }
    }
    errors{
      errorCode
      errorMessage
    }
    
  }
}

Variables:
{
  "workflowId": "9kl2nwtcef",
  "desc": "Run from API",
  "inputs": [
    {
      "name": "testInput",
      "value": "Some APIInput"
    }
  ]
}

Use your favorite graphql client for your language to send this request. Or create a simple POST request with the variables direcrly substitued to make the GraphQL call.

If this call succeeds, you should get a response like this:

{
  "data": {
    "runWorkflowNow": {
      "success": true,
      "result": {
        "__typename": "WFRun",
        "runId": "d35f8ec9-4ca4-42bc-87e2-5b57dab5650c",
        "scheduledTime": "2024-12-16T08:42:32Z"
      },
      "errors": null
    }
  }
}

If there are errors, they will be enumerated under error.

Relogin

The JWT token is valid for a fixed duration of time and will expire after some time. This will give you a response of 403 forbidden. When this happens, just do a relogin and get a new bearer token.

Executing Workflows without login

You can execute workflows without doing a login.

  1. Create an App in settings
  2. Get the tenantRefId from the tex-config.properties file. This is your Tenant Id across all apps.
  3. Create the Bearer token using this template: <Tenant_id>:<app_id>:<app_secret>
  4. Get the workflow id from workflow details page, ex 6pygm3gmtq
  5. You can now make a HTTP Request like this:
    URL: https://app.cesiumautomation.com/cesium/api/v1/workflow//execute HTTP Method: POST
    Header: "Authorization": "Bearer ::"
    Body:
    {
     "description": "From HTTP Request",
     "input": "Hello from HTTP Request"
    }
    

In this payload, input is the name of an input parameter that the workflow has.
If your workflow does not have any inputs, just keep the description or use an empty {} json payload.

Using with Make.com

Cesium Automation can be easily integrated with Make.com automations through the HTTP API. Here are the steps to follow:

  1. Create an App in settings
  2. Get the tenantRefId from the tex-config.properties file. This is your Tenant Id across all apps.
  3. Create the Bearer token using this template: Bearer <Tenant_id>:<app_id>:<app_secret>
  4. In Make.com, create a new scenario and add a step for Http Request
    • Choose Authentication Type as ‘API Key’
    • Credentials: Click on ‘Add’ and set it up like this. Paste the Bearer token into the Key section . Click on Create. Make Credentials
    • This should navigate you back to the HTTP settings
    • For URL choose: https://app.cesiumautomation.com/cesium/api/v1/workflow/<workflow_id>/execute
    • Method: POST
    • Body Content Type: application/json
    • Body Input Method: JSON String
    • Body Content: { "description": "From make.com" } or choose your own description based on the events. HTTP Request Part 1 HTTP Request Part 2
    • Click On Save
  5. Save the scenario and run it. This should create a new workflow run in Cesium which execute your script on your infrastructure.