Skip to content

Getting started via Docker

Alex Cummaudo edited this page Dec 23, 2016 · 2 revisions

Contents

1. Install Docker

Download and install Docker, Docker Machine and Docker Compose for your platform:

macOS

For macOS with Homebrew and Homebrew Cask installed, run:

$ brew cask install virtualbox
$ brew install docker docker-machine docker-compose

For macOS without Homebrew installed, you can download the Docker toolbox instead.

Linux

Install following the instructions for Docker, Docker Machine, and Docker Compose

Windows

Download and install Docker toolkit and run through the getting started guide

2. Create the virtual machine

docker-machine create --driver virtualbox doubtfire

Add the docker daemon to your .bashrc:

$ echo eval "$(docker-machine env doubtfire)" >> ~/.bashrc

or, if you're using Oh-My-Zsh, add to your .zshrc:

$ echo eval "$(docker-machine env doubtfire)" >> ~/.zshrc

3. Clone Repos

Clone the doubtfire API and web repos to the same directory:

$ git clone https://github.com/doubtfire-lms/doubtfire-web.git
$ git clone https://github.com/doubtfire-lms/doubtfire-api.git

Set up overcommit and install hooks:

$ sudo gem install overcommit
$ cd /path/to/doubtfire-api
$ overcommit --install
$ overcommit --sign
$ cd /path/to/doubtfire-web
$ overcommit --install
$ overcommit --sign

If gem fails, you should ensure Ruby is installed on your system:

  • macOS: ruby comes installed with macOS
  • Linux: try installing using apt-get install ruby-full
  • Windows: try RubyInstaller

4. Starting Doubtfire

Execute the docker start script under doubtfire-api:

$ cd /path/to/doubtfire-api
$ ./docker.sh start

The populate script will ask you if you would like extended population.

Note that the API and Web servers will take a moment to get up and running.

5. Stopping Doubtfire

To stop Doubtfire running, run the stop script under doubtfire-api:

$ cd /path/to/doubtfire-api
$ ./docker.sh stop

6. For future reference...

Attaching to the Doubtfire containers

Doubtfire Web

You should attach to the grunt watch server if working on the web app to view output, if in case you make a lint error. To do so, run:

$ cd /path/to/doubtfire-api
$ ./docker.sh attach web

Doubtfire API

You should attach to the rails app if working on the API to view debug output. To do so, run:

$ cd /path/to/doubtfire-api
$ ./docker.sh attach api

Executing rake or grunt tasks within the Docker container

Should you need to execute any commands from inside the Docker container, such as running rake tasks, or a rails migration, use docker-compose but execute from within doubtfire-api:

$ cd /path/to/doubtfire-api
$ docker-compose -p doubtfire run api <api command>
$ docker-compose -p doubtfire run web <web command>

Clone this wiki locally