docker swarm init
git clone https://github.com/openfaas/faas
cd faas
./deploy_stack.sh
open http://127.0.0.1:8080
import (
"fmt"
"io/ioutil"
"log"
"os"
"handler/function"
)
func main() {
input, err := ioutil.ReadAll(os.Stdin)
if err != nil {
log.Fatalf("Unable to read standard input: %s", err.Error())
}
fmt.Println(function.Handle(input))
}
// Handle a serverless request
func Handle(req []byte) string {
return fmt.Sprintf("Hello, Go. You said: %s", string(req))
}
# Populate example here - i.e. "cat", "sha512sum" or "node index.js"
ENV fprocess="./handler"
# Set to true to see request in function logs
ENV write_debug="false"
EXPOSE 8080
HEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1
CMD [ "fwatchdog" ]
where "X" is anything not related to the business
Example: framework, in-memory database, queue system, new programming language, etc.
and I'm sorry 🙏
If you had to maintain my code
I hope you learned more by maintaining it
than me by writing it
Slides made with Reveal.js and hugo-reveal