Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

magneticio/vamp-workflow-agent

Repository files navigation

Vamp Workflow Agent

Join the chat at https://gitter.im/magneticio/vamp Docker Build Status Download

  • retrieves a workflow JavaScript file using confd
  • launches Node.js runtime to execute the script
  • gives an overview (UI) of script execution

Usage

$ ./vamp-workflow-agent -help
                                       
Usage of ./vamp-workflow-agent:
  -help
        Print usage.
  -httpPort int
        HTTP port. (default 8080)
  -uiPath string
        Path to UI static content. (default "./ui/")
  -workflow string
        Path to workflow file. (default "/usr/local/vamp/workflow.js")
  -executionPeriod int
        Period between successive executions in seconds (0 if disabled).
  -executionTimeout int
        Maximum allowed execution time in seconds (0 if no timeout).

Some arguments are mandatory and if they are not provided, agent will try to get them from environment variables. For environment variable names check out Executing Workflow.

Building Binary

Using make:

make vamp-workflow-agent

Alternatively:

go get -d ./...
go install
CGO_ENABLED=0 go build -v -a -installsuffix cgo

Released binaries can be also downloaded.

Building Docker Images

Building the vamp-workflow-agent Docker image includes building the Go binary, downloading the vamp-node-client and building the workflow UI.

make

Docker images after the build: magneticio/vamp-workflow-agent:katana

For more details on available targets see the contents of the Makefile.

Executing Workflow

Vamp Workflow Agent:

  • retrieves workflow script
  • saves it as /usr/local/vamp/workflow.js
  • executes node /usr/local/vamp/workflow.js

Important environment variables:

  • VAMP_KEY_VALUE_STORE_TYPE <=> confd -backend
  • VAMP_KEY_VALUE_STORE_CONNECTION <=> confd -node
  • VAMP_KEY_VALUE_STORE_PATH <=> key used by confd
  • VAMP_WORKFLOW_EXECUTION_PERIOD <=> $executionPeriod
  • VAMP_WORKFLOW_EXECUTION_TIMEOUT <=> $executionTimeout
  • VAMP_ELASTICSEARCH_URL <=> http://elasticsearch:9200

Parameters related to Vamp Node.js client:

  • VAMP_URL
  • VAMP_API_CACHE - true by default
  • VAMP_API_TOKEN
  • VAMP_NAMESPACE
  • VAMP_CA - optional path to CA file
  • VAMP_TLS_CHECK - true by default

Vamp JavaScript API vamp-node-client

More details: package.json

Docker Images

Docker Hub repo.

Example:

docker run -e VAMP_KEY_VALUE_STORE_TYPE=zookeeper \
           -e VAMP_KEY_VALUE_STORE_CONNECTION=localhost:2181 \
           -e VAMP_KEY_VALUE_STORE_PATH=/scripts \
           -e VAMP_WORKFLOW_EXECUTION_PERIOD=0 \
           -e VAMP_WORKFLOW_EXECUTION_TIMEOUT=10 \
           -e VAMP_ELASTICSEARCH_URL=http://localhost:9200 \
           magneticio/vamp-workflow-agent:katana

In this example JavaScript is read from /scripts entry.