Skip to content

How to use Docker Toolbox with Refuge Restrooms

DeeDeeG edited this page Sep 30, 2018 · 1 revision

Contributing (Docker Toolbox edition)

Setting Up Development Environment

1 Fork and clone the repository.

https://help.github.com/articles/fork-a-repo/

2 Install Docker Toolbox.

https://docs.docker.com/toolbox/overview/#ready-to-get-started

3 Run the Docker Quickstart Terminal

look for the "Docker Quickstart Terminal" program on your computer, and run it.

4 Build the Docker Container

Build the container from the Docker Quickstart Terminal with:

docker-compose build

5 Run the Docker Container

You can now run the app with:

docker-compose up

The container will be reachable at this address: 192.168.99.100:3000

(Point your web browser at 192.168.99.100:3000, from the same computer, or from any computer on the same LAN. The last method is useful for testing the app/site on smart phones and tablets.)

6 Do some Development

Files are shared between your computer and the Docker machine. If you update a file on your computer, the change should show up on the Docker machine, and vice-versa.

If you need to run commands on the Docker container directly, run this:

docker-compose run web bash

(This will give you a full interactive terminal session running on the Docker machine. You can (for example) run bundle update to update the Gems in the Gemfile to more recent versions.)

Occasionally, you might need to rebuild the Docker machine so it picks up major updates (such as a new version of Ruby, or an updated Gemfile). To do so, run docker-compose down and docker-compose build.

7 Run the Tests

docker-compose run -e "RAILS_ENV=test" web rake db:test:prepare spec

(If you want to know if your changes pass our automated testing, before even submitting your changes to RefugeRestrooms on Github, this will let you know.)

8 Shut down the Docker Container:

In another Docker Quickstart Terminal window, run:

docker-compose down

(Shutting down the container in this way is safer than exiting with Ctrl + C or Cmd + C, and prevents issues with breaking the db container.)

Optional tasks:

To clean up encoding problems in the safe2pee data, run (Use rake db:fix_accents[dry_run] to preview the changes.):

docker-compose run rake db:fixaccents

Assets

Testing

Please cover any new code with specs. We prefer code to be covered using RSpec or Capybara.

Now What?

Checkout our Wiki and specifically the newcomers guide.

Please also read our Code of Conduct, which gives guidance on our standards of community and interaction.

Clone this wiki locally