- RailsNotes Newsletter
- Posts
- The RailsNotes Newsletter 🟥 ISSUE #25
The RailsNotes Newsletter 🟥 ISSUE #25
🟥 ISSUE #25 (Deployment Rails with Kamal, PostgreSQL, Hetzner and more!)
Ship containers to the moon (or just a server on the other side of the world) with Kamal 😉
— SPONSOR — | Thanks to PgAnalyze for sponsoring this newsletter again! Their free ebook dives deep into subqueries, materialized views, and custom data types in Postgres and Ruby on Rails with real examples, and real code. |
Welcome to The RailsNotes Newsletter — Issue #25! This issue is about Kamal!
Hello! For this week’s newsletter, I thought we’d dive into Kamal. Kamal is a new deployment tool from DHH/37signals which aims to streamline Docker deployments to bare-metal servers. It hit the scene around 6 months ago, and as it’s started to mature, there’s been some pretty interesting content coming out, which I thought would be fun to share.
Also, thanks again to PgAnalyze for sponsoring this newsletter again! Their free advanced database ebook is actually pretty sweet — it dives deep into some more advanced use cases like optimizing subqueries and using materialized views, and has cool diagrams like this to break things down—
~ ✨ FEATURED ARTICLE ✨ ~
This could be you, watching your contains get rocketed off to a far-away server 🚢 🚀
If you’ve been following Rails news lately you would’ve been hearing all about Kamal, the deployment framework from 37signals and DHH. In some ways it reminds me a lot of Dokku (which I’ve written about extensively) — Kamal is a tool for deploying apps to your own servers, letting you reap all the associated benefits (like cheap hardware costs!).
I’ve trawled through a bunch of articles on Kamal, and this one stood out to me as a great introduction. The author, Guillaume, does a great job breaking down some real code examples that you can use to deploy a Ruby on Rails app with a SQLite database (see last issue for more SQLite).
Another great introduction article I found was one called Production-Grade (ish) Rails deployment on Hetzner with Kamal (luizkowalski.net) — it has some great diagrams and covers a more complicated deployment, but it’s not explained as thoroughly as the main article here, so I’ve kept it as an aside.
I’m really curious to hear from you all about Kamal — have you used it? Are you using it to run a decently sized production-grade app? Reply to this email, I’d love to chat about it! Otherwise, enjoy the articles 👍️
~ MORE ARTICLES ~
This is a great article for anyone actually using Kamal and trying to figure out how to deal with database backups! The author, Stefan, is a longtime reader of the newsletter (👋 hey Stefan!) and he’s really gone all-out with the depth of this article.
He dives into setting up the Kamal accessory correctly, handling backups to S3-like services, restoring backups and much, much more. A really great read if you’re looking to use Kamal in production (or already are!).
Another great Kamal deployment guide, this time by Josef. I’ve included this article for its depth — he’s dug deep into deploying a bunch of different things, including: PostgreSQL, Redis, ActiveStorage, static assets and more.
We’ve slowly gotten to the base of the iceberg — the first couple of articles we the tip of the iceberg (decent overviews), we’ve worked our way down the iceberg with some more advanced articles, and finally we’re at the bottom. This article is part one of a 4 part mega-series on Kamal deployments.
It’s another brilliant resource that walks you through just about everything you’ll ever need to know about Kamal deployments 😅
~ ⚒️ HANDY TIP ~
→ Environment-specific Rails Credentials
Did you know that the Rails credentials can be made environment-specific?
By default, running rails credentials:edit
will edit a global credential file, but you can pass the -e
flag to specify an environment to limit the credentials to (ie: development
, test
or production
).
This is a handy way to make sure you’re using development credentials locally (ie: Stripe test mode for payments), but using real credentials in production (ie: Stripe live mode credentials).
Set environment-specific credentials by passing -e to rails credentials:edit.
Learn more here: Using different credentials for different environments (RailsNotes)
~👀 BEHIND THE SCENES~
This is a private section 🔐 for readers with 2+ referrals!
I share behind-the-scenes updates on RailsNotes and RailsNotes UI (think traffic numbers, sales, upcoming updates etc.)
Want access? Learn about the ✨ referral program ✨ down below! 👇️
For the past few weeks, but particularly these last two, I’ve been really pushing the development of my upcoming Ruby on Rails template. It’s been in the works for a few months now, and I’ve mentioned it in the BTS section before, but it’s finally coming together!
I consider the template ~95% done, and I tweeted this week about writing the documentation for the template — I want this template to have the best documentation of any Ruby on Rails template, and I’ve put together nearly 10,000 words of docs to walk people through every single thing they need to do, to get set up.
If you’re interested in a feature overview, this is the final breakdown:
Authentication with Devise, including OAuth login with Google and Github, password login, and password resets.
Payments with the Pay gem including integrations with Stripe and Paddle for handling subscriptions. I’m also hoping to add Lemon Squeezy as a payment provider soon.
Deployment to Render, Heroku and Hatchbox using a custom
rails g deploy
generator for creating the required files.A small test suite in both
minitest
andrspec
, so you can pick the test suite you prefer.Plus more! Handy scripts, walkthrough videos, and more.
My aim is to provide an extremely solid foundation for people to build ontop of — I’ve kept it relatively simple, with a small featureset, and a tiny set of extra gems.
Let me know if you’re interested! I’m at the point where I’d love to share it with a few people and get their feedback on using it. If you haven’t already purchased RailsNotes UI, I’d be happy to send you a free license in return for help testing it out + some detailed feedback.
If you’re keen, just reply to this email and I’ll get back to you!
~ 🌯 WRAP UP ~
Thanks for reading! The quick wrap-up for this week is —
Kamal is here to stay, and there are a bunch of great articles to walk you through deploying with it.
PgAnalyze has a pretty sweet ebook that you might like to check out, about advanced database techniques for Rails apps.
I’m cooking up something new for RailsNotes UI 😉 Keep an eye out over the following weeks.
Share the RailsNotes Newsletter!
Use your unique link below to refer new Ruby on Rails devs to this newsletter (and make me really happy!). I’ll reward you with coupon codes, access to a private section, and a free RailsNotes UI license key 👇️
[Refer 1] A small feature in the next newsletter (with a link to something you’re working on, or your socials)
[Refer 2] Permanent access to the behind-the-scenes section, above 👆️
[Refer 5] A $20 coupon for RailsNotes UI 📬️
[Refer 15] Free licence key for RailsNotes UI 🤑