binaris

Binaris SDK & CLI

Binaris functions are being replaced with our new scripting platform for business workflows & integration. Thanks!
Last updated 2 years ago by binaris .
MIT · Original npm · Tarball · package.json
$ cnpm install binaris 
SYNC missed versions from official npm registry.

Binaris

Binaris is a fast, low-latency FaaS (Function as a Service) platform. With our performance and scale, you can run real production workloads on Node.js.

Getting up and running in seconds

  1. Install using npm
npm install -g binaris
  1. Setup Binaris credentials

    • If you already have an account it's as simple as exporting your existing credentials
    • Otherwise head over to Binaris to sign up
  2. Generate a Binaris template function

# generates simple NodeJS template function
bn create node8 hellofunc
  1. Deploy a function
# makes the function available via Binaris cloud
bn deploy hellofunc
  1. Invoke a function
# calls the function endpoint via https
bn invoke hellofunc
  1. Make changes to a function
git diff
--- a/function.js
+++ b/function.js

-    console.log('Hello World');
+    console.log('Hello Binaris');

# redeploy the function
bn deploy hellofunc
  1. Get logs for a function
bn logs hellofunc

It's as simple as that.

Running without Node & NPM

There's a docker version of the Binaris CLI, published on Dockerhub as binaris/bn.

Usage

To run in the current directory:


docker run --rm -v $(pwd):/src binaris/bn --help

You'll want to forward your API key. So add -e BINARIS_API_KEY like so:


docker run --rm -e BINARIS_API_KEY -v $(pwd):/src binaris/bn

For convenience, you can create an alias for this in bash:


alias bn='docker run --rm -e BINARIS_API_KEY -v $(pwd):/src binaris/bn'
bn create node8 hello
bn deploy hello
bn invoke hello

Storing secrets and other configuration parameters

You can pass configuration parameters to functions as part of the deploy command. These parameters will be available to the function during runtime as environment variables. All parameters are encrypted at rest and in-transit, which makes them the preferred way to store API keys, passwords, etc.

To pass parameters into a function, add an env: section to binaris.yml, like so:

functions:
  hello:
    file: function.js
    entrypoint: handler
    runtime: node8
    env:
      SOME_API_KEY: XXXXXXXXXXX

If a parameter is sensitive and you don't want to commit it to SCM, you can leave out the value in binaris.yml:

functions:
  hello:
    file: function.js
    entrypoint: handler
    runtime: node8
    env:
      SOME_API_KEY:

And pass it as an environment variable to the deploy command:

You can then access these parameters as environment variables:

function.js

exports.handler = () => {
  const apiKey = process.env.SOME_API_KEY;
  // ...
}

Or in Python:

import os

def handler(body, req):
    apiKey = os.environ['SOME_API_KEY']
    # ...

Only string values are supported in the env: section.

SOME_API_KEY=XXXXXXX bn deploy hello

Learn more about the Binaris platform at the developer resources page.

This project is licensed under the terms of the MIT license

Current Tags

  • 7.0.0                                ...           beta (a year ago)
  • 7.0.0                                ...           latest (a year ago)

48 Versions

  • 7.0.0 [deprecated]           ...           a year ago
  • 6.7.0 [deprecated]           ...           2 years ago
  • 6.6.2 [deprecated]           ...           2 years ago
  • 6.5.0 [deprecated]           ...           2 years ago
  • 6.4.0 [deprecated]           ...           2 years ago
  • 6.3.0 [deprecated]           ...           2 years ago
  • 6.2.0 [deprecated]           ...           2 years ago
  • 6.1.1 [deprecated]           ...           2 years ago
  • 6.0.9 [deprecated]           ...           2 years ago
  • 6.0.8 [deprecated]           ...           2 years ago
  • 6.0.6 [deprecated]           ...           2 years ago
  • 6.0.5 [deprecated]           ...           2 years ago
  • 6.0.4 [deprecated]           ...           2 years ago
  • 6.0.1 [deprecated]           ...           2 years ago
  • 6.0.0 [deprecated]           ...           2 years ago
  • 6.0.0-rc.4                                ...           2 years ago
  • 6.0.0-rc.3                                ...           2 years ago
  • 6.0.0-rc.1                                ...           2 years ago
  • 5.4.3 [deprecated]           ...           2 years ago
  • 5.4.2 [deprecated]           ...           2 years ago
  • 5.4.1 [deprecated]           ...           2 years ago
  • 5.4.0 [deprecated]           ...           2 years ago
  • 5.3.2 [deprecated]           ...           2 years ago
  • 5.3.1 [deprecated]           ...           2 years ago
  • 5.3.0 [deprecated]           ...           2 years ago
  • 5.2.1 [deprecated]           ...           2 years ago
  • 5.2.0 [deprecated]           ...           2 years ago
  • 5.0.1 [deprecated]           ...           2 years ago
  • 5.0.0 [deprecated]           ...           2 years ago
  • 4.0.7 [deprecated]           ...           2 years ago
  • 4.1.0 [deprecated]           ...           2 years ago
  • 3.1.3 [deprecated]           ...           2 years ago
  • 3.1.2 [deprecated]           ...           2 years ago
  • 3.1.1 [deprecated]           ...           2 years ago
  • 3.1.0 [deprecated]           ...           2 years ago
  • 4.0.5 [deprecated]           ...           2 years ago
  • 4.0.3 [deprecated]           ...           2 years ago
  • 4.0.2 [deprecated]           ...           2 years ago
  • 4.0.1 [deprecated]           ...           2 years ago
  • 4.0.0 [deprecated]           ...           2 years ago
  • 3.0.1 [deprecated]           ...           2 years ago
  • 3.0.0 [deprecated]           ...           3 years ago
  • 2.0.2 [deprecated]           ...           3 years ago
  • 2.0.1 [deprecated]           ...           3 years ago
  • 1.5.0 [deprecated]           ...           3 years ago
  • 1.5.1 [deprecated]           ...           3 years ago
  • 1.4.0 [deprecated]           ...           3 years ago
  • 1.0.0 [deprecated]           ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (22)
Dev Dependencies (7)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |