Edit: After some discussions it became clear that the original idea to implement lambdas in other languages was not ideal. The following describes the new proposal:
- Use WASM to create Lambda Scripts. (Using wasmer-go )
- Allow one? Lambda Script per tenant.
- Support multiple lambda servers (internal + external)
@lambda → default lambda on alpha
@lambda(url: xxx) → run on external lambda
Reference: Feature request: multiple lambda servers
- Optionally load WASM script from external server (since WASM can become quiet large)
If WASM provides a good lambda experience, consider expanding WASM into:
- tokenizer implementations
- functions/graph algorithms
- community sharing of said code artifacts
I have now started working on WASM support and testing for Go, Rust and AssemblyScript.
I added a pull request that would allow developers to deploy lambda servers within docker containers on alpha. This means developers are able to use any programming language that supports webserver development to use as lambda server.
dgraph alpha --my=alpha:7080 --zero=zero:5080 --security "whitelist=0.0.0.0/0" --lambda "docker-image=ghcr.io/schartey/dgraph-lambda-example:main; docker-registry=https://ghcr.io/;"
So I added docker parameters and the alpha automatically pulls the image and starts a container.
- Rebased the Dockerfile on a dind ubuntu image, so we can start docker images on alpha.
- Added multiple flags to lambda: docker-image, docker-user, docker-password, docker-registry
- If docker-image flag is set, alpha tries to download docker image and runs image as container instead of node
Opinions and other feedback is welcome. Are there any issues with this idea? If feedback is positive I will continue development.
- admin api update
Allow update of docker image through admin api
I also provided an example project of what such a lambda server could look like in Go:
- Develop in accustomed programming language
- Use any library without workarounds or webpack
- Run custom graph algorithms next to the db