Jets 5 is a massive release. I started it a few months ago, and it just snowballed. Almost every line of the Jets core source code was touch. I think users will be thrilled with the Jets 5 results.
Single Lambda Function for Controllers
This is one of the biggest changes about Jets 5. Jets now deploys a single Lambda function that handles Jets Controller requests. Working with a single Lambda function for controllers simplifies debugging. The newly introduced jets logs takes advantage of this and can be used to tail logs from CloudWatch in your terminal. A single Lambda function also helps with prewarming.
Similarly, Jets now deploys an API Gateway with essentially a single proxy route. Technically, there are 2 routes, one for the root level and a catchall route, but it’s simpler to think about it as a single endpoint.
This enables Jets to write a more powerful Router than APIGW. Jets can get around APIGW limitations like the “Sibling Variable Limit” problem.
The Jets Router is also more closely “compatible” with the Rails Routing engine. This makes it easier to write gems like kingsman, which is a port of devise. Yes, there’s an authentication solution for the Jets now, and it’s called Kingsman.
Jets Engines comes into existence with Jets 5. A Jets Engine is very similar to a Rails Engine. It’s essentially a port of it. Studying the Rails Engines source code for this was a trip. The Rails Engine source code is a beautiful piece of work.
Jets Engines allows you to hook into the Jets initialization process and write extensions. Many plugins were written as a part of this. Here are some of them:
- importmap-jets: Importmap for Javscript.
- jbuilder-jets: DSL for JSON.
- jets-responders: DRY up code with
- kaminari-jets: Pagination plugin.
- kingsman: Authentication Solution.
- omniauth-jets_csrf_protection: OmniAuth Cross-Site Request Forgery Protection.
- sprockets-jets: Asset Packaging.
Interestingly, the Engine initializer ability helps abstract and decouple things like database initialization. This makes Dynomite and ActiveRecord completely optional for a Jets app.
Jets Controllers are also improved. I took a completely different approach with controllers this time. Essentially, I’m making Jets Controllers “ActionController and ActionView compatible”. Thanks to the approach, I was able to add support for:
- around filters
- cache control and etag caching support
- content security policy
- cookies support via actionpack
- flash support
- forgery protection improvements
- importmap support
- i18n support
Boom! That’s a lot of great features.
I completely refactored the CloudFormation builders. It writes to friendly template names now. Internally, the logical ID and property names have all been converted to CamelCase format. It’s much easier to work with the Jets code when it’s all CamelCase on the inside. We can easily search for the CamelCase version that matches the AWS CloudFormation documentation. This is a huge deal for those familar with CloudFormation who want to debug and investigate.
Users can still use Ruby conventional underscore casing from the outside in their Jets app. Jets converts fields to CamelCase correctly early on during the processing phase.
As a part of Jets 5, Jets Pro has been improved to support:
- Release History: See your release history with the web browser or with the
jets releasesCLI command.
- Rollback Ability: Rollback your app if needed.
To see your release history:
jets rollback VERSION
The Jets Docs site has been improved. There are gentle learn guides for 3 the different modes:
There’s also additional detailed docs.
- Kingsman: Authentication Solution.
- Dynomite: DynamoDB ActiveModel Compatible Library.
- HowTos: New HowTos Section.
Jets Upgrade Tool
I’m also introducing a separate jets-upgrade tool. This tool rewrites your Jets project source code to work with Jets 5. Of course, accounting for all cases and Jets apps is unfeasible. This script cannot perform miracle upgrades. It’s a best-effort script, and the hope is that this script gets you pretty far and is helpful. 😄
There are so many improvements that a blog post won’t do it justice. I’m happy that it’s finally out. Take Jets 5 for a ride and enjoy! 🎉
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
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: 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: 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.