Skip to content
Ruby HTML JavaScript CSS Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Office Moms and Dads Scheduler

Maintainability Test Coverage Join the chat at

Development Environment Setup

  1. Download Docker CE for Mac

Note: remove boot2docker or other Docker implementations if any were previously installed

  1. Copy the env.example file to .env cp env.example .env

    Note: There exists a .env file in 1Password intended for development. Note: On Mac, make sure to append :docker-compose.mac.yml to COMPOSE_FILE to take advantage of cached volumes

  2. Run docker-compose up

  3. Open a browser to localhost:3000 verify the app is up.

Helpful Docker Commands

  • docker-compose up Starts fresh containers -d starts it in daemon mode
  • docker-compose down Stops and removes containers(all data too)
  • docker-compose stop Stops running containers but persists data
  • docker-compose start Starts containers with persisted data
  • docker system prune Cleans up unused containers, networks, and images -a removes all

Note: it is recommended to run the clean up commands weekly

  • docker ps Lists all running containers
  • docker-compose run app bash Starts a bash session on app, bringing up only dependent services.
  • docker exec -it ID_FROM_DOCKER_PS bash. Connects another bash session to a running container.
  • docker attach ID_FROM_DOCKER_PS Attach is useful for pry debugging in a running container

Note: To detach use ctrl-p + ctrl-q

Rails Commands in a Docker World

Now that the app is running in Docker we will run all Rails and Rake commands in the container.

Here are a few examples:

Note: this is expecting the containers are up

  • docker-compose exec app bundle exec rake db:migrate
  • docker-compose exec app bundle exec rails c

The pattern is docker-compose exec (container_name) rails or rake command. This pattern works for non-Rails commands also.

  • docker-compose exec app bash will open the terminal on the container

System Tests

System tests open the browser and make assertions against the content of the page or verify expected behavior. These tests can be run in headless mode (the default), which means that they are executed in a virtual browser. If you would like them to be run in an actual, viewable browser, you will need to disable headless mode by setting the HEADLESS environment variable to 'false' and ensure you have the ChromeDriver WebDriver downloaded and installed on your host machine.

E.g. HEADLESS=false bundle exec rspec spec/system/mytest_spec.rb

If you are running in non-headless mode, you'll need to be sure you have the ChromeDriver running and able to accept connections from the IP the server is running on. This can be done by running ChromeDriver in a separate tab/console via:

./chromedriver --whitelisted-ips

You can’t perform that action at this time.