Installing the CLI

# Install the CLI from NPM
$ npm install -g binaris  

# This will prompt for an API key and keep it in ~/.binaris.yml
$ bn login

bn create

Creates the function files locally.

Examples

bn create python2 hello

Positional arguments

  • runtime: node8, python2, pypy2, java8 or python3
  • function: The function name (e.g. hello)

Options

  • --path, -p <dir>: Create the function code in directory dir.

Local files

bn create generates two local files: function.js or function.py with the function code, and binaris.yml with its configuration.

For the example above, the following configuration is created:

functions:
  hello:
    file: function.py
    entrypoint: handler
    runtime: python2

The configuration declares a single function called hello, sets its runtime to python2, and maps it to a specific function (handler) in a file (function.py).

bn deploy

Deploys a function to the cloud.

Examples

bn deploy hello

Positional arguments

  • function: The function name (e.g. hello)

Options

  • --path, -p <dir>: Deploy a function with source files stored in dir.

bn invoke

Runs the function in the cloud.

Examples

bn invoke hello
bn invoke hello --data '{"name": "globe"}'    # Dictionary
bn invoke hello --data '"JSON String"'        # String. Note the double quotes!
bn invoke hello --json payload.json           # Takes data from the file

Positional arguments

  • function: The function name (e.g. hello)

Options

  • --json, -j: Path to file containing JSON data. The data will be sent as the HTTP body.
  • --data, -d: Data to send with is HTTP body. The data will be JSON-ified.

bn logs

Retrieves the function logs from the cloud.

Examples

# Retrieve all logs
bn logs hello

# Tail all logs
bn logs hello --tail

# Logs since a specified ISO date/time
bn logs hello --since 2018-03-09T22:12:21.861Z

# Logs since a unix timestamp
bn logs hello --since 1520816105798

# Logs since a specified offset
bn logs hello --since 3d
bn logs hello --since 13hours
bn logs hello --since 9s

Positional arguments

  • function: The function name (e.g. hello)

Options

  • --since, -s: Outputs logs after the given ISO timestamp, e.g. 1m or 4h
  • --tail, -t: Outputs logs in tail -f fashion (ignores --since flag)

bn list

Displays the list of functions currently deployed in the cloud.

Examples

bn list

Options

  • --json: Outputs results in JSON rather than plain text.

bn remove

Removes a function from the cloud. Local files remain intact.

Examples

bn remove hello

Positional arguments

  • function: The function name (e.g. hello)

bn perf

Run a performance test and display the statistics.

Examples

# Run performance test on function foo (5000 invocations, serially)
bn perf foo

# Run performance test with 1,000 invocations
bn perf foo -n 1000

# Run performance test with 1,000 invocations and 4 concurrent connections
bn perf foo -n 1000 -c 4

# Run performance test with 1,000 invocations and send JSON data with each request
bn perf foo -n 1000 -d '{ "someData": "myData" }'

# Run performance test only up to 10 seconds
bn perf foo -t 10

Positional arguments

  • function: The function name (e.g. hello)

Options

  • --maxRequests, -n: Number of invocations to perform (default: 5000).
  • --concurrency, -c: How many requests run concurrently (default: 1).
  • --data, -d: Data to include with performance invocations.
  • --maxSeconds, -t: Maximum time in seconds.