docker build -t simplism-faas .
docker run -d -p 9000:7000 --name simplism-faas-container --rm simplism-faas
# docker run -p 9000:7000 --name simplism-faas-container --rm simplism-faas
# Simplism is listening on the 7000 http port, I map the host 9000 port of the host on the container port
wget https://github.com/simplism-registry/hello-world/releases/download/v0.0.1/hello-world.wasm
curl http://localhost:9000/registry/push \
-F '[email protected]'
wget https://github.com/simplism-registry/small-cow/releases/download/v0.0.0/small-cow.wasm
curl http://localhost:9000/registry/push \
-F '[email protected]'
wget https://github.com/simplism-registry/small-ant/releases/download/v0.0.0/small_ant.wasm
curl http://localhost:9000/registry/push \
-F 'file=@small_ant.wasm'
curl http://localhost:9000/registry/discover \
-H 'content-type:text/plain; charset=UTF-8'
curl -X POST \
http://localhost:9000/spawn \
--data-binary @- << EOF
{
"wasm-file":"./tmp/hello-world.wasm",
"wasm-function":"handle",
"wasm-url": "http://localhost:7000/registry/pull/hello-world.wasm",
"discovery-endpoint":"http://localhost:7000/discovery",
"service-name": "hello-world"
}
EOF
# ✋ port 7000 is internal
curl -X POST \
http://localhost:9000/spawn \
--data-binary @- << EOF
{
"wasm-file":"./tmp/small-cow.wasm",
"wasm-function":"handle",
"wasm-url": "http://localhost:7000/registry/pull/small-cow.wasm",
"discovery-endpoint":"http://localhost:7000/discovery",
"service-name": "small-cow"
}
EOF
curl -X POST \
http://localhost:9000/spawn \
--data-binary @- << EOF
{
"wasm-file":"./tmp/small_ant.wasm",
"wasm-function":"handle",
"wasm-url": "http://localhost:7000/registry/pull/small_ant.wasm",
"discovery-endpoint":"http://localhost:7000/discovery",
"service-name": "small_ant"
}
EOF
curl http://localhost:9000/discovery \
-H 'content-type:text/plain; charset=UTF-8'
delete service by name
curl -X DELETE http://localhost:9000/spawn/name/hello-world
curl http://localhost:9000/service/hello-world \
-H 'content-type: application/json; charset=utf-8' \
-d '{"firstName":"Bob","lastName":"Morane"}'
curl http://localhost:9000/service/small-cow \
-d '👋 Hello World 🌍'
curl http://localhost:9000/service/small_ant \
-d '✋ Hey people 🤗'
docker stop simplism-faas-container