rails7-startkit

Launch Rails with 1 shell command!

MIT License

Stars
575
Committers
7

Rails 7. Start Kit

Copy & Paste in your terminal

❤️ Linux / MacOS

git clone https://github.com/the-teacher/rails7-startkit.git && \
  cd rails7-startkit && \
  ruby bin/setup

💙 Windows

git clone https://github.com/the-teacher/rails7-startkit.git & cd rails7-startkit & ruby bin/setup

What Is That?

Rails App in a Docker container with some popular preinstalled tools.

Why Do I Need It?

Save hours, days or weeks on setting up a typical Rails app.

What Cases for Using It?

  • You start new Rails project
  • You need a playground for experiments
  • You learn Rails and related technologies
  • You teach people or record videos about Rails
  • You are going to write a new article about Rails

How it works

What Is Under the Hood?

What I'm going to add...

All trademarks, logos and brand names are the property of their respective owners.

Installation and Running

Copy & Paste in your terminal

❤️ Linux / MacOS

git clone https://github.com/the-teacher/rails7-startkit.git && \
  cd rails7-startkit && \
  ruby bin/setup

💙 Windows

git clone https://github.com/the-teacher/rails7-startkit.git & cd rails7-startkit & ruby bin/setup

You will see something like that:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rails 7. StartKit
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
What was done:
1. Pull all required Images

2. Launching ElasticSearch Container
3. Launching Mailcatcher Container
4. Launching PgSQL Container
5. Launching Redis Container
6. Launching Rails Container

7. Correcting Permissions for Linux
8. Installing Gems
9. Turn off some ElasticSearch settings
10. Prepare Database (Create, Migrate, Create Seeds)
11. Indexing Article Model

12. Quality: Rubocop
13. Quality: RSpec with SimpleConv
14. Quality: Breakman

15. Yarn: Install Node Packages
16. Yarn: Build JS/CSS Assets
17. Precompile Assets

18. Launching Sidekiq
19. Launching Rails App with Puma

20. Visit Rails App: http://localhost:3000
21. Visit Mail Service: http://localhost:1080
22. Visit ElasticSearch: http://localhost:9200
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Welcome to RAILS 7!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

bin/ commands

❤️ ⚠️ bin/exec - Linux and MacOS users can skip using ruby

💙 ⚠️ ruby bin/exec - Windows users should use ruby explicitly

From the root of the project

bin/open command

bin/exec command

Prerequisites

On your host you have:

  • Any version of Ruby
  • Any version of Git
  • Any version of Docker

Conventions and Agreements

For demonstration, education and maintainance purposes I use a bit unsusual approach to name some files.

I _UNDERSCORE and UPPERCASE some files and folders to move them on the top of a folder and to make them more visible and to highlight their importance.

Data

  • All services' data related folders are placed in ./db
  • All folders are UPPERCASED
./db
├── ELASTIC
├── PGSQL
└── REDIS

Configuration Files

  • All services' configurations are placed in ./config
  • All configs are _UNDERSCORED and UPPERCASED
./config
├── _CONFIG.yml
├── _PUMA.rb
└── _SIDEKIQ.yml

Initialazers

  • All services' initializers are placed in ./config/initializers
  • All files are _UNDERSCORED and UPPERCASED
./config/initializers/
├── _CHEWY.rb
├── _CONFIG.rb
├── _REDIS.rb
└── _SIDEKIQ.rb

Rails user

As a user to own files and run Rails inside a container I use

user:group => lucky:lucky => 7777:7777

If you would like to run the project on a linux environment then:

  • create group lucky (7777) and user lucky (7777)
  • run the project with RUN_AS=7777:7777 option

Questions and Answers

TODO

  • Nginx
  • Production roll up
  • Action Cable Link

Sponsorship

These amazing companies and teams support the project:

License

MIT License. 2023. Ilya N. Zykin