Skip to content

Commit 3133361

Browse files
Merge branch 'release/2.7.0'
2 parents f90d533 + 3f87286 commit 3133361

File tree

60 files changed

+1802
-663
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1802
-663
lines changed

Vagrantfile

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,6 @@
44
Vagrant.require_version ">= 2.0"
55
require "yaml"
66

7-
CAC_SHARED_FOLDER_TYPE = ENV.fetch("CAC_SHARED_FOLDER_TYPE", "nfs")
8-
CAC_NFS_VERSION = ENV.fetch("CAC_NFS_VERSION_3", true) ? 'vers=3': 'vers=4'
9-
10-
if CAC_SHARED_FOLDER_TYPE == "nfs"
11-
if Vagrant::Util::Platform.linux? then
12-
CAC_MOUNT_OPTIONS = ['rw', CAC_NFS_VERSION, 'tcp', 'nolock', 'actimeo=1']
13-
else
14-
CAC_MOUNT_OPTIONS = [CAC_NFS_VERSION, 'udp', 'actimeo=1']
15-
end
16-
else
17-
if ENV.has_key?("CAC_MOUNT_OPTIONS")
18-
CAC_MOUNT_OPTIONS = ENV.fetch("CAC_MOUNT_OPTIONS").split
19-
else
20-
CAC_MOUNT_OPTIONS = ["rw"]
21-
end
22-
end
23-
247
if ENV['CAC_TRIPPLANNER_MEMORY'].nil?
258
# OpenTripPlanner needs > 1GB to build and run
269
CAC_MEMORY_MB = "8192"
@@ -88,7 +71,7 @@ VAGRANT_PROXYCONF_ENDPOINT = ENV["VAGRANT_PROXYCONF_ENDPOINT"]
8871
VAGRANTFILE_API_VERSION = "2"
8972

9073
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
91-
config.vm.box = "ubuntu/trusty64"
74+
config.vm.box = "bento/ubuntu-16.04"
9275

9376
# Wire up the proxy if:
9477
#
@@ -132,12 +115,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
132115
config.vm.define "app" do |app|
133116
app.vm.hostname = "app"
134117
app.vm.network "private_network", ip: "192.168.8.24"
135-
136-
if testing?
137-
app.vm.synced_folder ".", "/opt/app"
138-
else
139-
app.vm.synced_folder ".", "/opt/app", type: CAC_SHARED_FOLDER_TYPE, mount_options: CAC_MOUNT_OPTIONS
140-
end
118+
app.vm.synced_folder ".", "/opt/app"
141119

142120
# Web
143121
app.vm.network "forwarded_port", guest: 443, host: 8024

deployment/ansible/group_vars/all

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ postgres_host: "192.168.8.25"
1111

1212
packer_version: "1.0.2"
1313

14+
python_version: "2.7.*"
15+
1416
nodejs_version: 10.16.0
15-
nodejs_npm_version: 6.9.0
17+
nodejs_npm_version: 6.10.2
1618

17-
pip_version: 19.1.*
19+
pip_version: 19.2.*
1820
virtualenv_version: 16.5.0
1921

2022
otp_router: "default"

deployment/ansible/group_vars/development_template

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ default_admin_username: 'admin'
2626
default_admin_password: 'admin'
2727
default_admin_email: '[email protected]'
2828

29-
postgresql_version: "9.4"
30-
postgresql_package_version: "9.4.*.pgdg14.04+1"
29+
postgresql_version: "9.5"
30+
postgresql_package_version: "9.5.*"
31+
postgresql_support_libpq_version: "*"
3132

3233
postgresql_listen_addresses: "*"
3334
postgresql_hba_mapping:

deployment/ansible/group_vars/test

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ production: false
55

66
postgis_version: [2, 1, 8]
77

8-
postgresql_version: "9.4"
9-
postgresql_package_version: "9.4.*.pgdg14.04+1"
8+
postgresql_version: "9.5"
9+
postgresql_package_version: "9.5.*"
10+
postgresql_support_libpq_version: "*"
1011

