Ruby on Jets 4.0 Release: Ruby 3.2 Support
Jets v4 is an interesting release. It supports Ruby 3.2 on AWS Lambda even before AWS official support for Ruby 3.2. Read along to find out how this was done.
Update 6/7/2023: AWS Lambda has officially released support for Ruby 3.2 🎉 AWS Blog Post. Tested and deployed a Jets v4 app and it works on the official Ruby 3.2 runtime with no changes 😄
A Little Backstory
A few weeks ago saw this:
- This jets issue comment: Ruby 3.x Support
- A Serverless Gems customer asking the ethon gem.
The user mentioned that Lambda published the Ruby 3.2 Container image. I was salivating about AWS officially releasing support for Ruby 3.2. Sadly, I did not read the comment closely and mistakenly thought that Ruby 3.2 was already released. Even provided screenshots. Again, without reading the comment closely enough. 🤦🏻♂️ Thankfully, the user handled my careless speed-reading and let me know gently. 👍
Around the same time, a long-time Serverless Gems customer contacted me about the ethon gem. It’s a gem that was apparently written by the same typheous team. It wraps libcurl libraries to make network calls at a low level. The ethon gem was quite problematic to compile and get the binaries working. Eventually, I figured it out and was able to build a Serverless Gems package for it. Shipped it!
Jets v4: Ruby 3.2 Support
These things planted the seed to look at Jets and AWS Lambda Ruby 3.2 again. The most interesting thing about this release is that we can test Ruby 3.2 before AWS officially releases it. This is achieved by using an AWS Lambda Custom Runtime.
AWS Lambda Custom Runtime
For folks interested in trying Jets with Ruby 3.2 on AWS Lambda now, you can use the Custom AWS Lambda Runtime. Building a Custom Runtime is not for the faint of heart. It took a few days of fiddling around before I was able to get it working! Thankfully, using the Custom Runtime is not as hard as building it. You can use the Custom Runtime today by following these docs: AWS Lambda Custom Runtime: Ruby 3.2.
I’m sure AWS will release Ruby 3.2. It’s even noted in this issue comment that they typically release it in about 90 days after publishing their Docker image.
What Happens When AWS Releases Ruby 3.2
When AWS releases the official Ruby 3.2 runtime, Jets v4 should support it as-is. You just have to remove the Custom Runtime layer config.lambda.layers
configuration in config/application.rb and jets deploy
again. That’ll swap out the Custom Runtime with the Official Runtime. That’s how it’s supposed to work 😄
Upgrading
If you’re upgrading from Jets v3 to v4, take a look at the Jets Upgrading Guide. A blue-green deploy is probably required.
Additional Fixes
Also, used the opportunity to tackle a few issues that many users have kindly reported. Thank you to these amazing users who provide many details in their reports and are generous with their time.
- #641 bundle check and prevent error from getting to aws lambda
- #642 Fix rack mounted apps: update interface with removed meth
- #643 JETS_EXTRA support, deprecate JETS_ENV_EXTRA
- #644 remove docs to separate repo
- #645 PreheatJob: fix function lookups and iam function permission
- #646 log debug uploading and setting content type
- #647 fix Jets.logger call
- #648 make sure logger level info is default
- #649 Custom Domain: Hard fail on IAM permission error
- #650 Validate lambda function names
- #651 allow custom rake tasks with params to work with jets as well as rake command
- #652 Validate lambda function names: fix regexp
- #653 refactor cleanup: rename Jets::Naming to Jets::Names
- #654 Ruby 3.2 Support
Full Jets CHANGELOG
Happy Jets Users
Jets is still going strong. People who use Ruby on Jets report that they absolutely love it ❤️ They have a secret weapon 🦸♂️ Jets is still one of best serverless frameworks in the world. Of course, I’m bias. 🤣 But that’s my 2 cents. Hope you enjoy Jets Release v4. 🎉
Thanks for reading this far. If you found this article useful, I'd really appreciate it if you share this article so others can find it too! Thanks 😁 Also follow me on Twitter.
Got questions? Check out BoltOps.
You might also like
More tools:
-
Kubes
Kubes: Kubernetes Deployment Tool
Kubes is a Kubernetes Deployment Tool. It builds the docker image, creates the Kubernetes YAML, and runs kubectl apply. It automates the deployment process and saves you precious finger-typing energy.
-
Jets
Jets: The Ruby Serverless Framework
Ruby on Jets allows you to create and deploy serverless services with ease, and to seamlessly glue AWS services together with the most beautiful dynamic language: Ruby. It includes everything you need to build an API and deploy it to AWS Lambda. Jets leverages the power of Ruby to make serverless joyful for everyone.
-
Lono
Lono: The CloudFormation Framework
Building infrastructure-as-code is challenging. Lono makes it much easier and fun. It includes everything you need to manage and deploy infrastructure-as-code.