Serverless framework

Anyone thought about making Julia available on serverless framework?

6 Likes

There’s https://github.com/samoconnor/AWSLambda.jl but I haven’t used it personally.

Yes, I’m aware of that.

Serverless is an abstraction over any cloud, however. It would also be really nice to get Julia out there from a marketing perspective :wink:

It’s so weird, I was looking for exactly that like 4 days ago. Yea… This would be mighty nice…

1 Like

I am assuming that OpenWhisk, Fn and OpenFaaS project might have a sub-repo, for the Julia’s template. If you are targeting something around standardization - consider this https://cloudevents.io/.

In any case: I wonder if both micro-services and serverless functions could be implemented, auto-tested and deployed during workshops, at the conf:

https://devopsstage.com/

Ivan

I feel some inertia here :blush:

Please vote :slight_smile:

Minor update: it is now possible to create custom function on azure. Though, there are no samples for julia, but only for r and go, it is possible to adapt them for julia. So, it is now possible to build azure serverless with julia.

Here is outline:

Overall process of writing custom azure function described here:
Create Azure Functions on Linux using a custom image | Microsoft Docs?
tabs=bash%2Cportal&pivots=programming-language-python

Here is example (prototype, proof of concept). We create custom image (based on python image, but it probably could be any, lean base image):

FROM mcr.microsoft.com/azure-functions/python:3.0-python3.9

COPY context/ .

RUN tar zxvf julia-1.6.0-linux-x86_64.tar.gz
ENV PATH="${PATH}:/julia-1.6.0/bin"
RUN julia -e "using Pkg; Pkg.add(\"Genie\")"

#EXPOSE 8080 80
ENV FUNCTIONS_WORKER_RUNTIME_VERSION=1.6

CMD [ "/azure-functions-host/Microsoft.Azure.WebJobs.Script.WebHost" ]

Now, some simple web server (server.jl):

using Genie
import Genie.Router: route
import Genie.Renderer.Json: json

const PORT = parse(Int64, get(ENV, "FUNCTIONS_CUSTOMHANDLER_PORT", "8080"))
Genie.config.run_as_server = true
Genie.config.server_port = PORT

route("/api/order") do
    (:message => "order at api") |> json
end

route("/order") do
    (:message => "just order") |> json
end
Genie.startup()

Config files are all default except for host.json, where we need to start julia with our server:

"customHandler": {
    "description": {
      "defaultExecutablePath": "/julia-1.6.0/bin/julia",
      "workingDirectory": "",
      "arguments": ["server.jl"]
    },
    "enableForwardingHttpRequest": true
  }

This is all. And here is how it looks:

2 Likes