![Rails 7. Start kit. v2.1](https://private-user-images.githubusercontent.com/496713/268578958-e90eaf2a-ed8a-4e37-9fdd-a4edb6174de1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ0NDU5NDcsIm5iZiI6MTcyNDQ0NTY0NywicGF0aCI6Ii80OTY3MTMvMjY4NTc4OTU4LWU5MGVhZjJhLWVkOGEtNGUzNy05ZmRkLWE0ZWRiNjE3NGRlMS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODIzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyM1QyMDQwNDdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04ZjRjODk2YzFjNDRlMGIxYTJkZDM0MGFhYmIwZDM1ZjlkYmNlZjIwNDE0NzEzYzAxYjI0MmU4Mzk1M2E4NGNkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.9jTE5zrchrrHxYU6GgKuGpNv_2MJIBK0iMsN0FdLhVw)
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
Rails App in a Docker container with some popular preinstalled tools.
Save hours, days or weeks on setting up a typical Rails app.
- 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
Logotype | Description | Why it was added |
---|---|---|
![]() |
Docker | Helps to keep all required services in containers. To have fast and predictable installation process in minutes. Docker Images are here. |
![]() |
Ruby 3.2 | Most recent version of Ruby |
![]() |
Rails 7 | Most recent version of Rails |
![]() |
PostgresSQL | Most popular relational database |
![]() |
Redis | In-memory data store. For caching and as a dependency of Sidekiq |
![]() |
Sidekiq | Job Scheduler and Async Tasks Executor. Can be used as a stand alone tool or as ActiveJob backend |
![]() |
whenever | Linux Cron based periodical tasks |
![]() |
Elasticsearch | The world’s leading Search engine |
![]() |
Chewy | Ruby Connector to Elasticsearch |
![]() |
Bootstrap | Old but Gold Framework for Web |
![]() |
ES Build | An extremely fast bundler for the web |
![]() |
Import Maps | Rails' recommended way to process JavaScript |
![]() |
Sprockets | Rack-based asset packager |
![]() |
gem "dotenv" | ENV variables management tool |
![]() |
gem "config" | Configuration management tool |
![]() |
Nginx | Web Server. Reverse Proxy. Load Balancer. Caching, Streaming etc. |
![]() |
Puma | Application Web Server. To launch Rails app |
![]() |
Devise | Authentication solution for Rails + Emails confirmations |
![]() |
ActiveStorage | Default Cloud Storage Solution for Rails |
![]() |
Faker | Fake data for development and testing |
![]() |
Kaminari | Pagination solution |
![]() |
Sanitize | Sanitization of a dangerous users' input |
![]() |
mailcatcher | Email previewer for development |
![]() |
RSpec | Testing Framework for Rails |
![]() |
Rubocop | Ruby static code analyzer (a.k.a. linter) and formatter. |
![]() |
Breakman | Static analysis tool | Security Vulnerabilities. |
![]() |
SimpleCov | Code coverage for Ruby (and Rails) |
What I'm going to add...
Logotype | Description | Why it was added |
---|---|---|
![]() |
Devise | Login with Facebook and Google |
All trademarks, logos and brand names are the property of their respective owners.
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/exec
- Linux and MacOS users can skip using ruby
💙 ruby bin/exec
- Windows users should use ruby
explicitly
From the root of the project
Command | Description |
---|---|
Most important | |
ruby bin/setup | Download images, run containers, initialize data, launch all processes. |
ruby bin/open | Get in Rails Container |
rubyc bin/exec [CMD] | Execute a command ([CMD]) from Rails7StartKit module |
Command | Description |
---|---|
Get in a container | |
ruby bin/open [NAME] |
Get in a Container. [NAME]
[NAME] Values: rails ,psql , redis , elastic , mailcatcher .
Default value is: rails .
|
All Possible Module Methods
- breakman
- cache
- check_docker!
- check_docker_compose_v2!
- check_docker_running!
- chewy_index
- chewy_reset
- container_bash_exec
- container_exec
- containers_information
- cron_start
- cron_stop
- docker_compose
- init_nvm
- log_puma
- log_server
- log_sidekiq
- print_methods
- prompt!
- puma_dev_start
- puma_restart
- puma_start
- puma_stop
- rails7_header
- rails7_ready
- rails7_startkit_greetings!
- rails_assets_precompile
- rails_db_migrate
- rails_db_prepare
- rails_install_gems
- reset
- restart
- restart_all
- rspec
- rspec_with_cov
- rubocop
- rubocop_fix
- setup!
- sidekiq_start
- sidekiq_stop
- start
- start_all
- start_all_containers
- status
- stop
- stop_all
- stop_all_containers
- system!
- turn_off_elastic_settings
- whenever_show
- whenever_start
- whenever_stop
- yarn_build
- yarn_install
Command | Description |
---|---|
ruby bin/exec [CMD] | Execute a command ([CMD]) from Rails7StartKit module |
ruby bin/exec start | Start processes in rails container |
ruby bin/exec stop | Stop processes in rails container |
ruby bin/exec restart | bin/exec stop + bin/exec start |
ruby bin/exec start_all | Start processes and containers |
ruby bin/exec stop_all | Stop processes and containers |
ruby bin/exec restart_all | bin/exec stop_all + bin/exec start_all |
ruby bin/exec status | To see running containers and launched services |
ruby bin/exec cache | Toggle caching in development and restart web server |
ruby bin/exec index | Run Search engines indexation |
ruby bin/exec reset | Reset data of services in ./db folder |
On your host you have:
- Any version of Ruby
- Any version of Git
- Any version of Docker
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
andUPPERCASED
./config
├── _CONFIG.yml
├── _PUMA.rb
└── _SIDEKIQ.yml
Initialazers
- All services' initializers are placed in
./config/initializers
- All files are
_UNDERSCORED
andUPPERCASED
./config/initializers/
├── _CHEWY.rb
├── _CONFIG.rb
├── _REDIS.rb
└── _SIDEKIQ.rb
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 userlucky (7777)
- run the project with
RUN_AS=7777:7777
option
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.
Show details
- Nginx
- Production roll up
- Action Cable Link
These amazing companies and teams support the project:
JetBrains.com | Hoodies.team |
---|---|
![]() |