1112
postgresql_listen_addresses: "*"
1213
postgresql_hba_mapping:

deployment/ansible/otp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
apt: update_cache=yes
88

99
roles:
10-
- { role: "cac-tripplanner.otp-data"}
10+
- {role: "cac-tripplanner.otp-data"}

deployment/ansible/roles.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
- src: azavea.opentripplanner
2-
version: 1.2.0
2+
version: 2.0.0
33

44
- src: azavea.nginx
55
version: 0.3.1
@@ -23,7 +23,7 @@
2323
version: 0.1.0
2424

2525
- src: azavea.postgresql-support
26-
version: 0.3.2
26+
version: 0.4.0
2727

2828
- src: azavea.postgresql
29-
version: 0.5.0
29+
version: 1.0.0

deployment/ansible/roles/cac-tripplanner.app/defaults/main.yml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,9 @@ app_sass_version: "3.4.22"
66

77
app_log: "/var/log/cac-tripplanner-app.log"
88

9+
gunicorn_app_name: "cac-tripplanner-app"
910
root_app_dir: "/opt/app/python/cac_tripplanner"
1011
root_conf_dir: "/etc/cac_tripplanner.d"
1112
root_src_dir: "/opt/app/src"
1213
root_static_dir: "/srv/cac"
1314
root_media_dir: "/media/cac"
14-
15-
cac_python_dependencies:
16-
- { name: 'base58', version: '1.0.3' }
17-
- { name: 'boto', version: '2.49.0' }
18-
- { name: 'django', version: '1.11.21' }
19-
- { name: 'django-ckeditor', version: '5.7.1' }
20-
- { name: 'django-image-cropping', version: '1.2.0' }
21-
- { name: 'django-extensions', version: '1.9.9' }
22-
- { name: 'django-storages', version: '1.7.1' }
23-
- { name: 'easy-thumbnails', version: '2.6.0' }
24-
- { name: 'gunicorn', version: '19.9.0' }
25-
- { name: 'Pillow', version: '6.0.0' }
26-
- { name: 'psycopg2-binary', version: '2.8.3' }
27-
- { name: 'pytz', version: '2019.1' }
28-
- { name: 'troposphere', version: '1.8.1' }
29-
- { name: 'majorkirby', version: '0.2.1' }
30-
# Note: django-wpadmin is installed manually to work around the fact that ansible-pip
31-
# ignores editable=False
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
- name: Restart cac-tripplanner-app
3-
service: name=cac-tripplanner-app state=restarted
3+
service: name=cac-tripplanner-app use=sysv state=restarted
44

55
- name: Restart nginx
6-
service: name=nginx state=restarted
6+
service: name=nginx use=sysv state=restarted

deployment/ansible/roles/cac-tripplanner.app/tasks/main.yml

Lines changed: 39 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,23 @@
22
# # Note bzip2 only installed here as workaround for unresolved but closed phantomjs
33
# install issue: https://github.com/Medium/phantomjs/issues/659
44
- name: Install packages
5-
apt: name={{ item }} state=present
6-
with_items:
7-
- binutils
8-
- bzip2
9-
- gdal-bin
10-
- libpq-dev
11-
- libproj-dev
12-
- python-dev
13-
- libjpeg-dev
5+
apt:
6+
state: present
7+
pkg:
8+
- binutils
9+
- bzip2
10+
- gdal-bin
11+
- libpq-dev
12+
- libproj-dev
13+
- python-dev
14+
- python3-pip
15+
- libjpeg-dev
1416

15-
- name: Install pip packages
16-
pip: name={{ item.name }} version={{ item.version }}
17-
with_items: "{{ cac_python_dependencies }}"
17+
- name: Install pip packages to python3 for deployment
18+
pip: requirements={{ root_app_dir }}/deployment_requirements.txt executable=/usr/bin/pip3
1819

