Designing a Ruby Serverless Runtime
daniel-azuma.com
daniel-azuma.com
This is extremely exciting -- I've always loved the idea of running Ruby in a serverless context, and I've always preferred Google Cloud Functions to Lambda for its simplicity. This is super good news in general.
I definitely recommend taking a look at Ruby on Jets for inspiration, which brings a very rails-like serverless Ruby framework to fruition in AWS Lambda.
But that said, now that Google has a full-fledged Ruby runtime, it might be interesting to see if Jets can be rebased on Google Cloud Functions, maybe some adapter layer that can be swapped in for different underlying cloud vendors to help applications avoid lock-in to any vendor's product.
How are people managing Cloud Functions these days? Any ruby tools around this topic? I‘m excited to try this on the weekends.
edit: also huge thanks for unbundling the google-cloud ruby gems.
If you have feedback on Cloud Functions, feel free to open issues on the GoogleCloudPlatform/functions-framework-ruby repo on GitHub, which is where the open source side of the runtime is housed.
Especially good is treating the Gemfile.lock as input for the the file system image and requiring it.
Also, the post is huge for the amount of information given
my_proc = proc { |request| "Hello, world!" }
FunctionsFramework.http("hello", &my_proc)* FunctionsFramework allows us to open-source the parts of the runtime not tied to the Google Cloud Functions hosting environment itself, meaning it should be possible to port it to other hosting, such as Kubernetes, Google Cloud Run, even FaaS products from other vendors.
* Procs work, but they're just objects. We'd still need some kind of interface to name them, load them, etc. Otherwise we'd be limited to, e.g., setting a special constant or global variable to the proc, which is messy, makes testing harder, etc.
* Speaking of which, a FunctionsFramework library gives us a place to put the unit testing library, tools to spin up a functions server locally for testing, and whatever tools developers might find useful in the future.
For reasons such as these, Google's overall Cloud Functions team decided to produce framework libraries for all supported languages. There's a contract and everything that our Ruby gem follows. (https://github.com/GoogleCloudPlatform/functions-framework)