Bringing up a New Rails 7 App from a Git Clone
Last Updated On: 2025-09-01 04:31:52 -0400
Bringing up a New Rails 7 App from a Git Clone
Given that Rails applications tend towards the monolith, for a lot of us out there, we don’t start new Rails apps often or easily. This means that the “bringing up” process for a new application is rarely simple or easy. There always seems to be something that goes wrong or we forget the steps.
In this blog post, I’m going to illustrate the process for bringing up a robust application, from scratch, based on a git clone, step by step.
Step 01: Git Clone
Find the Rails app you want to clone from github or gitlab and then do this:
cd INSERT_YOUR_DEVELOPMENT_DIRECTORY_HERE
git clone INSERT_THE_GIT_LOCATION_HERE
Step 02: Make Sure You Have the Right Ruby / Install a Ruby
The ruby version for your project is usually located in one of two places:
- The hidden file .ruby-version in the root directory of your project
- A ruby directive in the Gemfile like ruby “3.1.2”
Please note that if you have both approaches – and some projects will – then it can cause major issues. Personally I prefer the Gemfile approach but ymmv.
Note 1: If you are using chruby then you are likely to have both.
Note 2: One of the reasons that I prefer the Gemfile approach is that my Cartazzi product uses it to better parse your Rails app.
Install a Ruby version matching what you discovered above. The best approach is a Ruby version manager like ChRuby or RVM or RbEnv.
Sidebar: Don’t Do this With &
Yes you could easily do the following:
Bundle install && npm install && yarn install && bundle exec rake db:create && bundle exec rake db:migrate && ...
The reason that you don’t want to do this all at once – as tempting as it is – is that modern stacks are fragile and things can go wrong at any point. It is far, far easier to do this a step at a time and know where the failure occurs than try and figure it out after the fact.
Step 03: Bundle Install
At this point you should be able to run a bundle install and get all the Gems installed:
bundle install
Step 04: Run a npm install
An NPM install is needed for any JavaScript stuff. And even if you don’t think there is JavaScript stuff, you still do it.
npm install
Step 05: Run a yarn install –check-files
I’m not honestly fully sure what yarn does (the whole front end ecosystem is a bit of a mystery to me) but I do this so often:
yarn install --check-files
Step 06: Check database.yml
If the application didn’t contain a database.yml file then you need to create one appropriately. Or modify the existing one for your local system.
Step 07: Create the Database
The database itself likely won’t exist so it needs to be created:
bundle exec rake db:create
Step 08: Run the Migrations
The migrations will need to be run.
bundle exec rake db:migrate
Step 09: Build the Javascript
When you try and run the tests, you may see this error:
Error:
Users::RegistrationsControllerTest::BasicRegistrationTest#test_successfully_registration_form_render:
ActionView::Template::Error: The asset "application.js" is not present in the asset pipeline.
app/views/layouts/application.html.erb:15
lib/jumpstart/lib/jumpstart/account_middleware.rb:30:in `call'
test/controllers/users/registrations_controller_test.rb:21:in `block in <class:BasicRegistrationTest>'
The solution is to initially build the JavaScript as the asset compilation has likely never been done:
rails javascript:build
Step 10: Build the CSS
When you try and run the tests, you may see this error:
Error:
Users::RegistrationsControllerTest::BasicRegistrationTest#test_failed_user_registration:
DRb::DRbRemoteError: The asset "application.css" is not present in the asset pipeline.
(ActionView::Template::Error)
app/views/layouts/application.html.erb:16
lib/jumpstart/lib/jumpstart/account_middleware.rb:30:in `call'
test/controllers/users/registrations_controller_test.rb:37:in `block (2 levels) in <class:BasicRegistrationTest>'
test/controllers/users/registrations_controller_test.rb:36:in `block in <class:BasicRegistrationTest>'
The solution is to initially build the CSS as the asset compilation has likely never been done:
rails css:build
Step 11: Figuring out if the System is Ready for Development: Console, Run the Tests, Run the Server
At this point we should be ready to use the application or move into development. There are three approaches that I recommend to determine if everything is correct:
- Run Rails Console
- Run the tests
- Run the Server
Run Rails Console
Historically Rails Console was how I determined if a Rails application was ready. The advent of javascript:build and css:build, however, mean that Rails Console isn’t fully a test of readiness. Still, Rails Console is a good test:
Bundle exec rails c
Run the Tests
At this point you should be able to run the tests:
bin/rails test
-or-
bundle exec rspec
Run the Server or Foreman
You can run the rails app in two ways – just the server or the whole stack (including the JavaScript and CSS bits):
Just the server:
bin/rails s
The whole stack:
foreman start -f Procfile.dev
Note: If foreman tosses an error then you likely need to run the setup process:
bin/setup
❯ bin/setup
== Installing dependencies ==
Resolving dependencies.....
The Gemfile's dependencies are satisfied
Successfully installed foreman-0.87.2
Parsing documentation for foreman-0.87.2
Done installing documentation for foreman after 0 seconds
1 gem installed
yarn install v1.22.5
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
info esbuild-android-64@0.14.43: The platform "darwin" is incompatible with this module.
info "esbuild-android-64@0.14.43" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-android-arm64@0.14.43: The platform "darwin" is incompatible with this module.
info "esbuild-android-arm64@0.14.43" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-android-arm64@0.14.43: The CPU architecture "x64" is incompatible with this module.
info esbuild-darwin-arm64@0.14.43: The CPU architecture "x64" is incompatible with this module.
info "esbuild-darwin-arm64@0.14.43" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-freebsd-64@0.14.43: The platform "darwin" is incompatible with this module.
info "esbuild-freebsd-64@0.14.43" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-freebsd-arm64@0.14.43: The platform "darwin" is incompatible with this module.
info "esbuild-freebsd-arm64@0.14.43" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-freebsd-arm64@0.14.43: The CPU architecture "x64" is incompatible with this module.
info esbuild-linux-32@0.14.43: The platform "darwin" is incompatible with this module.
info "esbuild-linux-32@0.14.43" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-linux-32@0.14.43: The CPU architecture "x64" is incompatible with this module.
info esbuild-linux-64@0.14.43: The platform "darwin" is incompatible with this module.
info "esbuild-linux-64@0.14.43" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-linux-arm@0.14.43: The platform "darwin" is incompatible with this module.
info "esbuild-linux-arm@0.14.43" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-linux-arm@0.14.43: The CPU architecture "x64" is incompatible with this module.
info esbuild-linux-arm64@0.14.43: The platform "darwin" is incompatible with this module.
info "esbuild-linux-arm64@0.14.43" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-linux-arm64@0.14.43: The CPU architecture "x64" is incompatible with this module.
info esbuild-linux-mips64le@0.14.43: The platform "darwin" is incompatible with this module.
info "esbuild-linux-mips64le@0.14.43" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-linux-mips64le@0.14.43: The CPU architecture "x64" is incompatible with this module.
info esbuild-linux-ppc64le@0.14.43: The platform "darwin" is incompatible with this module.
info "esbuild-linux-ppc64le@0.14.43" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-linux-ppc64le@0.14.43: The CPU architecture "x64" is incompatible with this module.
info esbuild-linux-riscv64@0.14.43: The platform "darwin" is incompatible with this module.
info "esbuild-linux-riscv64@0.14.43" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-linux-riscv64@0.14.43: The CPU architecture "x64" is incompatible with this module.
info esbuild-linux-s390x@0.14.43: The platform "darwin" is incompatible with this module.
info "esbuild-linux-s390x@0.14.43" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-linux-s390x@0.14.43: The CPU architecture "x64" is incompatible with this module.
info esbuild-netbsd-64@0.14.43: The platform "darwin" is incompatible with this module.
info "esbuild-netbsd-64@0.14.43" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-openbsd-64@0.14.43: The platform "darwin" is incompatible with this module.
info "esbuild-openbsd-64@0.14.43" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-sunos-64@0.14.43: The platform "darwin" is incompatible with this module.
info "esbuild-sunos-64@0.14.43" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-windows-32@0.14.43: The platform "darwin" is incompatible with this module.
info "esbuild-windows-32@0.14.43" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-windows-32@0.14.43: The CPU architecture "x64" is incompatible with this module.
info esbuild-windows-64@0.14.43: The platform "darwin" is incompatible with this module.
info "esbuild-windows-64@0.14.43" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-windows-arm64@0.14.43: The platform "darwin" is incompatible with this module.
info "esbuild-windows-arm64@0.14.43" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-windows-arm64@0.14.43: The CPU architecture "x64" is incompatible with this module.
[3/4] 🔗 Linking dependencies...
[4/4] 🔨 Building fresh packages...
✨ Done in 0.85s.
== Compiling CSS & JS ==
yarn run v1.22.5
$ node esbuild.config.js
✨ Done in 0.36s.
yarn run v1.22.5
$ tailwindcss --postcss -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css
Done in 597ms.
✨ Done in 1.76s.
== Preparing database ==
Created database 'jobhound3_development'
# PostgreSQL. Versions 9.1 and up are supported.
#
# Install the pg driver:
# gem install pg
# On OS X with Homebrew:
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
# On OS X with MacPorts:
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
# On Windows:
# gem install pg
# Choose the win32 build.
# Install PostgreSQL and put its /bin directory on your path.
#
# Configure Using Gemfile
# gem 'pg'
Created database 'jobhound3_test'
== Removing old logs and tempfiles ==
== Restarting application server ==