Skip to content

About

Personal CRM app

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contact tracker

A basic Rails application to keep track of contact with friends and family, and suggest catching up with people who are at risk of falling out of touch.

Version

This is pre-alpha, and does not require versioning.

Notes on the development environment

This repository acts as a base for developing Rails applications using Docker. It uses docker-compose to set up and run a Postgres database in a separate container, running alongside the Rails application container. The production environment will require further setup before it can start functioning.

Contents

The current versions of various dependencies are:

The Dockerfile, docker-compose, and Rails application files are all in the repo root. A Rails app has already been generated and is present in the repository, to save time on the manual setup steps detailed at the end of this README.

Usage

There are two methods of bringing up a development instance of the Docker setup.

Method with VSCode dev container integration

A .devcontainer folder has been added, with settings that appear to work for bringing up a dev environment. To use this, open the root folder in VSCode, ensuring that various necessary extensions are installed. They need further tweaking so that we don't need to get a CLI and manually run rake db:setup, then bundle exec rails s -p 3000 -b '0.0.0.0' to get a server at localhost:3000.

Method without VSCode dev container integration

  • First ensure that Docker is installed on your system, along with docker-compose
  • Run docker-compose build to set up the Rails and Postgres Docker instances
  • Run docker-compose up to start a development instance
  • Your shell should show the usual Rails and Postgres command line outputs and should not give you a command line
  • Create the test and dev databases from another shell window with docker-compose run web rake db:setup
  • Navigate to localhost:3000 and you should see a Yay! You're on Rails welcome screen

After creating a scaffold for the first time, it may be necessary to:

  1. Set default: extract_css: true, development: dev_server: hmr: true in webpacker.yml
  2. Run docker-compose run --rm web bundle exec rake webpacker:install to get webpack working

By uncommenting some lines in the docker-compose.yml, you can also enable an Adminer instance to examine your databases.

Pending tasks

Pending development tasks are tracked using the GitHub project and issue trackers.

How the setup was created

Useful for recreating or updating:

  • To start, use the following files from this repo
    .dockerignore
    .gitignore
    docker-compose.yml
    Dockerfile
    entrypoint.sh
  • Create a ./Gemfile with just the following lines
    source 'https://rubygems.org'
    gem 'rails', '~>6.1.0'
  • Use touch Gemfile.lock to create an empty lockfile, needed for the Docker build to work correctly
  • Create the rails app with docker-compose run --no-deps web rails new . --force --database=postgresql --skip-test
  • Use sudo chown -R $USER:$USER . to fix user ownership of the created files
  • Set up database connection in ./config/database.yml
      default: &default
        adapter: postgresql
        encoding: unicode
        host: db
        username: postgres
        password: password
        pool: 5
  • Add the following code to ./Gemfile to install RSpec-Rails. You can do this either with docker-compose run --no-deps bundle add rspec-rails --version "~> 4.0.2" --group "development, test" which also runs bundle install, or with the manual addition below
    # Run against the latest stable release
    group :development, :test do
      gem 'rspec-rails', '~> 4.0.2'
    end
  • Then use docker-compose build to install RSpec-Rails, followed by docker-compose run --no-deps web rails generate rspec:install to set up RSpec test generation
  • Use sudo chown -R $USER:$USER . again to fix ownership of the remaining created files
  • Finally, run docker-compose up to run the two Docker instances, and in another shell run docker-compose run web rake db:setup to set up the test and development databases in the PostgreSQL instance, run migrations, and seed content

This was based on https://docs.docker.com/compose/rails/ but required several changes to get working on the current Ruby and Rails versions, as NodeJS / NPM / Yarn did not install correctly.

About

Personal CRM app

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages