Skip to content

Commit 3adf783

Browse files
authored
Merge pull request #112 from broadinstitute/development
Adding support for external MongoDB hosts, security updates
2 parents 2f00ddb + ac7d14d commit 3adf783

File tree

7 files changed

+17
-12
lines changed

7 files changed

+17
-12
lines changed

Gemfile.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ GEM
117117
execjs
118118
coffee-script-source (1.12.2)
119119
concurrent-ruby (1.0.5)
120-
crass (1.0.3)
120+
crass (1.0.4)
121121
daemons (1.2.6)
122122
debase (0.2.1)
123123
debase-ruby_core_source
@@ -194,7 +194,7 @@ GEM
194194
logging (2.2.2)
195195
little-plugger (~> 1.1)
196196
multi_json (~> 1.10)
197-
loofah (2.1.1)
197+
loofah (2.2.2)
198198
crass (~> 1.0.2)
199199
nokogiri (>= 1.5.9)
200200
mail (2.7.0)
@@ -241,7 +241,7 @@ GEM
241241
netrc (0.11.0)
242242
nmatrix (0.2.4)
243243
packable (~> 1.3, >= 1.3.5)
244-
nokogiri (1.8.1)
244+
nokogiri (1.8.2)
245245
mini_portile2 (~> 2.3.0)
246246
non-stupid-digest-assets (1.0.9)
247247
sprockets (>= 2.0)
@@ -296,8 +296,8 @@ GEM
296296
activesupport (>= 4.2.0, < 5.0)
297297
nokogiri (~> 1.6)
298298
rails-deprecated_sanitizer (>= 1.0.1)
299-
rails-html-sanitizer (1.0.3)
300-
loofah (~> 2.0)
299+
rails-html-sanitizer (1.0.4)
300+
loofah (~> 2.2, >= 2.2.2)
301301
railties (4.2.10)
302302
actionpack (= 4.2.10)
303303
activesupport (= 4.2.10)
@@ -429,4 +429,4 @@ DEPENDENCIES
429429
will_paginate_mongoid
430430

431431
BUNDLED WITH
432-
1.13.7
432+
1.16.1

app/controllers/site_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2036,7 +2036,7 @@ def load_available_workflows
20362036
all_workflows = []
20372037

20382038
# parellelize gets to speed up performance if there are a lot of workflows
2039-
Parallel.map(allowed_workflows, in_threads: 100) do |workflow_opts|
2039+
Parallel.map(allowed_workflows, in_threads: 3) do |workflow_opts|
20402040
namespace, name, snapshot = workflow_opts.split('/')
20412041
all_workflows << Study.firecloud_client.get_methods(namespace: namespace, name: name, snapshotId: snapshot)
20422042
end

app/views/layouts/application.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
77
<meta http-equiv="X-UA-Compatible" content="IE=edge">
88
<%= stylesheet_link_tag 'application', media: 'all' %>
9-
<script src="//cdn.plot.ly/plotly-1.33.1.min.js"></script>
9+
<script src="//cdn.plot.ly/plotly-1.37.1.min.js"></script>
1010
<%= javascript_include_tag 'application' %>
1111
<script src="//cdn.datatables.net/plug-ins/1.10.15/sorting/natural.js"></script>
1212

bin/boot_docker

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ $0 [OPTION]
1313
-n VALUE set the name of the docker container (defaults to 'single_cell')
1414
-e VALUE set the environment (defaults to 'development'. Running in 'production' will cause container to spawn headlessly)
1515
-d VALUE set the project directory to mount inside Docker container (defaults to current working directory: `pwd`)
16+
-D VALUE set the docker image version to use when booting the container (defaults to 'latest')
1617
-m VALUE set the MONGO_LOCALHOST variable, only used in development (defaults to 'mongodb')
1718
-r VALUE set the maximum allowable RAM to be allocated to portal (defaults to 12GB)
1819
-s VALUE set the SECRET_KEY_BASE variable, used for secure cookies (auto-generates by default)
@@ -43,7 +44,7 @@ GOOGLE_CLIENT_ID=$GOOGLE_CLIENT_ID
4344
GOOGLE_CLOUD_PROJECT=$GOOGLE_CLOUD_PROJECT
4445
DOCKER_IMAGE_VERSION='latest'
4546

