Sanix-Darker / docker-composer-ror

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

→ 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


Languages

Language:Ruby 69.8%Language:HTML 18.8%Language:Dockerfile 4.5%Language:JavaScript 3.9%Language:CSS 2.4%Language:Shell 0.7%