Creating a Rails App
Learn about Rails app setup, developer workflow, and key considerations for security and production configuration.
We'll cover the following
The following command is pretty powerful. It immediately creates a ready-to-go Rails application but doesn’t completely set us up for sustainable development.
rails new
We know a few things about our app right now:
-
Other developers will work on it and need to be able to set it up, run its tests, and run it locally.
-
It will eventually have security vulnerabilities (in our code and in our dependencies).
-
It will be deployed into production via a continuous integration pipeline and require operational observability.
Given the assumptions we listed in the first chapter, we are also quite confident that the app will get more complex over time, and more and more developers will work on it.
Before we start writing code, we will take a few minutes to consider how developers will set up a Rails app and work with it and how we’ll manage it in production. In other words, we need to consider developer workflow, which starts with setup and ends with maintaining the app in production. The developer workflow figure below shows this workflow and the parts of it that we’ll create in this chapter.
The diagram shows:
-
bin/setup
: This will set up our app after we’ve pulled it down from version control. -
bin/run
: This will be used to run our app locally, with thedotenv
gem providing runtime configuration for development and testing. -
bin/ci
: This will run all of our quality checks, suitable for running in CI, which will include both tests and security analysis via Brakeman and bundle audit. -
In production, we’ll get all runtime configurations from the Unix environment and use the
lograge
gem to configure more production-friendly log output.
Create a free account to view this lesson.
By signing up, you agree to Educative's Terms of Service and Privacy Policy