From 9438f3c4ecbdff86593383c3e0361c9afb006f9c Mon Sep 17 00:00:00 2001 From: Erwin van Eyk Date: Fri, 3 Aug 2018 09:07:08 +0200 Subject: [PATCH] Updated binary environment README (#773) - Added usage instructions for getting started quickly. - Added instructions for using the builder --- environments/binary/README.md | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/environments/binary/README.md b/environments/binary/README.md index a49ddfd4..ac0abc39 100644 --- a/environments/binary/README.md +++ b/environments/binary/README.md @@ -4,22 +4,30 @@ The `binary` runtime is a go server that uses a subprocess to invoke executables Use Cases - Execute bash scripts -- Run executables of languages that have no dedicated environment yet. +- 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 utilty commandline tools installed, such as 'grep'. -However, in case you want to make use of more ecsoteric commandline tools, you should add the relevant apk to the +⚠️ **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. ## Usage +To get started with the latest binary environment: + +```bash +fission env create --name binary --image fission/binary-env --builder fission/binary-builder +``` + The interface to the executable used by this environment is somewhat similar to a [CGI interface](https://en.wikipedia.org/wiki/Common_Gateway_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: -``` +```bash # Request Metadata CONTENT_LENGTH REQUEST_URI @@ -28,18 +36,23 @@ 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. +See the [README](../../examples/binary/README.md) in the binary examples directory for additional usage instructions. ## Compiling -Build the Dockerfile: +To build the runtime environment: ```bash docker build --tag=${USER}/binary-env . ``` -See the [README](../../examples/binary/README.md) in the binary examples directory for usage instructions. +To build the builder environment: +```bash +(cd builder/ && docker build --tag=${USER}/binary-builder .) +``` \ No newline at end of file