Permalink
Browse files

Add documentation for getting set up to use Docker

Added a section to the README documenting how to get started using
Docker and set up a `bin/docker_setup` script to make this easier.
I've made modifications to the /config/database.yml.example so that it can simply be
copied over and it will work for either development set up.
  • Loading branch information...
keiththomps committed Oct 18, 2016
1 parent a9640d4 commit 57dd7000defeb77c2955d29b1660001367110d46
Showing with 43 additions and 2 deletions.
  1. +22 −1 README.md
  2. +17 −0 bin/docker_setup
  3. +3 −0 config/database.yml.example
  4. +1 −1 docker-compose.yml
View
@@ -62,6 +62,27 @@ In order to activate caching in development you can add `CACHE_DEVELOPMENT="anyt
[foreman]: http://ddollar.github.io/foreman/
[pow]: http://pow.cx
Getting Started with Docker
---------------------------
This repository comes equipped to be run within Docker, but this requires a few more local dependencies. For instructions on installing and getting started with Docker go [here](https://www.docker.com/products/docker). You'll also need [`docker-compose`](https://docs.docker.com/compose/overview/), but it will be installed for you through Docker for Mac or Windows.
This repository comes equipped with a self-setup script for using Docker:
% ./bin/docker_setup
On first boot you'll also need to create your database, for that use:
% docker-compose run --rm app rake db:create db:migrate
After setting up, you can run the application and dependencies using [docker-compose]:
% docker-compose up -d
If your Docker host is running on `localhost` then you should be able to use pow, otherwise you'll need to connect to it via:
http://DOCKER_IP:7000
Feature Flags
-------------
@@ -71,7 +92,7 @@ Single Tenant Mode: Initialize application in single tenant mode. Disabled by de
Usage:
To use the single tenant mode, you can add SINGLE_TENANT_MODE to your enviroment variables with the value `true`. On development you can set this in your .env with `SINGLE_TENANT_MODE=true` and restart foreman. On heroku it's under the `Config Variables`.
To use the single tenant mode, you can add SINGLE_TENANT_MODE to your enviroment variables with the value `true`. On development you can set this in your .env with `SINGLE_TENANT_MODE=true` and restart foreman. On heroku it's under the `Config Variables`.
The first user in single tenant mode can be created by a rake task `rake create_user`. We'll ask you for your credentials.
Guidelines
View
@@ -0,0 +1,17 @@
#!/usr/bin/env sh
# Exit if any subcommand fails
set -e
# Set up database.yml
if [ ! -f config/database.yml ]; then
cp config/database.yml.example config/database.yml
fi
# Set up configurable environment variables
if [ ! -f .env ]; then
cp .sample.env .env
echo "POSTGRES_HOST=db" >> .env
echo "POSTGRES_USER=hours" >> .env
echo "POSTGRES_PASSWORD=secure_password" >> .env
fi
@@ -1,5 +1,8 @@
development: &default
adapter: postgresql
host: <%= ENV["POSTGRES_HOST"].presence || "localhost" %>
username: <%= ENV["POSTGRES_USER"] %>
password: <%= ENV["POSTGRES_PASSWORD"] %>
database: hours_development
encoding: utf8
min_messages: warning
View
@@ -31,6 +31,6 @@ services:
volumes:
- .:/usr/src/app
ports:
- "8080:8080"
- "7000:8080"
depends_on:
- db

0 comments on commit 57dd700

Please sign in to comment.