Giter Site home page Giter Site logo

valarpirai / rails7-startkit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from the-teacher/rails7-startkit

1.0 1.0 0.0 12.23 MB

Rails7 StartKit. Launch App in minutes!

License: MIT License

Shell 4.73% JavaScript 3.00% Ruby 62.45% CSS 2.76% HTML 21.53% Dockerfile 5.46% SCSS 0.07%

rails7-startkit's Introduction

Rails 7. Start Kit

docker

Install and Run Ruby on Rails now!

Copy & Paste in your terminal

git clone https://github.com/the-teacher/rails7-startkit.git && \
  cd rails7-startkit && \
  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

Rails 7. Start Kit

What Is Under the Hood?

Logotype Description Why it was added
Main
docker Docker Helps to keep all required services in containers. To have fast and predictable installation process in minutes. Docker Images are here.
ruby Ruby 3.2 Most recent version of Ruby
rails7 Rails 7 Most recent version of Rails
pgsql PostgresSQL Most popular relational database
Cache and Delayed Jobs
redis Redis In-memory data store. For caching and as a dependency of Sidekiq
sidekiq Sidekiq Job Scheduler and Async Tasks Executor. Can be used as a stand alone tool or as ActiveJob backend
whenever whenever Linux Cron based periodical tasks
Full text search
elastic Elasticsearch The world’s leading Search engine
chewy Chewy Ruby Connector to Elasticsearch
Front-end
bootstrap Bootstrap Old but Gold Framework for Web
import-maps ES Build An extremely fast bundler for the web
import-maps Import Maps Rails' recommended way to process JavaScript
Application Configuration
gem dotenv-rails gem "dotenv" ENV variables management tool
gem config gem "config" Configuration management tool
Application Level
faker Faker Fake data for development and testing
sanitize Sanitize Sanitization of a dangerous users' input
kaminari Kaminari Pagination solution
letter_opener mailcatcher Email previewer for development
devise Devise Authentication solution for Rails + Emails confirmations
ActiveStorage ActiveStorage Default Cloud Storage Solution for Rails
puma Puma Application Web Server. To launch Rails app
Code Quality
rspec Rubocop Ruby static code analyzer (a.k.a. linter) and formatter.
rspec RSpec Testing Framework for Rails
rspec SimpleCov Code coverage for Ruby (and Rails)

What I'm going to add...

Logotype Description Why it was added
devise Devise Login with Facebook and Google

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

Installation and Running

Copy & Paste in your terminal

git clone https://github.com/the-teacher/rails7-startkit.git && \
  cd rails7-startkit && \
  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. Installing Gems
8. Create DB. Migrate DB. Create Seeds
9. Indexing Article Model
10. Launching Rails App with Puma
11. Launching Sidekiq
12. Rubocop is Checking
13. RSpec is Checking
14. Visit Rails App: http://localhost:3000
15. Visit Mail Service: http://localhost:1080
16. Visit ElasticSearch: http://localhost:9200
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Welcome to RAILS 7!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

bin/ commands

From the root of the project

Command Description
Most important
bin/setup Download images, run containers, initialize data, launch all processes.
bin/open Get in Rails Container
bin/exec [COMMAND] Execute a command from Rails7StartKit module

bin/open command

Command Description
Get in a container
bin/open [NAME] Get in a Container. [NAME] can be rails, psql, redis, elastic, mailcatcher. Default value is rails.

bin/exec command

Command Description
bin/exec
bin/exec [COMMAND] Execute a command from Rails7StartKit module
Start/Stop/Restart
bin/exec start Start processes in rails container
bin/exec stop Stop processes in rails container
bin/exec restart bin/exec stop + bin/exec start
bin/exec start_all Start processes and containers
bin/exec stop_all Stop processes and containers
bin/exec restart_all bin/exec stop_all + bin/exec start_all
Helpers
bin/exec status To see running containers and launched services
bin/exec cache Toggle caching in development and restart web server
bin/exec index Run Search engines indexation
bin/exec reset Reset data of services in ./db folder

Prerequisites

On your host you have:

  • Ruby 2+
  • Docker
  • Git

Conventions and Agreements

Show details

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

Show Details

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

What is an idea of this project?

For many years Rails gives you freedom to choose development tools. Different databases, different paginators, different search engines, different delayed job solutions.

It is great. But all the time you need to choose something and install it from scratch.

I think I did my choice about many solutions and tools.

I want to install my minimal pack of tools now and reuse my StartKit every time when I start a new project.

With Docker I can roll out my minimal application with all required preinstalled tools in minutes, not in hours or in days.

Why did you create this project?

I didn't work with Rails last 4 or 5 years. I wanted to learn new approaches and techniques. I found that there is still no a simple way to setup a blank app with most popular tools.

So. Why not to make my own playground?

How do you choose technologies for the StartKit?

I use tools that I like or want to learn.

I use tools that I think are the most popular ones.

It looks good for development. What about production?

I'm not a DevOps, but I have a vision how to deploy this code to production.

Right now it is not described somehow. It is in my plans.

TODO

Show details
  • Nginx
  • Production roll up
  • Action Cable Link

Sponsorship

These amazing companies and teams support the project:

JetBrains.com Hoodies.team

License

MIT License. 2023. Ilya N. Zykin

rails7-startkit's People

Contributors

the-teacher avatar nicke avatar ggalancs avatar wiiikiii avatar

Stargazers

Roman avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.