Ruby on Rails

General Setup

Every project is unique in its own nature. The tools I use to build it would differ from based on their technical requirements. How ever there are some tools that get used almost all of the time. They are not the only tools to get the job done, but I preferences based on my way of coding.

Technology Stack

  • Framework: Ruby on Rails 6.1
  • Language: Ruby 2.7.2
  • OS: Ubuntu 20.04 LTS VPS Server(s)
  • Infrastructure Automation: Chef
  • Servers: Nginx (web), Puma (app)
  • Database: PostgreSQL & Redis
  • Client Side: Slim for HTML, SASS for CSS, JavaScript
  • Tests: RSpec, Capybara and Cucumber
  • Background Jobs: Sidekiq
  • Command Line: Rake and Thor
  • Deployments: Capistrano

Framework: Ruby on Rails

Every project starts with the latest stable release of Ruby on Rails. As of March 26, 2021 that would Rails 6.1.3.1. For larger projects it is possible that during the course of development Rails (and other supportive libraries used) would receive updates. As this happens the underlying code is updated.

In the case of a pending major release, should at minimum a beta release be available, the project would be based on the newer version to avoid significant rewrite. I am an early adopter of technology when they get available.

Language: Ruby

Ruby 3.0 was released Christmas Day, 2020. How ever to this day my projects still use Ruby 2.7.2, the latest in Ruby 2. Ruby 3 is better and faster. How ever not every lib supports Ruby 3 as for April 1st 2021. These libraries are frequently monitored for Ruby 3 support. Once the upgrades are completed by the respective developers all projects upgradable to Ruby 3 would be upgraded free of charge.

OS: Ubuntu

Ubuntu is a well supported Linux distribution with a vibrant community. I prefer to use Ubuntu mostly due to the fact that until my migration to the Apple ecosystem my computers ran Ubuntu. Since my migration to MacOS I am using VirtualBox Virtual Machines running Ubuntu 20.04 managed through Vagrant. Vagrant allows me to locally create an environment almost identical to production servers thus reducing the chance of a "works on my machine" mishap from happening.

In addition to Ubuntu, I have been administering servers running Fedora, CentOS and FreeBSD.

Infrastructure Automation

Chef is used to automate infrastructure (VPS / dedicated server) configuration. This allows us to create a "cookbook" for the project with a variety of "recipes". For example we will have a recipe to configure the PostgreSQL database. With Chef we can reliably and quickly provision complex server systems with the execution of a single command.

Database

The preferred database solution of the Ruby community is PostgreSQL. Unlike MySQL it is an object-relational database that has many features not supported by MySQL like function overloading and table inheritance. In addition PostgreSQL more closely adheres to SQL standards.

Redis is used in addition to PostgreSQL which is used along side background tasks and caching.

Client Side

When a browser requests for a page Rails sends HTML5, JavaScript and CSS for styling. How ever these formats are too crude and inefficient to work with. I use Slim instead of HTML, JavaScript ES6 and Sass for CSS. Rails compiles these formats to HTML, JavaScript and CSS and delivers it to the browser and we developers can keep a neat codebase.

Client side package management is done with Webpacker.