Skip to content

Example for adding third party plugins to fn project server.

License

Notifications You must be signed in to change notification settings

fnproject/fn-ext-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Example for adding third party plugins to fn project server.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •