shell-function-invoker

module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2018 License: Apache-2.0

README

= Command Function Invoker image:https://travis-ci.org/projectriff/command-function-invoker.svg?branch=master["Build Status", link="https://travis-ci.org/projectriff/command-function-invoker"]

== Purpose
The *command function invoker* provides a Docker base layer for a function consisting of a single command.
It accepts gRPC requests, invokes the command for each request in the input stream,
and sends the command's output to the stream of gRPC responses.

== Development
=== Prerequisites
The following tools are required to build this project:

- `make`
- Docker
- https://github.com/Masterminds/glide#install[Glide] for dependency management

If you intend to re-generate mocks for testing, install:

- https://github.com/vektra/mockery#installation[Mockery]

If you would like to run tests using the `ginkgo` command, install:

- http://onsi.github.io/ginkgo/[Ginkgo]

If you need to re-compile the protobuf protocol, install:

- Google's https://github.com/google/protobuf[protocol compiler]

=== Get the source
[source, bash]
----
cd $(go env GOPATH)   #defaults to ~/go
git clone -o upstream https://github.com/projectriff/command-function-invoker src/github.com/projectriff/command-function-invoker
----

=== Building
* To build locally (this will produce a binary named `command-function-invoker` on _your_ machine):
+
[source, bash]
----
make build
----

* To build the Docker base layer:
+
[source, bash]
----
make dockerize
----
This assumes that your docker client is correctly configured to target the daemon where you want the image built.

* To run tests:
+
[source, bash]
----
make test
----
* To attach a https://github.com/derekparker/delve/blob/master/Documentation/EditorIntegration.md[delve capable] debugger (such as Goland)
to a `command-function-invoker` running _inside_ k8s:
+
[source, bash]
----
make debug-dockerize
----
Then expose the `2345` port as a service, using `riff/config/delve/command-function-invoker-debug.yaml`:
+
[source, bash]
----
kubectl apply -f riff/config/delve/command-function-invoker-debug.yaml
----
Finally, update the function you would like to debug so that it picks up the new base layer.
Then you can connect the debugger through port `30110`.

=== Compiling the Protocol

The gRPC protocol for the command function invoker is defined in https://github.com/projectriff/function-proto/blob/master/function.proto[function.proto].

Clone https://github.com/projectriff/function-proto and set `$FN_PROTO_PATH` to point at the cloned directory. Then issue:
[source, bash]
----
make gen-proto
----

Directories

Path Synopsis
pkg
function
Package function is a generated protocol buffer package.
Package function is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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