Skip to content

astrocket/rails-template

Repository files navigation

rails-template

Description

rails template for kubernetes deployment

see generated sample

Requirements

  • Rails 7.x (w/tailwind)
  • Ruby 3.x

Installation

To generate a Rails application using this template, pass the -m option to rails new, like this:

$ rails new project -T -d postgresql --css tailwind \
    -m https://raw.githubusercontent.com/astrocket/rails-template/master/template.rb

What's included?

  • Kubernetes & Docker for production deploy
  • Tailwind & Stimulus by importmaps
  • ActiveJob, Sidekiq, Redis setting for background job
  • ActiveAdmin + ArcticAdmin for application admin
  • Rspec + FactoryBot setting for test code

Foreman start task

Procfile based applications

with foreman start

It runs

  • rails
  • tailwind
  • sidekiq

Stimulus.js generator

Stimulus specific generator task.

with rails g stimulus posts index

It generates

  • app/javascript/posts/index_controller.js with sample html markup containing stimulus path helper.

Kubernetes & Docker

With kubernetes you can manage multiple containers with simple yaml files.

Template contains

  • deployment guide for DigitalOcean's cluster from scratch
  • Let's Encrypt issuer and Ingress configuration
  • demo deployment yaml to instantly run sample hashicorp/http-echo + nginx app
  • basic puma, nginx and sidekiq deployment setup

Testing

rspec-rails

factory-bot

Run test specs

bundle exec rspec