46-
while getopts "n:e:d:m:r:s:k:p:h:u:P:H:o:S:" OPTION; do
47+
while getopts "n:e:d:D:m:r:s:k:p:h:u:P:H:o:S:" OPTION; do
4748
case $OPTION in
4849
n)
4950
CONTAINER_NAME="$OPTARG"
@@ -54,6 +55,9 @@ case $OPTION in
5455
d)
5556
PROJECT_DIR="$OPTARG"
5657
;;
58+
D)
59+
DOCKER_IMAGE_VERSION="$OPTARG"
60+
;;
5761
m)
5862
MONGO_LOCALHOST="$OPTARG"
5963
;;
@@ -98,7 +102,7 @@ done
98102
if [[ $PASSENGER_APP_ENV = "production" ]]
99103
then
100104
# generate random secret key for secure cookies
101-
docker run -d --name $CONTAINER_NAME -p 80:80 -p 443:443 --link mongodb:mongodb -h $PROD_HOSTNAME -v $PROJECT_DIR:/home/app/webapp:rw -v $PROJECT_DIR/data:/home/app/webapp/data:rw -m $MAX_RAM -e PASSENGER_APP_ENV=$PASSENGER_APP_ENV -e MONGO_LOCALHOST=$MONGO_LOCALHOST -e PROD_DATABASE_PASSWORD=$PROD_DATABASE_PASSWORD -e SERVICE_ACCOUNT_KEY=$SERVICE_ACCOUNT_KEY -e SECRET_KEY_BASE=$SECRET_KEY_BASE -e PROD_HOSTNAME=$PROD_HOSTNAME -e SENDGRID_USERNAME=$SENDGRID_USERNAME -e SENDGRID_PASSWORD=$SENDGRID_PASSWORD -e OAUTH_CLIENT_ID=$OAUTH_CLIENT_ID -e OAUTH_CLIENT_SECRET=$OAUTH_CLIENT_SECRET single_cell_docker:$DOCKER_IMAGE_VERSION
105+
docker run -d --name $CONTAINER_NAME -p 80:80 -p 443:443 -h $PROD_HOSTNAME -v $PROJECT_DIR:/home/app/webapp:rw -v $PROJECT_DIR/data:/home/app/webapp/data:rw -e PASSENGER_APP_ENV=$PASSENGER_APP_ENV -e MONGO_LOCALHOST=$MONGO_LOCALHOST -e PROD_DATABASE_PASSWORD=$PROD_DATABASE_PASSWORD -e SERVICE_ACCOUNT_KEY=$SERVICE_ACCOUNT_KEY -e SECRET_KEY_BASE=$SECRET_KEY_BASE -e PROD_HOSTNAME=$PROD_HOSTNAME -e SENDGRID_USERNAME=$SENDGRID_USERNAME -e SENDGRID_PASSWORD=$SENDGRID_PASSWORD -e OAUTH_CLIENT_ID=$OAUTH_CLIENT_ID -e OAUTH_CLIENT_SECRET=$OAUTH_CLIENT_SECRET single_cell_docker:$DOCKER_IMAGE_VERSION
102106
elif [[ $PASSENGER_APP_ENV = "staging" ]]
103107
then
104108
docker run -d --name $CONTAINER_NAME -p 80:80 -p 443:443 --link mongodb:mongodb -h $PROD_HOSTNAME -v $PROJECT_DIR:/home/app/webapp:rw -v $PROJECT_DIR/data:/home/app/webapp/data:rw -v $PROJECT_DIR/single-cell-staging.broadinstitute.org.crt:/etc/pki/tls/certs/localhost.crt -v $PROJECT_DIR/single-cell-staging.broadinstitute.org.key:/etc/pki/tls/private/localhost.key -m $MAX_RAM -e PASSENGER_APP_ENV=$PASSENGER_APP_ENV -e MONGO_LOCALHOST=$MONGO_LOCALHOST -e PROD_DATABASE_PASSWORD=$PROD_DATABASE_PASSWORD -e SERVICE_ACCOUNT_KEY=$SERVICE_ACCOUNT_KEY -e SECRET_KEY_BASE=$SECRET_KEY_BASE -e PROD_HOSTNAME=$PROD_HOSTNAME -e SENDGRID_USERNAME=$SENDGRID_USERNAME -e SENDGRID_PASSWORD=$SENDGRID_PASSWORD -e OAUTH_CLIENT_ID=$OAUTH_CLIENT_ID -e OAUTH_CLIENT_SECRET=$OAUTH_CLIENT_SECRET single_cell_docker:$DOCKER_IMAGE_VERSION

bin/weekly_disk_snapshot.bash

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ TODAY="$(date +%Y-%m-%d)"
77

88
# create the snapshots for portal and data disk
99
echo "$(gcloud compute disks snapshot singlecell-production-disk --snapshot-names portal-backup-${TODAY} --zone us-central1-a)"
10+
echo "$(gcloud compute disks snapshot singlecell-mongo-prod-snap-disk --snapshot-names portal-database-backup-${TODAY} --zone us-central1-a)"
1011

1112
#
1213
# DELETE OLD SNAPSHOTS (OLDER THAN 1 MONTH)

config/mongoid.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ production:
128128
default:
129129
database: single_cell_portal_production
130130
hosts:
131-
- mongodb:27017
131+
- <%= ENV['MONGO_LOCALHOST'] %>:27017
132132
options:
133133
user: 'single_cell'
134134
password: '<%= ENV['PROD_DATABASE_PASSWORD'] %>'

test/ui_test_suite.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2024,7 +2024,7 @@ def teardown
20242024

20252025
# check for reports
20262026
report_plots = @driver.find_elements(:class, 'plotly-report')
2027-
assert report_plots.size == 9, "did not find correct number of plots, expected 9 but found #{report_plots.size}"
2027+
assert report_plots.size == 11, "did not find correct number of plots, expected 9 but found #{report_plots.size}"
20282028
report_plots.each do |plot|
20292029
rendered = @driver.execute_script("return $('##{plot['id']}').data('rendered')")
20302030
assert rendered, "#{plot['id']} rendered status was not true"

0 commit comments

Comments
 (0)