binary

command
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

README

Binary Environment Examples

The binary runtime is a go server that uses a subprocess to invoke executables or execute shell scripts.

Use Cases

  • Execute bash scripts
  • Execute arbitrary binaries (such as common sysadmin tools)
  • Get support in any programming language by executing the generated executable.

⚠️ Words of Caution ⚠️

The environment runs on an alpine image with some additional utility commandline tools installed, such as 'grep'. However, in case you want to make use of more esoteric commandline tools, you should add the relevant apk to the Dockerfile and build a new binary environment. See 'Compiling' for instructions.

When executing functions using binaries, ensure that the executable is built for the right architecture. Using the default binary environment this means that the binary should be build for Linux.

Looking for ready-to-run examples? See the binary examples directory.

Usage

To get started with the latest binary environment:

kubefaas env create --name binary --image kubefaas/binary-env --builder kubefaas/binary-builder

The interface to the executable used by this environment is somewhat similar to a CGI interface. This means that any HTTP headers are converted to environment variables of the form "HTTP_". For example these are some of frequently occurring headers:

# Request Metadata
CONTENT_LENGTH
REQUEST_URI
REQUEST_METHOD

# HTTP Headers
HTTP_ACCEPT
HTTP_USER-AGENT
HTTP_CONTENT-TYPE
# ...

The body of HTTP piped over the STDIN to the executable. All output that is provided to the server over the STDOUT will be transformed into the HTTP response.

Compiling

To build the runtime environment:

docker build --tag=${USER}/binary-env .

To build the builder environment:

(cd builder/ && docker build --tag=${USER}/binary-builder .)

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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