https://github.com/jumboframes/tigerbalm
A ECMAScript Faas(function as a service) framework in go.
https://github.com/jumboframes/tigerbalm
faas javascript serverless
Last synced: about 1 month ago
JSON representation
A ECMAScript Faas(function as a service) framework in go.
- Host: GitHub
- URL: https://github.com/jumboframes/tigerbalm
- Owner: jumboframes
- License: mit
- Created: 2018-03-01T15:14:05.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-02-12T13:46:53.000Z (over 4 years ago)
- Last Synced: 2025-07-06T07:09:29.727Z (12 months ago)
- Topics: faas, javascript, serverless
- Language: Go
- Homepage:
- Size: 85.9 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TigerBalm
Jack of all trades, A Faas(function as a service) framework, to custom a plugin by adding a javascript snippet, to activate the snippet by killing pid with signal hangup(```kill -HUP $pid```) instead of further compiling.
Currently support:
* env
* log
* http
* kafka
## To run tigerbalm
```
git clone https://github.com/jumboframes/tigerbalm
make
./tigerbalm -f ./tigerbalm.yaml
```
## To start customizing a snippet
### A proxy
```
var http = require("http")
var log = require("log")
var env = require("env")
function register() {
var route = new Object();
route.match = new Object();
route.match.path = "/foo";
route.match.method = "GET";
route.handler = httpHandler;
var registration = Object();
registration.route = route;
return registration
}
function httpHandler(request) {
log.Debugf("incoming request, host: %s, url: %s",
request["Host"], request["Url"])
req = {
"Method": "GET",
"Host": env.Get("GOOGLE"),
"Path": "/bar",
}
data = http.DoRequest(req)
log.Debugf("do request, host: %s, body: %s", env.Get("GOOGLE"), data["Body"])
return {
"Status": 200,
"Body": "Austin Zhai"
}
}
```
### A kafka logic broker
```
var log = require("log")
var producer = require("producer")
function register() {
registration = {
"consume": {
"match": {
"topic": "austin",
"group": "zhai"
},
"handler": kafkaHandler,
}
}
return registration
}
function kafkaHandler(msg) {
log.Debugf("incoming message, topic: %s, group: %s",
msg["Topic"], msg["Group"])
msg = {
"Topic": "austin_relay",
"Payload": msg["Payload"],
}
ret = producer.Produce(msg)
log.Debugf("relay message to topic: %s %v", "austin_relay", ret)
}
```