Project

Ruby on Rails application initialized with Hix on Rails.

System dependencies

  • Ruby 3.0.1
  • Ruby on Rails 6.1.3.1
  • Node.js 14.16.1
  • MySQL 8.0
  • Redis 6.2

Development dependencies

Configuration

Copy an existing sample environment file. Run:

cp .env.sample .env

And set the PROJECT_ROOT variable to the pwd of your Rails project root. Then, spin up the project container running the following:

docker-compose up --build

When it finishes, you can run commands (including bundle exec rails commands) in your container. For example, running the rails console is as simple as:

docker exec -it project_app bin/rails c

And resetting the database:

docker exec -it project_app bin/rails db:drop db:create db:structure:load:with_data db:seed

Docker services in development

After running docker-compose up the following services are exposed:

  • Ruby on Rails application at http://localhost:3001
  • MySQL database at mysql://project_app:password@localhost:3307. Use mysql --user project_app --password password --host=localhost --port 3307 --database project_development
  • Redis at redis://localhost:6380/0. Use redis-cli -h localhost -p 6380 -n 0
  • Mailcatcher UI at http://localhost:1081
  • Mailcatcher SMTP at [http://localhost:1026][dev-mailcatcher-smpt]
  • Webpack dev server at http://localhost:3036

All of the above ports and other settings are configurable via .env file. If you change them, remember to run:

docker-compose up --build --force-recreate

And do update this part of README.md.

How to run the test suite

In order to run the whole test suite, run:

docker exec -it project_app bundle exec rspec

Code quality checks

The application provides the following code quality analysis tools:

To run them locally:

docker exec -it project_app bundle exec brakeman
docker exec -it project_app bundle exec fasterer
docker exec -it project_app bundle exec rubocop
docker exec -it project_app bundle exec rails_best_practices
docker exec -it project_app bundle audit