Giter Site home page Giter Site logo

serverless-fission's Introduction

Fission Serverless Plugin

This plugin brings Fission support within the Serverless Framework.

Pre requisites

Make sure you have a fission running and fission-cli is installed. You can find the installation intructions here.

You can install serverless with npm,

$ npm install serverless -g

Try out the example

Clone repo and check the example function

$ git clone https://github.com/infracloudio/serverless-fission/
$ cd examples/python
$ cat serverless.yml
service: hello

provider:
  name: fission
  runtime: python2.7

plugins:
  - serverless-fission

functions:
  hello:
    description: 'Hello function'
    handler: handler.hello

Download dependencies

$ npm install ../../

Create an Environment.

$ serverless create --template node-1 --img node --nmspace default
Fission environment node-1 created.  

Deploy function.

$ serverless deploy --template hello --env node-1 --code hello.js
Fission function hello created

The function will be deployed to Kubernetes via fission.

$ fission function list
NAME  UID                                  ENV    EXECUTORTYPE MINSCALE MAXSCALE MINCPU MAXCPU MINMEMORY MAXMEMORY TARGETCPU             
hello 2b0f9c51-7459-11e8-a089-080027cdd0a9 python poolmgr      0        1        0      0      0         0         80         
$ kubectl get pods --all-namespaces
NAMESPACE          NAME                                                              READY     STATUS        RESTARTS   AGE   
fission-function   python-2b073331-7459-11e8-a089-080027cdd0a9-5h3iitxq-66b4c56lrb   2/2       Running       0          15s             
fission-function   python-2b073331-7459-11e8-a089-080027cdd0a9-5h3iitxq-66b4c5vzpv   2/2       Running       0          15s             
fission-function   python-2b073331-7459-11e8-a089-080027cdd0a9-5h3iitxq-66b4cn8psk   2/2       Running       0          15s  

Now you will be able to call the function:

$ serverless invoke --router 127.0.0.1 --port 8443 --fnname hello
hello world

If you are using minikube, you can call the function through HTTP and the Node Port in which function is running:

$ curl  http://$(minikube ip):31314/hello
hello world

If you want to remove the deployed function.

$ serverless remove  --fn hello --nmspace default
Fission function hello deleted.

If you wanted to rollback one of the created environments.

$ serverless rollback --env node-1 --nmspace
Fission environment 'python' deleted

Demo: asciicast

serverless-fission's People

Contributors

gucifer avatar sanketsudake avatar

Watchers

Jaroslav Urbánek avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.