19-
# Putting 'editable: false' in the entry in cac_python_dependencies should make it install
20-
# non-editable, but it's getting ignored
21-
- name: Install django-wpadmin manually to work around ansible bug
22-
command: pip install --upgrade 'git+https://github.com/azavea/[email protected]#egg=django-wpadmin'
20+
- name: Install pip packages
21+
pip: requirements={{ root_app_dir }}/requirements.txt
2322

2423
- name: Touch log file and set permissions
2524
file: path={{ app_log }} state=touch owner={{ app_username }} group={{ app_username }} mode=0664
@@ -41,25 +40,27 @@
4140
- name: Write secrets file
4241
template: src=cac_secrets.j2 dest=/etc/cac_secrets
4342
when: develop or production
44-
notify: Restart cac-tripplanner-app
43+
notify: Restart {{ gunicorn_app_name }}
4544

4645
- name: Configure Gunicorn settings
4746
template: src=gunicorn-cac-tripplanner.py.j2 dest={{ root_conf_dir }}/gunicorn.py
48-
notify: Restart cac-tripplanner-app
47+
notify: Restart {{ gunicorn_app_name }}
4948

5049
- name: Configure service definition
51-
template: src=upstart-cac-tripplanner-app.conf.j2 dest=/etc/init/cac-tripplanner-app.conf
52-
notify: Restart cac-tripplanner-app
50+
template: src=systemd-{{ gunicorn_app_name }}.conf.j2
51+
dest=/etc/systemd/system/{{ gunicorn_app_name }}.service
52+
notify: Restart {{ gunicorn_app_name }}
5353

54-
- name: Run migrations
55-
django_manage: command=migrate
56-
app_path=/opt/app/python/cac_tripplanner
57-
notify: Restart cac-tripplanner-app
58-
when: develop or test
54+
- name: Enable gunicorn service
55+
systemd:
56+
name: "{{ gunicorn_app_name }}.service"
57+
enabled: yes
58+
daemon_reload: yes
5959

60-
- name: Run collectstatic
61-
django_manage: command=collectstatic
62-
app_path=/opt/app/python/cac_tripplanner
60+
- name: Enable nginx service
61+
systemd:
62+
name: "nginx.service"
63+
enabled: yes
6364

6465
- name: Copy media assets
6566
copy: src=../../python/cac_tripplanner/default_media
@@ -68,6 +69,16 @@
6869
group={{ app_username }}
6970
when: develop or test
7071

72+
- name: Run migrations
73+
django_manage: command=migrate
74+
app_path="{{ root_app_dir }}"
75+
notify: Restart {{ gunicorn_app_name }}
76+
when: develop or test
77+
78+
- name: Run collectstatic
79+
django_manage: command=collectstatic
80+
app_path="{{ root_app_dir }}"
81+
7182
- name: Copy nginx config
7283
template: src=nginx-default.j2 dest=/etc/nginx/sites-available/default
7384
notify: Restart nginx
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[Unit]
2+
Description = {{ gunicorn_app_name }}
3+
After = network-online.target
4+
5+
[Service]
6+
PermissionsStartOnly = true
7+
User = {{ app_username }}
8+
Group = {{ app_username }}
9+
WorkingDirectory = {{ root_app_dir }}
10+
ExecStart = /usr/bin/env gunicorn --config {{ root_conf_dir }}/gunicorn.py --timeout {{ otp_session_timeout_s }} cac_tripplanner.wsgi
11+
ExecReload = /bin/kill -s HUP $MAINPID
12+
ExecStop = /bin/kill -s TERM $MAINPID
13+
PrivateTmp = true
14+
StandardOutput = syslog
15+
StandardError = syslog
16+
SyslogIdentifier = {{ gunicorn_app_name }}
17+
18+
[Install]
19+
{% if develop or test -%}
20+
WantedBy = opt-app.mount
21+
{% else %}
22+
WantedBy = network-online.target
23+
{% endif %}

0 commit comments

Comments
 (0)