Ruby on Rails setup SOP

Topics: Ruby on Rails

This checklist records a Rails application setup process, from installation through deployment configuration.

Install Rails

rails new _version_ <project_name> --database=postgresql

Configure gems

see also Common Rails gems

Set up Docker Compose

Set up configuration:

  • Dockerfile
  • docker-compose.yml
  • .dockerignore

Install helper scripts

  • app
  • abe

Set up development tools

Dotenv

Add to .gitignore to make sure the actual file doesn’t get committed to the repository:

.env

Do add a .env.sample file with the required variables.

RSpec

abe rails generate rspec:install

Rubocop

Configure rubocop.yml.

Rake

Set up Rakefile.

Set up hosting

  • Heroku staging
  • Heroku production

Add a .procfile to the repository.

Set up Gitlab CI

Deployment

Add environment secrets for staging and production:

  • HEROKU_STAGING_API_KEY
  • HEROKU_PRODUCTION_API_KEY

Configure the database

Add gem to Gemfile:

gem "pg"

Configure database.yml.

Set up databases:

abe rails db:setup
abe rails db:migrate
abe rails db:migrate RAILS_ENV=test

Create User model

abe rails generate scaffold users first_name:string last_name:string username:string

Set up Devise

Set up ActionPolicy

Set up TailwindCSS