-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
54 changed files
with
658 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
## Overview | ||
|
||
Brief description of what this PR does, and why it is needed. | ||
|
||
Connects #XXX | ||
|
||
### Demo | ||
|
||
Optional. Screenshots, `curl` examples, etc. | ||
|
||
### Notes | ||
|
||
Optional. Ancillary topics, caveats, alternative strategies that didn't work out, anything else. | ||
|
||
## Testing Instructions | ||
|
||
* How to test this PR | ||
* Prefer bulleted description | ||
* Start after checking out this branch | ||
* Include any setup required, such as bundling scripts, restarting services, etc. | ||
* Include test case, and expected output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
deployment/ansible/roles/model-my-watershed.rwd/tasks/app.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
- name: Create RWD data directory | ||
file: path="{{ rwd_data_path }}" | ||
state=directory | ||
|
||
- name: Pull RWD docker container image | ||
command: /usr/bin/docker pull {{ rwd_docker_image }} | ||
|
||
- name: Configure RWD service definition | ||
template: src=upstart-mmw-rwd.conf.j2 | ||
dest=/etc/init/mmw-rwd.conf | ||
notify: | ||
- Restart mmw-rwd | ||
|
||
- name: Ensure service is running | ||
service: name=mmw-rwd state=started |
10 changes: 10 additions & 0 deletions
10
deployment/ansible/roles/model-my-watershed.rwd/tasks/configuration.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
- name: Configure application | ||
copy: content="{{ item.value }}" | ||
dest="{{ envdir_home }}/{{ item.key }}" | ||
owner=root | ||
group=mmw | ||
mode=0750 | ||
with_dict: "{{ app_config }}" | ||
notify: | ||
- Restart Celery |
17 changes: 2 additions & 15 deletions
17
deployment/ansible/roles/model-my-watershed.rwd/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,3 @@ | ||
--- | ||
- name: Create RWD data directory | ||
file: path="{{ rwd_data_path }}" | ||
state=directory | ||
|
||
- name: Pull RWD docker container image | ||
command: /usr/bin/docker pull {{ rwd_docker_image }} | ||
|
||
- name: Configure RWD service definition | ||
template: src=upstart-mmw-rwd.conf.j2 | ||
dest=/etc/init/mmw-rwd.conf | ||
notify: | ||
- Restart mmw-rwd | ||
|
||
- name: Ensure service is running | ||
service: name=mmw-rwd state=started | ||
- { include: configuration.yml } | ||
- { include: app.yml } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,8 @@ | |
't2.micro', | ||
't2.small', | ||
't2.medium', | ||
't2.large' | ||
't2.large', | ||
'r4.large' | ||
] | ||
|
||
RDS_INSTANCE_TYPES = [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
# Ref: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-initialize.html | ||
|
||
function log() { | ||
echo "[$(date --rfc-3339=seconds)] $1" | ||
} | ||
|
||
log "Warming up RWD EBS volume..." | ||
|
||
find /opt/rwd-data/nhd/Main_Watershed/* -type f -print0 \ | ||
| xargs -0 -P0 -L1 -t cat >/dev/null | ||
|
||
find /opt/rwd-data/drb/Main_Watershed/* -type f -print0 \ | ||
| xargs -0 -P0 -L1 -t cat >/dev/null | ||
|
||
log "Done" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,6 @@ | ||
{% include 'head.html' %} | ||
{% load staticfiles %} | ||
|
||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
{% block metatitle %} | ||
<title>Model My Watershed</title> | ||
{% endblock metatitle %} | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link rel="icon" type="image/png" href="{% static 'favicon.png' %}" sizes="16x16"> | ||
<link rel="icon" type="image/png" href="{% static '[email protected]' %}" sizes="32x32"> | ||
<link rel="stylesheet" href="{% static 'css/vendor.css' %}" /> | ||
<link rel="stylesheet" href="{% static 'css/main.css' %}" /> | ||
<!-- Google Analytics --> | ||
<script> | ||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | ||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | ||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | ||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); | ||
|
||
ga('create', '{{ GOOGLE_ANALYTICS_ACCOUNT }}', 'auto'); | ||
ga('send', 'pageview'); | ||
window.ga = ga; | ||
</script> | ||
</head> | ||
|
||
<body> | ||
{% block header %} | ||
{% endblock header %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,18 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from django.conf import settings | ||
from django.core.urlresolvers import reverse | ||
from django.shortcuts import redirect | ||
|
||
from apps.user.views import itsi_login | ||
|
||
EMBED_FLAG = settings.ITSI['embed_flag'] | ||
LOGIN_URL = reverse(itsi_login) | ||
|
||
|
||
class ItsiAuthenticationMiddleware(object): | ||
""" | ||
Middleware for automatically logging in ITSI users | ||
and setting relevant flags. | ||
Middleware for setting relevant ITSI flags. | ||
""" | ||
|
||
def process_request(self, request): | ||
""" | ||
Check if ITSI EMBED FLAG is set, and if so attempt to log | ||
the user in with their ITSI credentials and redirect them | ||
to current page. | ||
""" | ||
|
||
# If flag is not set then return None so Django can proceed | ||
# with the request as-is | ||
if request.GET.get(EMBED_FLAG, 'false') != 'true': | ||
return None | ||
|
||
# Flag is set. Assume user is not logged in. Set session flag and | ||
# Redirect them to ITSI LOGIN URL, with the current URL to return to | ||
request.session[EMBED_FLAG] = True | ||
return redirect('{0}?next={1}'.format(LOGIN_URL, request.path)) | ||
# If flag is set then set a session variable so it can be passed to | ||
# front-end | ||
if request.GET.get(EMBED_FLAG, 'false') == 'true': | ||
request.session[EMBED_FLAG] = True |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.