Abe Voelker's blog Programming stuff, mainly

Deploying a Ruby on Rails application to Google Kubernetes Engine: a step-by-step guide - Part 1: Introduction and creating cloud resources

17 minute read

Drawing of Kubernetes application design

Welcome to part one of this five-part series on deploying a Rails application to Google Kubernetes Engine. If you’d like to jump ahead, you can visit the following parts:
Part 2: Up and running with Kubernetes
Part 3: Cache static assets using Cloud CDN
Part 4: Enable HTTPS using Let’s Encrypt and cert-manager
Part 5: Conclusion, further topics and Rails extras

Following up on my last post on why I’m switching personal projects from AWS to Google Cloud (GCP), this series of posts will walk through deploying an example Ruby on Rails application to GCP’s Kubernetes Engine (GKE). You should be able to follow this tutorial without experience with Ruby or Rails (please let me know if I fail at this).

Why I'm switching from AWS to Google Cloud (GCP) for new personal projects

25 minute read

"Friendship ended" meme with AWS/Jeff Bar rejected in favor of Google Cloud

Note: This post started as an introductory section on a different post walking through deploying applications with Google Kubernetes Engine (GKE). However, it got too long so I made it into a standalone post. Look for the follow-up soon!

This post is about why I have taken a preference for Google Cloud (GCP) for developing web apps, as contrasted with my experiences using AWS. This is not meant to be an exhaustive comparison between the two, but rather what stands out to me as an application developer.

Generating YouTube-like IDs in Postgres using PL/V8 and Hashids

8 minute read

Hashid

Update: There is a brand-new Postgres Hashids extension that you should use if possible instead of this PL/V8 solution! However, this solution may still be valuable if you are using AWS RDS, which doesn’t currently support the Hashids extension.

Recently on a Rails project, I ran into an issue where I wanted to expose a resource (lets say it was a product) in a RESTful route, but I also didn’t want the URLs to be easily guessable. In other words, following Rails conventions my standard “show” actions would be URLs like https://example.com/products/1, https://example.com/products/2, https://example.com/products/3, which are trivially guessable since we’re exposing the database’s auto-incrementing integer primary key as the resource ID. To prevent people from writing a super simple script that could scrape my whole product catalog, it would be nice if we could make the URLs not trivially guessable while still remaining publicly-accessable for people who know them.

Adding Elm to a Rails application

8 minute read

Elm logo

Update: This tutorial was written before Rails 5.1 was released with integrated Webpack support, which makes this whole process much simpler. If you’re using Rails 5.1+, check out this tutorial instead.

Recently I added Elm to a Rails application using webpack, and it took me a while to figure out as I’m new to both so I figured I’d share what I did.

A complete example app is available on GitHub (abevoelker/rails-elm-example); this post will walk through each step used to create it.