Skip to content

Commit

Permalink
Merge branch 'release/2.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
flibbertigibbet committed Apr 26, 2018
2 parents 561de85 + 02c9ac3 commit 0084f6c
Show file tree
Hide file tree
Showing 27 changed files with 237 additions and 203 deletions.
7 changes: 5 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.require_version ">= 1.5"
Vagrant.require_version ">= 2.0"
require "yaml"

CAC_SHARED_FOLDER_TYPE = ENV.fetch("CAC_SHARED_FOLDER_TYPE", "nfs")
Expand Down Expand Up @@ -57,7 +57,7 @@ def install_dependent_roles
ansible_roles_spec = File.join(ansible_directory, "roles.yml")

YAML.load_file(ansible_roles_spec).each do |role|
role_name = role["src"]
role_name = role["name"] ? role["name"] : role["src"]
role_version = role["version"]
role_path = File.join(ansible_directory, "roles", role_name)
galaxy_metadata = galaxy_install_info(role_name)
Expand Down Expand Up @@ -111,6 +111,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
database.ssh.forward_x11 = true

database.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "deployment/ansible/database.yml"
ansible.inventory_path = ANSIBLE_INVENTORY_PATH
ansible.raw_arguments = ["--timeout=60"]
Expand Down Expand Up @@ -148,6 +149,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
app.ssh.forward_x11 = true

app.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "deployment/ansible/app.yml"
ansible.inventory_path = ANSIBLE_INVENTORY_PATH
ansible.raw_arguments = ["--timeout=60"]
Expand Down Expand Up @@ -177,6 +179,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
otp.ssh.forward_x11 = true

otp.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "deployment/ansible/otp.yml"
ansible.inventory_path = ANSIBLE_INVENTORY_PATH
ansible.raw_arguments = ["--timeout=60"]
Expand Down
9 changes: 6 additions & 3 deletions deployment/ansible/group_vars/all
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
---
java_version: "8u*"
java_major_version: "8"

app_username: "vagrant"

packer_version: "0.7.5"
packer_version: "1.0.2"

nodejs_version: 6.11.4
nodejs_version: 8.10.0

virtualenv_version: 15.1.0

otp_router: "default"

# used by nginx and gunicorn to set timeouts; OTP defaults to 30s
otp_session_timeout_s: 30
otp_session_timeout_s: 90

s3_otp_data: cleanair-otp-data

Expand Down
12 changes: 3 additions & 9 deletions deployment/ansible/roles.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
- src: azavea.git
version: 0.1.0

- src: azavea.java
version: 0.2.6

- src: azavea.opentripplanner
version: 1.0.8
version: 1.1.0

- src: azavea.nginx
version: 0.2.2
version: 0.3.1

- src: azavea.nodejs
version: 0.4.0
Expand All @@ -17,7 +11,7 @@
version: 0.2.0

- src: azavea.papertrail
version: 1.1.1
version: 1.2.0

- src: azavea.pip
version: 1.0.0
Expand Down
13 changes: 7 additions & 6 deletions deployment/ansible/roles/cac-tripplanner.app/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ root_media_dir: "/media/cac"
cac_python_dependencies:
- { name: 'base58', version: '0.2.5' }
- { name: 'boto', version: '2.48.0' }
- { name: 'django', version: '1.11.7' }
- { name: 'django', version: '1.11.12' }
- { name: 'django-ckeditor', version: '5.3.1' }
- { name: 'django-extensions', version: '1.9.7' }
- { name: 'django-extensions', version: '1.9.9' }
- { name: 'django-storages', version: '1.6.5' }
- { name: 'gunicorn', version: '19.7.1' }
- { name: 'pillow', version: '4.3.0' }
- { name: 'psycopg2', version: '2.7.3' }
- { name: 'pytz', version: '2017.3' }
- { name: 'Pillow', version: '5.1.0' }
- { name: 'psycopg2', version: '2.7.4' }
- { name: 'pytz', version: '2018.4' }
- { name: 'pyyaml', version: '3.12' }
- { name: 'troposphere', version: '0.7.2'}
- { name: 'troposphere', version: '1.8.1' }
- { name: 'majorkirby', version: '0.2.1' }
# Note: django-wpadmin is installed manually to work around the fact that ansible-pip
# ignores editable=False
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
- name: Install dev/test python packages
pip: name={{ item.name }} version={{ item.version }}
with_items:
- { name: 'flake8', version: '3.4.1' }
- { name: 'flake8', version: '3.5.0' }
13 changes: 2 additions & 11 deletions deployment/ansible/roles/cac-tripplanner.app/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@
- name: Install django-wpadmin manually to work around ansible bug
command: pip install --upgrade 'git+https://github.com/azavea/django-wpadmin@v1.11#egg=django-wpadmin'

