Skip to content

A docker-compose template of a Ruby on Rails application using Ruby 2.7.2 and Rails 6.x

Notifications You must be signed in to change notification settings

stemount/ruby-on-rails-docker-compose-template

Repository files navigation

→ Getting started with this project

This uses docker-compose for simplicity of getting together a Ruby on Rails 6 application with a PostgreSQL database.

Start containers

docker-compose up -d

Restart Ruby instance

docker-compose restart web

Destroy PostgreSQL databases if you mess up or similar reason

This nukes the PGDATA contents including databases, passwords et al.

Useful if you are testing migrations or are prototyping your database model.

rm -rf ./tmp/db/* && docker-compose up --force-recreate postgres

Stop containers

docker-compose stop

→ Start Developing

It is required to create the databases using Rails.

It is recommended to use migration files over any sort of hacks.

It is recommended to have seed data to test your models too.

  • How to interact with the Rails docker instance

    docker-compose exec web /bin/bash

    These commands will be essential

    • rails db:create
    • rails db:migrate
    • rails db:seed

Technical Info

Rails version: 6.1

Ruby version: ruby 2.7.2

Base Linux distro: Debian Buster

Default settings

PostgreSQL User: root PostgreSQL Password: password

About

A docker-compose template of a Ruby on Rails application using Ruby 2.7.2 and Rails 6.x

Topics

Resources

Security policy

Stars

Watchers

Forks

Sponsor this project