Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/beta' into pull_request_issues
Browse files Browse the repository at this point in the history
  • Loading branch information
gshugh committed Mar 28, 2019
2 parents e2ef7a8 + 5f41aa2 commit 08309dc
Show file tree
Hide file tree
Showing 8 changed files with 178 additions and 155 deletions.
3 changes: 2 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ AllCops:
- 'lib/**/*'
- 'public/**/*'
- 'vendor/**/*'
- 'Dangerfile'
Rails:
Enabled: true

Expand Down Expand Up @@ -99,4 +100,4 @@ Style/Documentation:

# Style preference
Style/MethodDefParentheses:
Enabled: false
Enabled: false
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ rvm:
branches:
only:
- master
- beta
before_install:
- uname -a
- lsb_release -a
Expand Down
236 changes: 118 additions & 118 deletions Dangerfile

Large diffs are not rendered by default.

13 changes: 2 additions & 11 deletions app/controllers/response_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ def delete
# Prepare the parameters when student clicks "Edit"
def edit
assign_instance_vars
get_all_responses
@prev = Response.where(map_id: @map.id)
@review_scores = @prev.to_a
if @prev.present?
@sorted = @review_scores.sort {|m1, m2| m1.version_num.to_i && m2.version_num.to_i ? m2.version_num.to_i <=> m1.version_num.to_i : (m1.version_num ? -1 : 1) }
@largest_version_num = @sorted[0]
Expand Down Expand Up @@ -142,7 +143,6 @@ def create
map_id = params[:id]
map_id = params[:map_id] unless params[:map_id].nil? # pass map_id as a hidden field in the review form
@map = ResponseMap.find(map_id)
get_all_responses
if params[:review][:questionnaire_id]
@questionnaire = Questionnaire.find(params[:review][:questionnaire_id])
@round = params[:review][:round]
Expand Down Expand Up @@ -370,13 +370,4 @@ def init_answers(questions)
Answer.create(response_id: @response.id, question_id: q.id, answer: nil, comments: '') if a.nil?
end
end

def get_all_responses
# get all previous versions of responses for the response map.
# I guess if we're in the middle of creating a new response, this would be
# all 'previous' responses to this new one (which is not yet saved)?
@prev = Response.where(map_id: @map.id)
# not sure what this is about
@review_scores = @prev.to_a
end
end
41 changes: 41 additions & 0 deletions devops/docker/docker-compose.yml.blue_green_deployment
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: '3'

services:
expertiza_blue:
image: expertiza:blue
ports:
- '3000:3000'
depends_on:
- scrubbed_db
- redis
links:
- scrubbed_db
- redis
command: bundle exec thin start -p 3000
environment:
REDIS_HOST: redis

expertiza_green:
image: expertiza:green
ports:
- '3001:3001'
depends_on:
- scrubbed_db
- redis
links:
- scrubbed_db
- redis
command: bundle exec thin start -p 3001
environment:
REDIS_HOST: redis

scrubbed_db:
image: mysql:5.7
volumes:
# https://stackoverflow.com/questions/25920029/setting-up-mysql-and-importing-dump-within-dockerfile
- './docker/scrubbed_db:/docker-entrypoint-initdb.d'
environment:
MYSQL_ROOT_PASSWORD: expertiza

redis:
image: redis:alpine
27 changes: 8 additions & 19 deletions devops/docker/docker-compose.yml.example
Original file line number Diff line number Diff line change
@@ -1,41 +1,30 @@
version: '3'

services:
expertiza_blue:
image: expertiza:blue
expertiza:
image: winbobob/expertiza:ruby-2.2.7
ports:
- '3000:3000'
volumes:
- '.:/root/expertiza'
depends_on:
- scrubbed_db
- redis
links:
- scrubbed_db
- redis
working_dir: /root/expertiza
command: bundle exec thin start -p 3000
environment:
REDIS_HOST: redis

expertiza_green:
image: expertiza:green
ports:
- '3001:3001'
depends_on:
- scrubbed_db
- redis
links:
- scrubbed_db
- redis
command: bundle exec thin start -p 3001
environment:
REDIS_HOST: redis

scrubbed_db:
image: mysql:5.7
volumes:
# https://stackoverflow.com/questions/25920029/setting-up-mysql-and-importing-dump-within-dockerfile
- './docker/scrubbed_db:/docker-entrypoint-initdb.d'
- './devops/docker/scrubbed_db:/docker-entrypoint-initdb.d'
environment:
MYSQL_ROOT_PASSWORD: expertiza
MYSQL_ROOT_PASSWORD: [YOUR PASSWORD]

redis:
image: redis:alpine
image: redis:alpine
6 changes: 3 additions & 3 deletions devops/docker/setup_linux.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/bash

cd ..
cd ../..

DIR=`pwd`

# Setup the environment
bash setup.sh

# Go back to docker folder
cd $DIR/docker/scrubbed_db
cd $DIR/devops/docker/scrubbed_db

# Checking the scrubbed_db

Expand All @@ -29,7 +29,7 @@ tar -xzf expertiza_scrubbed_db.sql.tar.gz
cd $DIR

# Get the docker-compose file
cp ./docker/docker-compose.yml.example docker-compose.yml
cp ./devops/docker/docker-compose.yml.example docker-compose.yml

# Get the MYSQL_ROOT_PASSWORD
read -p "Please enter your MYSQL ROOT PASSWORD: " MYSQL_ROOT_PASSWORD
Expand Down
6 changes: 3 additions & 3 deletions devops/docker/setup_mac.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/bash

cd ..
cd ../..

DIR=`pwd`

# Setup the environment
bash setup.sh

# Go back to docker folder
cd $DIR/docker/scrubbed_db
cd $DIR/devops/docker/scrubbed_db

# Checking the scrubbed_db

Expand All @@ -28,7 +28,7 @@ tar -xzf expertiza_scrubbed_db.sql.tar.gz
cd $DIR

# Get the docker-compose file
cp ./docker/docker-compose.yml.example docker-compose.yml
cp ./devops/docker/docker-compose.yml.example docker-compose.yml

# Get the MYSQL_ROOT_PASSWORD
read -p "Please enter your MYSQL ROOT PASSWORD: " MYSQL_ROOT_PASSWORD
Expand Down

0 comments on commit 08309dc

Please sign in to comment.