Giter VIP home page Giter VIP logo

Refunc

Refunc is a Kubernetes native serverless platform.

Refunc Architecture

Features

  • Easy of use - Embrace the serverless ecosystem with an AWS Lambda compatible API and runtimes
  • Portable - Run everywhere that has Kubernetes
  • Scale from zero - Autoscale from zero-to-many and vice versa
  • Extensible - Runtime compatibility layer (lambda and other clouds' function), transport layer (NATS based for now)

Quick Start

Before starting, you need a Kubernetes cluster. You can use minikube to run a minimal Kubernetes cluster locally.

If you'd like to run on macOS, Docker for Mac with Kubernetes enabled is recommended.

Install Refunc

Install refunc-play, a minimal setup of Refunc, using the following commands:

# This will create namespace `refunc-play` and deploy components in it
docker run --rm -it refunc/refunc refunc play gen -n refunc-play | kubectl apply -f -
# create runtime python3.7
kubectl create -n refunc-play -f \
https://github.com/refunc/lambda-python3.7-example/releases/download/v0.0.2/xenv.yaml

Here we use the python3.7 runtime as an example. Currently Refunc supports all AWS provided runtimes as well as some converted runtimes, check refunc/lambda-runtimes to learn more.

The AWS Way

Refunc uses an AWS API compatible gateway to provide Lambda and S3 services, which makes it possible to use the AWS CLI to manage functions locally.

Before starting, we need to forward the gateway to your localhost:

kubectl port-forward deployment/aws-api-gw 9000:80 -n refunc-play

Download the pre-built function for convenience:

cd /tmp
wget https://github.com/refunc/lambda-python3.7-example/releases/download/v0.0.1/lambda.zip

Create Function

aws --endpoint-url=http://127.0.0.1:9000 \
lambda create-function --function-name localtest \
--handler lambda_function.lambda_handler \
--zip-file fileb:///tmp/lambda.zip \
--runtime python3.7 \
--role arn:aws:iam::XXXXXXXXXXXXX:role/your_lambda_execution_role

Invoke Function

aws --endpoint-url=http://127.0.0.1:9000 \
lambda invoke --function-name localtest /tmp/output.json && cat /tmp/output.json

The Refunc Way

Let's create a Lambda function using the python3.7 runtime with an HTTP endpoint:

kubectl create -n refunc-play -f https://github.com/refunc/lambda-python3.7-example/releases/download/v0.0.2/inone.yaml

Forward the Refunc HTTP gateway to your localhost:

kubectl port-forward deployment/refunc-play 7788:7788 -n refunc-play

Now, it's OK to send a request to your function:

curl -v  http://127.0.0.1:7788/refunc-play/python37-function

User Interface

Internally we use Rancher to build our PaaS and other internal services. Currently there is a simple management UI forked from rancher/ui which is backed by our Rancher API compatible server.

functions.png

License

Copyright (c) 2018 refunc.io

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

refunc.io's Projects

go-observer icon go-observer

Go package for simplifying channel-based broadcasting of events from multiple publishers to multiple observers

refunc icon refunc

Cloud Native Function-as-a-Service Platform On Kubernetes.

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.