4 minute read

MRSK is this new deployment tool planned to be baked into Rails. The goal is to allow app developers select the best cloud provider that fits their use case, and avoid vendor lock-in. If you’ve ever felt the dread of “Our cloud costs have gotten expensive, but switching is so much work. So let’s take on multiple projects to save-costs™.”, you will enjoy MRSK. MRSK finally answers the age old question, “You say the application is running in the cloud. What happens if it rains?”

tl;dr

MRSK allows us travel the cloud across cloud providers. Web app developers can now rig up complex service meshes — if you know what you’re doing — and deploy the entire fleet under 20 minutes. A little Rails, a little Docker and …actually, what if MRSK is a pun on painting blue docker containers™ in the Rails red colour?

Below is my log of trying this our for the first time.

Friction Log

Persona

I’m a Ruby main, part of the Rails bandwagon. Currently working in a Sinatra-based setup since it’s easy to configure this for microservices and distributed computing.

Context

I heard about MRSK and thought to give it a spin. If it is what it promises, then… DHH may just have brought Terraform concept to Rails. It’s exciting times.

Stream of Consciousness

I, first off, created a new app with the current version of Rails I had installed — 7.0 – and installed the MRSK gem. The app I’m going to be building is the canonical blog post app; nothing fancy.

rails new test-mrsk
gem install mrsk

To set the app up, I scaffold a Post resource, and root to post#index.

Before I started, I checked I could login to GHCR using docker. First issue I faced was because I decided not to use Docker Hub, but GHCR, for my container images. The documentation for logging into GHCR is flawed somewhat… but that may be my terminal. The documentation asks to pipe the $PAT through to the docker login command. I found — after many tries — that simply pasting the $PAT in after the docker login command should suffice.

Then I ran mrsk init within the folder, and got ready to get going. Configuring MRSK, I realize I need servers somewhere to get this deployed. I then setup an account on Hetzner — why not? — I copy the IP into the configuration, e voila! It did not work.

Turns out MRSK uses SSH to deploy, and you’d have to add your SSH key to the server you’ve created. So I added my public key to the Hetzner server, and retried the deployment. Now MRSK could connect to the server, and everything was chugging along smoothly. When it tried to find the docker image to build off, it barfed again. — at this point, I must comment the error messages that MRSK spits out! We’ve come a long way, as an industry generally, with the US of error messages. Thanks to the folks at Elm and Rust. Y’all set the bar high on this onw. MRSK is not far behind. It does seem like it spits out a lot of text, but reading through shows clearly what’s going on. — The barf is because the version of Ruby in my Dockerfile, generated by the rails new --main command, did not have an image. I changed this to the version in my Gemfile, and retried the deploy

diff --git a/Dockerfile b/Dockerfile
index a8186d4..7f561f3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,7 @@
 # syntax = docker/dockerfile:1

 # Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
-ARG RUBY_VERSION=3.0.3.157
+ARG RUBY_VERSION=3.0.3
 FROM ruby:$RUBY_VERSION-slim as base

 # Rails app lives here

Finally, we get a successful deployment. Checking the IP, it all works. This deployments took 9m 2s on my Macbook Air — because who needs a Pro when working in the cloud™? — please tell me that joke landed. — This is exciting. 10 minutes for a cold deploy is nothing. With this, I’m excited to try out a warm deploy. I make a change to one of the views and run mrsk deploy again to deploy the app. This time, it took 1m 57s for the entire deployment. I’m no devops guy, but this… this is very impressive. I also tried the version with multiple servers and a shared database. All worked like a charm.

Obviously, everything in the MRSK Intro Video worked as marketed. But that’s not what’s interesting. I didn’t bother to switch cloud providers, since working with 1 — just based on the IP and the fact that said IP fronts a Linux box — is enough proof that it does work with other cloud providers. The interesting thing was: after the experimentation, I ran mrsk remove to destroy all instances created during the deploy. Removing all instances took 35s. When I checked my billing on Hetzner, I only spent 5c. 5 CENTS!!! Only 10% of the popular rap artist. This! …was the interesting bit. Not only can we now travel the cloud across providers; testing the viability of a cloud provider on your infrastructure is now dirt cheap. Imagine how cheaper this would be with something like Terraform.

All in all, MRSK is impressive.

Updated:

Leave a comment