BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Google Cloud Supports Ruby on Cloud Functions

Google Cloud Supports Ruby on Cloud Functions

This item in japanese

Google Cloud recently announced the public preview of Ruby on Cloud Functions. The open-source Functions Framework for Ruby supports HTTP functions and CloudEvent functions.

Introduced by Google in 2017, Cloud Functions is a serverless execution environment for building and connecting cloud services. Functions are executed in language-specific runtimes and can be written in Node.js, Python, Go, Java, .NET, and now Ruby. The execution environment includes the runtime, the operating system, and a library that invokes the function. For Ruby, the runtimes supported in preview are Ruby 2.6 and Ruby 2.7. Daniel Azuma, senior developer relations engineer at Google, explains how developers can use them:

You can write HTTP functions to respond to HTTP events, and CloudEvent functions to process events sourced from various cloud and Google Cloud services including Pub/Sub, Cloud Storage and Firestore.

In a separate article, "Designing a Ruby Serverless Runtime", he shares some of the design choices behind the product and the approach to five different components: function syntax, concurrency and lifecycle, testing, dependencies, and standards. He concludes:

Serverless is a fundamentally different way of thinking about compute resources, and as an industry we are still very early in our understanding of the implications. As my team designed the Ruby runtime for Google Cloud Functions, we were mindful about the ways the serverless paradigm interacts with our normal Ruby practices. In some cases, as with testing, it encourages us to double down on the good parts of Ruby culture. In others, as with how to express and notate a function in a language that strictly speaking doesn’t have them, it challenges our ideas of how to present code and communicate its intent.

The open-source Functions Framework for Ruby is available on GitHub. On top of Cloud Functions, it supports Cloud Run, any Knative-based environment and local development machines.

JK Gunnink, senior consultant at Mechanical Rock, wrote a guide for automated testing and deployment of Ruby functions on Google Cloud. Google is not the first cloud provider to support the language on a serverless framework. Ricardo Siqueira de Oliveira Leite, software engineer at VTEX, tweeted two years ago:

We want FaaS (Function as a service) for Ruby! This is an online petition to show that Ruby community is prepared to go Serverless and show Function as a Service provider.

A petition that was signed by over 1600 developers and is now a forum for Ruby enthusiasts. Two years later, with support on AWS Lambda since 2018 and now on Google Cloud, the community has reached the goal. Ken Collins, AWS Serverless Hero and principal engineer at Custom Ink, launched earlier this year Lambda Containers with Rails. Azure Functions currently supports seven languages but Ruby is not one of them.

A Ruby quickstart guide is available for Google Cloud Functions and, as for other support languages, GCP has a monthly free tier including two million invocations and an allocation of 400000 GB-seconds and 200000 GHz-seconds of compute time.

Rate this Article

Adoption
Style

BT