# TODO: #914 replace major kirby
# TODO: peg this to a version, rather than a commit, when released
# ansible pip module installs this in /tmp/src for some reason, so we use the
# command instead
- name: Install majorkirby
command: pip install "git+https://github.com/azavea/majorkirby@7688e19e61bf9d218c03a2af6d469d0626b86918#egg=majorkirby"
creates=/usr/local/lib/python2.7/dist-packages/majorkirby/__init__.py
when: develop

- name: Touch log file and set permissions
file: path={{ app_log }} state=touch owner={{ app_username }} group={{ app_username }} mode=0664

Expand Down Expand Up @@ -81,6 +72,6 @@
template: src=nginx-default.j2 dest=/etc/nginx/sites-available/default
notify: Restart nginx

- { include: jslibs.yml }
- { import_tasks: jslibs.yml }

- { include: dev-test-dependencies.yml, when: develop or test }
- { import_tasks: dev-test-dependencies.yml, when: develop or test }
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
timeout: {{ otp_session_timeout_s }},
updaters: [
{
type: "bike-rental",
Expand Down
20 changes: 11 additions & 9 deletions deployment/cloudformation/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,15 +370,17 @@ def set_up_stack(self):
LoadBalancerNames=[Ref(app_server_load_balancer)],
MaxSize=Ref(self.param_max_size),
MinSize=Ref(self.param_min_size),
NotificationConfiguration=asg.NotificationConfiguration(
TopicARN=Ref(self.param_notification_arn),
NotificationTypes=[
asg.EC2_INSTANCE_LAUNCH,
asg.EC2_INSTANCE_LAUNCH_ERROR,
asg.EC2_INSTANCE_TERMINATE,
asg.EC2_INSTANCE_TERMINATE_ERROR
]
),
NotificationConfigurations=[
asg.NotificationConfigurations(
TopicARN=Ref(self.param_notification_arn),
NotificationTypes=[
asg.EC2_INSTANCE_LAUNCH,
asg.EC2_INSTANCE_LAUNCH_ERROR,
asg.EC2_INSTANCE_TERMINATE,
asg.EC2_INSTANCE_TERMINATE_ERROR
]
)
],
VPCZoneIdentifier=Ref(self.param_private_subnets),
Tags=[
asg.Tag('Name', '{}Server'.format(self.STACK_NAME_PREFIX), True),
Expand Down
5 changes: 4 additions & 1 deletion deployment/packer/cac.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@
"mkdir -p {{user `ansible_staging_directory`}}",
"mkdir -p {{user `intermediate_directory`}}",
"sudo apt-get -y install build-essential python-dev python-pip git",
"sudo pip install --upgrade pip",
"sudo pip install paramiko==1.16.0",
"sudo pip install ansible==2.1.0.0"
"sudo pip install ansible==2.4.2.0"
]
},
{
Expand All @@ -105,6 +106,7 @@
"playbook_file": "{{user `local_project_directory`}}/deployment/ansible/app.yml",
"inventory_file": "{{user `local_project_directory`}}/deployment/ansible/hosts/hosts.app",
"group_vars": "{{user `local_project_directory`}}/deployment/ansible/group_vars/",
"staging_directory": "{{user `ansible_staging_directory`}}",
"extra_arguments": [
"--user 'ubuntu'"
],
Expand All @@ -115,6 +117,7 @@
"playbook_file": "{{user `local_project_directory`}}/deployment/ansible/otp.yml",
"inventory_file": "{{user `local_project_directory`}}/deployment/ansible/hosts/hosts.otp",
"group_vars": "{{user `local_project_directory`}}/deployment/ansible/group_vars/",
"staging_directory": "{{user `ansible_staging_directory`}}",
"extra_arguments": [
"--user 'ubuntu'"
],
Expand Down
2 changes: 1 addition & 1 deletion deployment/packer/cac_packer.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def run_packer(machine_type, region, creds):
env = os.environ.copy()
env['AWS_ACCESS_KEY_ID'] = creds['aws_access_key_id']
env['AWS_SECRET_ACCESS_KEY'] = creds['aws_secret_access_key']
env['AWS_SECURITY_TOKEN'] = creds['aws_security_token']
env['AWS_SESSION_TOKEN'] = creds['aws_security_token']

packer_template_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'cac.json')
packer_command = ['packer', 'build',
Expand Down
2 changes: 1 addition & 1 deletion python/cac_tripplanner/destinations/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def isochrone(self, payload):
try:
# get a feature collection
json_poly = json.loads(isochrone_response.content)
except:
except: # noqa: E722
# No isochrone found. Is GTFS loaded? Is origin within the graph bounds?
json_poly = json.loads("{}")
return json_poly
Expand Down
15 changes: 10 additions & 5 deletions python/cac_tripplanner/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,27 @@
<meta property="og:title" content="GoPhillyGo" />
<meta name="twitter:title" content="GoPhillyGo" />
<meta name="apple-mobile-web-app-title" content="GoPhillyGo">
<meta property="og:type" content="place" />
<meta property="og:rich_attachment" content="true" />
{% endblock %}

{% block extrametatags %}
<meta property="fb:app_id" content="{{ fb_app_id }}" />
<meta property="fb:pages" content="299797223477237" />
<meta property="fb:profile_id" content="gophillygo" />
<meta property="og:url"
content="{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}" />
content="{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}/" />
<meta property="og:description"
content="GoPhillyGo from the Clean Air Council, for planning transit, walking, and biking trips around the Delaware Valley region. Features parks and other destinations." />
<meta property="og:image" content="{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}/static/images/logo_blue.png" />
<meta property="og:image:width" content="332" />
<meta property="og:image:height" content="314" />
<meta property="og:site_name" content="GoPhillyGo" />
<meta property="og:locale" content="en_US" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@go_philly_go" />
<meta name="twitter:description" content="Helping you get around greater Philly" />
<meta name="twitter:image" content="{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}/static/images/logo_blue.png" />
<meta property="og:image:width" content="360" />
<meta property="og:image:height" content="360" />
<meta property="og:image" content="{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}/static/images/logo@2x.png" />
<meta name="twitter:image" content="{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}/static/images/logo@2x.png" />
{% endblock %}

{% include "partials/ios-weblinks.html" %}
Expand Down Expand Up @@ -109,6 +113,7 @@
<script src="{% static 'scripts/vendor/Polyline.encoded.js' %}"></script>
<script src="{% static 'scripts/vendor/typeahead.bundle.js' %}"></script>
<script src="{% static 'scripts/vendor/turf-helpers.js' %}"></script>
<script src="{% static 'scripts/vendor/turf-distance.js' %}"></script>
<script src="{% static 'scripts/vendor/turf-point-on-line.js' %}"></script>
<script src="{% static 'scripts/vendor/moment.js' %}"></script>
<script src="{% static 'scripts/vendor/moment-duration-format.js' %}"></script>
Expand Down
18 changes: 11 additions & 7 deletions python/cac_tripplanner/templates/event-detail.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

{% extends "base.html" %}
{% load staticfiles %}

Expand All @@ -7,22 +6,27 @@

<meta property="og:title" content="{{ event.name }}" />
<meta name="twitter:title" content="{{ event.name }}" />
<meta name="apple-mobile-web-app-title" content="{{ event.name }}">
<meta property="og:type" content="place" />
<meta property="og:rich_attachment" content="true" />
{% endblock %}

{% block extrametatags %}
<meta property="fb:app_id" content="{{ fb_app_id }}" />
<meta property="fb:pages" content="299797223477237" />
<meta property="fb:profile_id" content="gophillygo" />
<meta property="og:url"
content="{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}" />
<meta property="og:description" content="{{ event.description|striptags }}" />
<meta property="og:image" content="{{ event.image.url }}" />
<meta property="og:image:width" content="400" />
<meta property="og:image:height" content="400" />
content="{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}/" />
<meta property="og:site_name" content="GoPhillyGo" />
<meta property="og:locale" content="en_US" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@go_philly_go" />
<meta property="og:description" content="{{ event.description|striptags }}" />
<meta name="twitter:description" content="{{ event.description|striptags }}" />
<meta name="twitter:image" content="{{ event.image.url }}" />
<meta property="og:image" content="{{ event.wide_image.url }}" />
<meta name="twitter:image" content="{{ event.wide_image.url }}" />
<meta property="og:image:width" content="680" />
<meta property="og:image:height" content="400" />
{% endblock %}

{% block content %}
Expand Down
15 changes: 10 additions & 5 deletions python/cac_tripplanner/templates/learn-detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,27 @@

<meta property="og:title" content="GoPhillyGo | {{ article.title|striptags }}" />
<meta name="twitter:title" content="GoPhillyGo | {{ article.title|striptags }}" />
<meta name="apple-mobile-web-app-title" content="GoPhillyGo | {{ article.title|striptags }}">
<meta property="og:type" content="article" />
<meta property="og:rich_attachment" content="true" />
{% endblock %}

{% block extrametatags %}
<meta property="fb:app_id" content="{{ fb_app_id }}" />
<meta property="fb:pages" content="299797223477237" />
<meta property="fb:profile_id" content="gophillygo" />
<meta property="og:url"
content="{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}" />
<meta property="og:description" content="{{ article.teaser|striptags }}" />
<meta property="og:image" content="{{ article.image.url }}" />
<meta property="og:image:width" content="400" />
<meta property="og:image:height" content="400" />
<meta property="og:site_name" content="GoPhillyGo" />
<meta property="og:locale" content="en_US" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@go_philly_go" />
<meta property="og:description" content="{{ article.teaser|striptags }}" />
<meta name="twitter:description" content="{{ article.teaser|striptags }}" />
<meta name="twitter:image" content="{{ article.image.url }}" />
<meta property="og:image" content="{{ event.wide_image.url }}" />
<meta name="twitter:image" content="{{ event.wide_image.url }}" />
<meta property="og:image:width" content="680" />
<meta property="og:image:height" content="200" />
{% endblock %}

{% block content %}
Expand Down
18 changes: 11 additions & 7 deletions python/cac_tripplanner/templates/place-detail.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

{% extends "base.html" %}
{% load staticfiles %}

Expand All @@ -7,22 +6,27 @@

<meta property="og:title" content="{{ destination.name }}" />
<meta name="twitter:title" content="{{ destination.name }}" />
<meta name="apple-mobile-web-app-title" content="{{ destination.name }}">
<meta property="og:type" content="place" />
<meta property="og:rich_attachment" content="true" />
{% endblock %}

{% block extrametatags %}
<meta property="fb:app_id" content="{{ fb_app_id }}" />
<meta property="fb:pages" content="299797223477237" />
<meta property="fb:profile_id" content="gophillygo" />
<meta property="og:url"
content="{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}" />
<meta property="og:description" content="{{ destination.description|striptags }}" />
<meta property="og:image" content="{{ destination.image.url }}" />
<meta property="og:image:width" content="400" />
<meta property="og:image:height" content="400" />
content="{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}/" />
<meta property="og:site_name" content="GoPhillyGo" />
<meta property="og:locale" content="en_US" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@go_philly_go" />
<meta name="twitter:description" content="{{ destination.description|striptags }}" />
<meta name="twitter:image" content="{{ destination.image.url }}" />
<meta property="og:description" content="{{ destination.description|striptags }}" />
<meta property="og:image" content="{{ destination.wide_image.url }}" />
<meta name="twitter:image" content="{{ destination.wide_image.url }}" />
<meta property="og:image:width" content="680" />
<meta property="og:image:height" content="400" />
{% endblock %}

{% block content %}
Expand Down
5 changes: 4 additions & 1 deletion python/cac_tripplanner/templates/service-worker.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Service Worker to support functioning as a PWA
// https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers

var CACHE_NAME = 'cac_tripplanner_v7';
var CACHE_NAME = 'cac_tripplanner_v9';

var cacheFiles = {{ cache_files | safe }};

Expand All @@ -16,6 +16,9 @@ self.addEventListener('install', function(event) {
});

self.addEventListener('fetch', function(event) {
if (event.request.cache === 'only-if-cache') {
event.request.mode = 'same-origin';
}
return fetch(event.request); // do not use cache
});

Expand Down
Loading

0 comments on commit 0084f6c

Please sign in to comment.