Murrtube 2.0 - Tech Update

May 11, 2023

What happened here

What happened to Murrtube a couple weeks back was a complete do over.
Essentially, a big old rm -rf murrtube

Murrtube has been around for almost 5 years now, and its original developer passed the baby over to me about 3 years ago. And in those 3 years, nothing much has happened. Barely any maintenance, no features, no updates... It was a self-sustained baby. But the accumulation of micro-patches and lazy fixing was starting to leave its marks.

It was time to start the engine again

In this article, I will go over what Murrtube used to be, and what it is now. Lots of changes have been made, and it's probably all for the best :3

Murrtube 1.0

Let me go a little over how Murrtube was made when we started.

The stack

Murrtube's backend is made with Ruby on Rails. Back then, it was done with Rails 5. We used GraphQL for the front to back communication, so it wasn't per say a traditional Rails backend, no controller actions and such, just a bunch of GQL types, queries and mutations.


The frontend was all ReactJS. Version 16.10 or so. Class components and all that :|
It used Apollo as the GraphQL interface.


Aside from that, for the more hidden stuff, we had one postgres database for everything and a redis instance for jobs.

So.. what's wrong with it

Well it so happens that, I'm not a frontend dev. I do backend and devops. I used to be fullstack Rails/React but I've been drifting away from React. And when you're given a fat React baby like this, and you're trying to get away from it... Not great.


The stack in itself was decent, Murrtube was made at a point in time where we wanted to explore React and GraphQL, and this was a good way to do that! But maybe Murrtube didn't really need the added complexity that a multi-language stack brought.

Murrtube 2.0

So what does it look like now? Let me explain.

The new stack

Rails. End of story. Nah but for real tho, when I said earlier i rm -rf'ed the whole thing, I meant it. Murrtube 2.0 is born out of a rails new murrtube, and it lost so much weight in the process.

From scratch

So I decided to start everything from scratch. Alright I'll be honest, some services have been copy-pasted from the legacy app. But mostly, GraphQL gone, React gone.


We are now using Rails 7, still using Postgres for the database, and Redis is gone (we use the good_job gem for the workers)


Every single view has been remade in ERB, all the GQL queries and mutations have moved to Rails controller actions. This has made the codebase considerably leaner, and most of all, far easier for me, a Rails dev, to work on.
I still had a hard time redoing the views because well, I still don't like doing views, and I suck at CSS, but I was greatly helped by my first CSS library love from years ago, Bulma.
Another thing that was a pain is getting the grip of Turbo, which is shipped in Rails 7 project. God I passionately hate Turbo. And they ship 'em with Stimulus too but don't even get me started on that garbage, so that one I just entirely removed. But I did my best to make things work with Turbo because well, I had to keep the app a little bit reactive even without React, else it would have felt like a regression.

Database changes

Now that the website was remade, I was more free to do things the way I wanted to. One of the main things that happened is that Murrtube now uses 2 separate databases. One for the core models, and another that I call the 'statistics' database. That one stores all the Views, Likes, Ad Impresions, Search queries, etc... Anything that is stored only to spit out numbers is there.
There is one main reason for that. Money. Murrtube backs up it's database very often to a S3 bucket. So what I thought was that it can keep doing that, but with a much leaner database. The statistics database on the other hand is backed up much less frequently, and that database has tens of millions of records. What that means is that I am storing less volume on S3, so it's cheaper. And this is fine really, in the event a backup is needed, because we backup the core models a lot, but it's not such a disaster if we lose 24 hours worth of views count.


One other thing happened with the databases: The schema got a trim too. And this is one of the reasons we had to put the app down for a whole evening when we re-launched. With a new, leaner schema, I had to make a migration script to transfer everything from legacy to 2.0, and check integrity of the data afterwards.

What about storage

Murrtube used and still uses Minio for storage. A self-hosted S3 compatible service that I personally really love. Still though, we decided to update and upgrade this service, and recreate a new Minio instance completely, with new buckets, with monitoring and the whole show.
This was reason number two why we did the shutdown: Moving 3000 videos to the new Minio. This was done progressively, with one last run and check during shutdown.

Lil' gadgets for me

One last thing I did too was to add a whole monitoring stack for the server holding Murrtube. A very simple Grafana dashboard, collecting data from a Prometheus instance, fed by a Node-Exporter instance.
This lets me know how the server is doing, check for peak usage and whatnot, and I dunno, I just like looking at graphs.

What does it look like

I made a little schema of what Murrtube is all about since May 1st. It's fairly straightforward, and it's completely manageable for a one-cat operation :3



A little breakdown of this thing, we have our Production Containers, with the web servers and workers. There are 4 instances of each. Metrics are computed in jobs, so I'm more comfortable having enough workers to handle them.
Then there's the other containers:
Murrtube About is the web server for this website you're on right now.
Murrtube Market is the web server for the advertising on Murrtube website.
Murrtube Staging is the web server for the staging environment where I test the stuff.
Then we got all the other stuff I talked about earlier.

And that's about it!

All in all, what we have here is something that I have made entirely myself. As opposed to something done by someone else that I took upon myself to maintain.
It allows me to be much more at ease when doing maintenance operation, or when I want to introduce new features to Murrtube. Up until now, I would do the bare minimum to fix something, or find some super dirty way to fix it.


And to conclude this lil article, I just wanna say that we're very open to suggestions or ideas, or even bug reporting for Murrtube, so if you got something to say, please do get in touch with us!


We'll be happy to hear from you and we're always looking to make Murrtube a little better every day :)