Builds | Security | Quality |
---|---|---|
Repository was created using ruby-3.1.0
and rails-7.0.3
via:
rails new groupthink --database=postgresql --asset-pipeline=propshaft
--javascript=importmap --skip-action-mailer
--skip-action-cable --skip-active-storage
--skip-active-job
For production, the included Dockerfile
should be sufficient. The entry point
is a shell script that verifies the dependencies, runs rails db:prepare
and
some other minor checks and setup and then executes puma. Set the
appropriate environment variables, including RAILS_ENV=production
, database
configuration and a SECRET_KEY_BASE
that would otherwise be in master.key
.
See .env-example
.
For development, the included docker-compose.yml
will run the application and
a postgres container alongside. The application files will be shared with the
container, and the entry point will be rails server
. You will need
to set POSTGRES_PASSWORD
in .env
for initial setup of the database
container. See .env-example
.
The file db/seeds.rb
contains data essential for a brand new database to
function properly (that the app assumes is always there, essentially). Seed data
will always load for production. For development, the data modeled within
tests/fixtures/
can be loaded into the development database by running:
$ rails db:fixtures:load
This is the data I use for development, and it is designed with both development and testing in mind.
In lieu of CLI flags, Rails uses RAILS_ENV
to determine the current
environment. For development you can usually leave this alone as it defaults to
"development," but if you want production you need to set RAILS_ENV
.
Rails uses a postgresql database, specified via environment variables:
DATABASE_HOST
DATABASE_PORT
DATABASE_USER
DATABASE_PASSWORD
Set these or use a .env
file. See .env-example
.
For initial database setup:
$ rails db:prepare
This will create the database if it doesn't exist, and running migrations if it does.
There exists a comprehensive test suite including controller, integration, model, and system tests.
$ rails test
$ rails test:system
System tests utilizes capybara and selenium. You will need chromedriver and Google Chrome installed. The system tests will not run in the docker image.
So long, and thanks for all the fish.