supraworker

command module
v0.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

README

Supraworker

Build Status GitHub All Releases License Go Report Card Docker Pulls Docker Image Size (latest by date)

The abstraction layer around jobs, allows pull a job from your API periodically, call-back your API, observe execution time and to control concurrent execution.

It's responsible for getting the commands from your API, running commands, and streaming the logs back to your API. It also sends state updates to your API.

Getting started

Find the version you wish to install on the GitHub Releases page and download either the darwin-amd64 binary for MacOS or the linux-amd64 binary for Linux. No other operating systems or architectures have pre-built binaries at this time.

[!WARNING] Running releasses on MacOs: You need to download file, extract it and remove attributes with the following command (where /Users/weldpua2008/Downloads/supraworker_darwin_amd64/supraworker is path to the file)

$ xattr -d com.apple.quarantine /Users/weldpua2008/Downloads/supraworker_darwin_amd64/supraworker
$ /Users/weldpua2008/Downloads/supraworker_darwin_amd64/supraworker
  • MacOs X Homebrew is a free and open-source package management system for Mac OS X.
 brew tap weldpua2008/tap
 brew install weldpua2008/tap/supraworker

To update to the latest, run

brew upgrade weldpua2008/tap/supraworker
Configuring

Define config at $HOME/supraworker.yaml:

[!WARNING] Keys are not case sensitivity (https://github.com/spf13/viper/pull/635#issuecomment-580659676): Viper's default behaviour of lowercasing the keys for key insensitivity is incompatible with these standards and has the side effect of making it difficult for use cases such as case sensitive API credentials in configuration. For eg: MyApiKey=MySecret

# ClientId in case you need to identify the worker
clientId: "my_uniq_client_id"
# how ofen call your API
api_delay_sec: 10
# jobs related operations
jobs:
  get:
    url: "http://localhost:80/get/new/job"
    method: POST
    headers:
      "Content-type": "application/json"
      params:
        "clientid": "{{ .ClientId}}"

Installing

Download automation
  • Download for Linux latest release
curl --silent -L  "https://api.github.com/repos/weldpua2008/supraworker/releases/latest"  \
| jq --arg PLATFORM_ARCH "$(echo `uname -s`_amd| tr '[:upper:]' '[:lower:]')" -r '.assets[] | select(.name | contains($PLATFORM_ARCH)).browser_download_url' \
| xargs -I % curl -sSL  % \
| sudo tar --strip-components=1  -xzf  -
Installing from source
  1. install Go v1.13+
  2. clone this down into your $GOPATH
  • mkdir -p $GOPATH/src/github.com/weldpua2008
  • git clone https://github.com/weldpua2008/supraworker $GOPATH/src/github.com/weldpua2008/supraworker
  • cd $GOPATH/src/github.com/weldpua2008/supraworker
  1. install golangci-lint for linting + static analysis
  • Lint: docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.24.0 golangci-lint run -v
Running tests
  • expires all test results
$ go clean -testcache
  • run all tests
$ go test -bench= -test.v  ./...

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package cmd provides CLI interfaces for the `supraworker` application.
Package cmd provides CLI interfaces for the `supraworker` application.
Package communicator provides transport implementations.
Package communicator provides transport implementations.
Package config provides configuration for `supraworker` application.
Package config provides configuration for `supraworker` application.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL