fn-ext-example

command module
v0.0.0-...-d7e9a60 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

README

fn-plugin-example

Example for adding third party plugins to fn project server.

This repo includes an example called logspam.

Method 1 - for end users / operators

This will build a custom Docker image for you with the extensions you provide in a yaml file built in.

extensions:
  - name: github.com/treeder/fn-ext-example/logspam
  - name: github.com/treeder/fn-ext-example/logspam2

Build it:

fn build-server -t imageuser/imagename

Now run your new server:

docker run --rm --name fnserver -it -v $PWD/data:/app/data -p 8080:8080 imageuser/imagename

And deploy a function to try it out:

fn init --runtime go myfunc
cd myfunc
fn deploy --local --app myapp
fn call myapp /myfunc

Method 2 - for extension developers

This method is good for extension developers as it's fast builds for dev/testing.

Copy main.go from fn repo, then add plugins. See main.go in this repo for an example.

Then assuming you have the fn project in your GOPATH or you've vendored it here, it should build:

go build -o fnserver
./fnserver

Then deploy a function and you'll see the special spam output like this:


        ______
       / ____/___
      / /_  / __ \
     / __/ / / / /
    /_/   /_/ /_/
        v0.3.528

INFO[2018-08-08T13:46:13+03:00] Fn serving on `:8080`                         type=full
YO! This is an annoying message that will happen every time a function is called.
YO! And this is an annoying message that will happen AFTER every time a function is called.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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