Sunday, May 19, 2024
HomeGolangA Golang-based Light-weight Automation Engine

A Golang-based Light-weight Automation Engine


µTask is an automation engine constructed for the cloud. It’s:

  • easy to function: solely a Postgres DB is required
  • safe: all information is encrypted, solely seen to approved customers
  • extensible: you may develop customized actions in golang

µTask means that you can mannequin enterprise processes in a declarative YAML format. Describe a set of inputs and a graph of actions and their inter-dependencies: µTask will asynchronously deal with the execution of every motion, working its approach round transient errors and retaining an encrypted, auditable hint of all middleman states till completion.

Actual-world examples

Listed below are just a few real-world examples that may be applied with µTask:

Kubernetes ingress TLS certificates provisioning

A brand new ingress is created on the manufacturing Kubernetes cluster. A hook triggers a µTask template that:

  • generates a personal key
  • requests a brand new certificates
  • meets the certificates issuer’s challenges
  • commits the ensuing certificates again to the cluster

New workforce member bootstrap

A brand new member joins the workforce. The workforce chief begins a activity specifying the brand new member’s title, that:

  • asks the brand new workforce member to generate an SSH key pair and replica the general public key in a µTask-generated kind
  • registers the general public SSH key centrally
  • creates accounts on inside providers (code repository, CI/CD, inside PaaS, …) for the brand new workforce member
  • triggers one other activity to spawn a improvement VM
  • sends a welcome e mail filled with GIFs

Funds API asynchronous processing

The funds API receives a request that requires an asynchronous antifraud examine. It spawns a activity on its companion µTask occasion that:

  • calls a primary risk-assessing API, which returns a quantity
  • if the chance is low, the duty succeeds instantly
  • in any other case, it calls a SaaS antifraud answer API which returns a rating
  • if the rating is sweet, the duty succeeds
  • if the rating could be very dangerous, the duty fails
  • whether it is in between, it triggers a human investigation step the place an operator can enter a rating in a µTask-generated kind
  • when it’s finished, the duty sends an occasion to the funds API to inform of the outcome

The funds API references the operating workflow by way of its activity ID. Operators of the funds API can observe the state of present duties by requesting the µTask occasion immediately. Relying on the funds API implementation, it could enable its callers to observe a activity’s state.

Fast begin

Working with docker-compose

Obtain our newest set up script, setup your setting and launch your individual native occasion of µTask.

mkdir utask && cd utask
wget https://github.com/ovh/utask/releases/newest/obtain/install-utask.sh
sh install-utask.sh
docker-compose up

All of the configuration for the appliance is discovered within the setting variables in docker-compose.yaml. You’ll see that fundamental auth is setup for consumer admin with password 1234. Strive logging in with this consumer on the graphical dashboard: http://localhost:8081/ui/dashboard.

You can too discover the API schema: http://localhost:8081/unsecured/spec.json.

Request a brand new activity: 

Get an outline of all duties: 

Get an in depth view of a operating activity: 

Browse obtainable activity templates: 

Working with your individual postgres service

Alternatively, you may clone this repository and construct the µTask binary:

make all

Working in manufacturing

The folder you created within the earlier step will change into a git repo the place you model your individual activity templates and plugins. Re-download and run the newest set up script to bump your model of µTask.

You’ll deploy your model of µTask by constructing a docker picture primarily based on the official µTask picture, together with your extensions. See the Dockerfile generated throughout set up.

Structure

µTask is designed to run a activity scheduler and carry out the duty workloads inside a single runtime: work just isn’t delegated to exterior brokers. A number of cases of the appliance will coordinate round a single Postgres database: every will be capable of decide independently which duties can be found. When an occasion of µTask decides to execute a activity, it is going to clutch that activity to keep away from collisions, then launch it on the finish of an execution cycle.

A activity will preserve operating so long as its steps are efficiently executed. If a activity’s execution is interrupted earlier than completion, it is going to change into obtainable to be re-collected by one of many energetic cases of µTask. That signifies that execution would possibly begin in a single occasion and resume on a special one.

Upkeep procedures

Key rotation

  1. Generate a brand new key with symmecrypt, with the ‘storage’ label.
  2. Add it to your configuration objects. The library will contemplate all keys and use the newest doable key, falling again to older keys when discovering older information.
  3. Set your API in upkeep mode (env var or command line arg, see config under): all write actions shall be refused once you reboot the API.
  4. Reboot API.
  5. Make a POST request on the /key-rotate endpoint of the API.
  6. All information shall be encrypted with the newest key, you may delete older keys.
  7. De-activate upkeep mode.
  8. Reboot API.

Dependencies

The one dependency for µTask is a Postgres database server. The minimal model for the Postgres database is 9.5

Configuration 

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments