From 4a8f6b65fff7157b6ab35b9247c367ac3cbf8566 Mon Sep 17 00:00:00 2001 From: Julian David Rath Date: Mon, 16 Mar 2020 12:48:38 +0100 Subject: [PATCH 1/6] user and password env variables --- config/mongoid.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/config/mongoid.yml b/config/mongoid.yml index bbc629bc..e04d39ee 100644 --- a/config/mongoid.yml +++ b/config/mongoid.yml @@ -2,8 +2,10 @@ development: sessions: default: database: crucible_development - hosts: - - <%= ENV['MONGODB_HOST'] || "localhost:27017" %> + uri: <%= ENV['MONGODB_URI'] || "localhost:27017" %> + options: + user: <%= ENV['MONGODB_USER'] || nil %> + password: <%= ENV['MONGODB_PASSWORD'] || nil %> test: sessions: default: @@ -16,9 +18,16 @@ test: # low amounts for fast failures. max_retries: 1 retry_interval: 0 + user: <%= ENV['MONGODB_USER'] || nil %> + password: <%= ENV['MONGODB_PASSWORD'] || nil" %> + production: sessions: default: database: crucible_production hosts: - <%= ENV['MONGODB_HOST'] || "localhost:27017" %> + + options: + user: <%= ENV['MONGODB_USER'] || nil %> + password: <%= ENV['MONGODB_PASSWORD'] || nil %> From 6d0f991b0d2e6024fb000c14fe690dc8684f8e18 Mon Sep 17 00:00:00 2001 From: Julian David Rath Date: Mon, 16 Mar 2020 15:22:47 +0100 Subject: [PATCH 2/6] optional is the configuration of user and password --- config/mongoid.yml | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/config/mongoid.yml b/config/mongoid.yml index e04d39ee..03b0a518 100644 --- a/config/mongoid.yml +++ b/config/mongoid.yml @@ -2,10 +2,17 @@ development: sessions: default: database: crucible_development - uri: <%= ENV['MONGODB_URI'] || "localhost:27017" %> + hosts: + - <%= ENV['MONGODB_HOST'] || "localhost:27017" %> + options: - user: <%= ENV['MONGODB_USER'] || nil %> - password: <%= ENV['MONGODB_PASSWORD'] || nil %> +<% if ENV['MONGODB_USER'] != nil %> + user: <%= ENV['MONGODB_USER'] %> +<% end %> +<% if ENV['MONGODB_PASSWORD'] != nil %> + user: <%= ENV['MONGODB_PASSWORD'] %> +<% end %> + test: sessions: default: @@ -18,8 +25,12 @@ test: # low amounts for fast failures. max_retries: 1 retry_interval: 0 - user: <%= ENV['MONGODB_USER'] || nil %> - password: <%= ENV['MONGODB_PASSWORD'] || nil" %> +<% if ENV['MONGODB_USER'] != nil %> + user: <%= ENV['MONGODB_USER'] %> +<% end %> +<% if ENV['MONGODB_PASSWORD'] != nil %> + user: <%= ENV['MONGODB_PASSWORD'] %> +<% end %> production: sessions: @@ -29,5 +40,9 @@ production: - <%= ENV['MONGODB_HOST'] || "localhost:27017" %> options: - user: <%= ENV['MONGODB_USER'] || nil %> - password: <%= ENV['MONGODB_PASSWORD'] || nil %> +<% if ENV['MONGODB_USER'] != nil %> + user: <%= ENV['MONGODB_USER'] %> +<% end %> +<% if ENV['MONGODB_PASSWORD'] != nil %> + user: <%= ENV['MONGODB_PASSWORD'] %> +<% end %> From 68d860da804886d5749c4555b3eb5ec6a4eb84b4 Mon Sep 17 00:00:00 2001 From: Julian David Rath Date: Mon, 16 Mar 2020 15:43:59 +0100 Subject: [PATCH 3/6] copy/paste error --- config/mongoid.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/mongoid.yml b/config/mongoid.yml index 03b0a518..eee6184e 100644 --- a/config/mongoid.yml +++ b/config/mongoid.yml @@ -10,7 +10,7 @@ development: user: <%= ENV['MONGODB_USER'] %> <% end %> <% if ENV['MONGODB_PASSWORD'] != nil %> - user: <%= ENV['MONGODB_PASSWORD'] %> + password: <%= ENV['MONGODB_PASSWORD'] %> <% end %> test: @@ -29,7 +29,7 @@ test: user: <%= ENV['MONGODB_USER'] %> <% end %> <% if ENV['MONGODB_PASSWORD'] != nil %> - user: <%= ENV['MONGODB_PASSWORD'] %> + password: <%= ENV['MONGODB_PASSWORD'] %> <% end %> production: @@ -44,5 +44,5 @@ production: user: <%= ENV['MONGODB_USER'] %> <% end %> <% if ENV['MONGODB_PASSWORD'] != nil %> - user: <%= ENV['MONGODB_PASSWORD'] %> + password: <%= ENV['MONGODB_PASSWORD'] %> <% end %> From e58e391e4fd1706367c7c6dc29d3917f74ee8b51 Mon Sep 17 00:00:00 2001 From: Julian David Rath Date: Mon, 16 Mar 2020 16:25:53 +0100 Subject: [PATCH 4/6] fixed yml format --- config/mongoid.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/config/mongoid.yml b/config/mongoid.yml index eee6184e..3b85e0d3 100644 --- a/config/mongoid.yml +++ b/config/mongoid.yml @@ -5,12 +5,12 @@ development: hosts: - <%= ENV['MONGODB_HOST'] || "localhost:27017" %> - options: + <% if ENV['MONGODB_USER'] != nil %> - user: <%= ENV['MONGODB_USER'] %> + user: <%= ENV['MONGODB_USER'] %> <% end %> <% if ENV['MONGODB_PASSWORD'] != nil %> - password: <%= ENV['MONGODB_PASSWORD'] %> + password: <%= ENV['MONGODB_PASSWORD'] %> <% end %> test: @@ -26,10 +26,10 @@ test: max_retries: 1 retry_interval: 0 <% if ENV['MONGODB_USER'] != nil %> - user: <%= ENV['MONGODB_USER'] %> + user: <%= ENV['MONGODB_USER'] %> <% end %> <% if ENV['MONGODB_PASSWORD'] != nil %> - password: <%= ENV['MONGODB_PASSWORD'] %> + password: <%= ENV['MONGODB_PASSWORD'] %> <% end %> production: @@ -39,10 +39,9 @@ production: hosts: - <%= ENV['MONGODB_HOST'] || "localhost:27017" %> - options: <% if ENV['MONGODB_USER'] != nil %> - user: <%= ENV['MONGODB_USER'] %> + user: <%= ENV['MONGODB_USER'] %> <% end %> <% if ENV['MONGODB_PASSWORD'] != nil %> - password: <%= ENV['MONGODB_PASSWORD'] %> + password: <%= ENV['MONGODB_PASSWORD'] %> <% end %> From 7bd4b52c4e814c41d6d0d061c4d1d60946ba9726 Mon Sep 17 00:00:00 2001 From: Julian David Rath Date: Tue, 17 Mar 2020 09:00:12 +0100 Subject: [PATCH 5/6] made script configurable --- bin/docker-start-tasks.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; From 62f7731b6abb1b89ecada7681fb76fe6d280304d Mon Sep 17 00:00:00 2001 From: Julian David Rath Date: Tue, 17 Mar 2020 09:20:22 +0100 Subject: [PATCH 6/6] Documentation for Docker Env variables --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) 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