diff --git a/README.md b/README.md index 3bbc049d..b93dcf45 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,16 @@ A simple Rails app for evaluating FHIR. - Start the server: `docker-compose up` - Navigate to `http://localhost:3000` + +#### Docker ENV Variables + +To configure the image in docker the following env variables can be used: + +- `MONGODB_HOST` : Host +- `MONGODB_USER` : User +- `MONGODB_PASSWORD` : Password +- `CRUCIBLE_SERVER` : Hostname of the Crucible server (for the task runner) + ### OSX Installation ### #### Dependencies diff --git a/bin/docker-start-tasks.sh b/bin/docker-start-tasks.sh index afc847e0..3502e4cb 100755 --- a/bin/docker-start-tasks.sh +++ b/bin/docker-start-tasks.sh @@ -1,6 +1,8 @@ #!/bin/bash -while ! nc -w 10 -z web $1; +SERVER=${CRUCIBLE_SERVER:-web} + +while ! nc -w 10 -z $SERVER $1; do echo Task runner waiting for crucible web app to load on port $1; sleep 10; diff --git a/config/mongoid.yml b/config/mongoid.yml index bbc629bc..3b85e0d3 100644 --- a/config/mongoid.yml +++ b/config/mongoid.yml @@ -4,6 +4,15 @@ development: database: crucible_development hosts: - <%= ENV['MONGODB_HOST'] || "localhost:27017" %> + + +<% if ENV['MONGODB_USER'] != nil %> + user: <%= ENV['MONGODB_USER'] %> +<% end %> +<% if ENV['MONGODB_PASSWORD'] != nil %> + password: <%= ENV['MONGODB_PASSWORD'] %> +<% end %> + test: sessions: default: @@ -16,9 +25,23 @@ test: # low amounts for fast failures. max_retries: 1 retry_interval: 0 +<% if ENV['MONGODB_USER'] != nil %> + user: <%= ENV['MONGODB_USER'] %> +<% end %> +<% if ENV['MONGODB_PASSWORD'] != nil %> + password: <%= ENV['MONGODB_PASSWORD'] %> +<% end %> + production: sessions: default: database: crucible_production hosts: - <%= ENV['MONGODB_HOST'] || "localhost:27017" %> + +<% if ENV['MONGODB_USER'] != nil %> + user: <%= ENV['MONGODB_USER'] %> +<% end %> +<% if ENV['MONGODB_PASSWORD'] != nil %> + password: <%= ENV['MONGODB_PASSWORD'] %> +<% end %>