Public | Automated Build

Last pushed: 13 days ago
Short Description
Retrieves a JavaScript file from key-value store and executes it
Full Description

Vamp Workflow Agent

  • retrieves a workflow JavaScript file using confd
  • launches Node.js runtime to execute the script

Usage

$ ./vamp-workflow-agent -help

Usage of ./vamp-workflow-agent:
  -help
        Print usage.
  -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 the build.sh script:

  ./build.sh --make

Alternatively:

  • go get github.com/tools/godep
  • godep restore
  • go install
  • CGO_ENABLED=0 go build -v -a -installsuffix cgo

Deliverable is in target/go directory.

Released binaries can be also downloaded.

Building Docker Images

$ ./build.sh -h

Usage of ./build.sh:

  -h|--help   Help.
  -l|--list   List built Docker images.
  -r|--remove Remove Docker image.
  -m|--make   Build the binary and copy it to the Docker directories.
  -b|--build  Build Docker image.
  -a|--all    Build all binaries, by default only linux:amd64.

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-node-client

More details: package.json

Docker

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 \
           magneticio/vamp-workflow-agent:katana

In this example JavaScript is read from /scripts entry.

Docker Pull Command
Owner
magneticio
Source Repository

Comments (0)