diff options
author | Andy Doan <andy.doan@linaro.org> | 2016-02-03 15:03:32 -0600 |
---|---|---|
committer | Andy Doan <andy.doan+gerrit@linaro.org> | 2016-02-04 21:32:35 +0000 |
commit | f69ae1dec6233285a9f8c48c5cc1211feedc0b5d (patch) | |
tree | f22811237da6994e125f7c2aeb429f0d42f5ed22 /per-service | |
parent | d0f1b960626ac4234ad1b6eaced908c917558d8a (diff) |
patchwork: upgrade to django 1.8 role
This required some small variable changes like:
git_repo -> django_project_repo
git_tag -> django_project_version
longerusername is no longer needed for Django 1.8
The django role has the ability to manage apache modules, so remove that
call from our pre-django role.
STATIC_URL was already defined in patchwork base settings. However,
Django now requires a STATIC_ROOT to be define. Rather than put these
files in our project root like we had, I put them in their own
directory. This allowed some simplification of the apache.conf file.
The crowd module was also moved to be installed *after* the django role
was run. This was to prevent the module's setup.py from trying to
install Django (which wouldn't know the proper version we want)
Change-Id: I830aa2efa501efd2a2b29e41d99a6dea0d5c2280
Reviewed-on: https://review.linaro.org/10256
Reviewed-by: Ben Copeland <ben.copeland@linaro.org>
Diffstat (limited to 'per-service')
6 files changed, 23 insertions, 67 deletions
diff --git a/per-service/patchwork/files/apache.conf b/per-service/patchwork/files/apache.conf index 016ef4dd..3808784c 100644 --- a/per-service/patchwork/files/apache.conf +++ b/per-service/patchwork/files/apache.conf @@ -9,27 +9,9 @@ RewriteEngine On RewriteRule ^(/admin.*) https://{{hostname}}$1 [redirect=301,noescape,last] - Alias /static/images/ "{{install_base}}/{{hostname}}/project/images/" - Alias /static/css/ "{{install_base}}/{{hostname}}/project/css/" - Alias /static/js/ "{{install_base}}/{{hostname}}/project/js/" - Alias /static/admin/ "{{install_base}}/{{hostname}}/project/admin/" + Alias /static/ "{{install_base}}/{{hostname}}/static/" - <Directory "{{install_base}}/{{hostname}}/project/admin/"> - Order allow,deny - Allow from all - Require all granted - </Directory> - <Directory "{{install_base}}/{{hostname}}/project/images"> - Order allow,deny - Allow from all - Require all granted - </Directory> - <Directory "{{install_base}}/{{hostname}}/project/css"> - Order allow,deny - Allow from all - Require all granted - </Directory> - <Directory "{{install_base}}/{{hostname}}/project/js"> + <Directory "{{install_base}}/{{hostname}}/static/"> Order allow,deny Allow from all Require all granted @@ -53,27 +35,9 @@ DocumentRoot "{{install_base}}/{{hostname}}/project/htdocs" - Alias /static/images/ "{{install_base}}/{{hostname}}/project/images/" - Alias /static/css/ "{{install_base}}/{{hostname}}/project/css/" - Alias /static/js/ "{{install_base}}/{{hostname}}/project/js/" - Alias /static/admin/ "{{install_base}}/{{hostname}}/project/admin/" + Alias /static/ "{{install_base}}/{{hostname}}/static/" - <Directory "{{install_base}}/{{hostname}}/project/admin/"> - Order allow,deny - Allow from all - Require all granted - </Directory> - <Directory "{{install_base}}/{{hostname}}/project/images"> - Order allow,deny - Allow from all - Require all granted - </Directory> - <Directory "{{install_base}}/{{hostname}}/project/css"> - Order allow,deny - Allow from all - Require all granted - </Directory> - <Directory "{{install_base}}/{{hostname}}/project/js"> + <Directory "{{install_base}}/{{hostname}}/static/"> Order allow,deny Allow from all Require all granted diff --git a/per-service/patchwork/group_vars/all b/per-service/patchwork/group_vars/all index 8a948eae..ae5c6c9c 100644 --- a/per-service/patchwork/group_vars/all +++ b/per-service/patchwork/group_vars/all @@ -1,11 +1,15 @@ -django_south: False db_name: patchwork db_user: patchwork db_password: patchwork hostname: "{{inventory_hostname}}" apache_user: www-data -git_repo: "https://github.com/getpatchwork/patchwork.git" -git_tag: 880d33e885f5bb2c7ede33b116b0638220597256 +apache_modules: + - ssl + - wsgi + - rewrite +django_use_pypi: True +django_project_repo: "https://github.com/getpatchwork/patchwork.git" +django_project_version: 880d33e885f5bb2c7ede33b116b0638220597256 django_settings: local_settings django_local_settings: templates/{{inventory_hostname}}_local_settings.py install_base: /srv diff --git a/per-service/patchwork/roles/patchwork-pre-django/tasks/main.yml b/per-service/patchwork/roles/patchwork-pre-django/tasks/main.yml index 197fd92b..67ab02f4 100644 --- a/per-service/patchwork/roles/patchwork-pre-django/tasks/main.yml +++ b/per-service/patchwork/roles/patchwork-pre-django/tasks/main.yml @@ -6,21 +6,6 @@ - python-pip - python-django # Required or django-crowd-rest-backend installs latest. -# This package is in Ubuntu starting with Vivid, so we should be able to use -# apt when we move to 16.04. -- name: Install PIP longerusername - pip: name=longerusername - -- name: Clone django-crowd-rest-backend repository - git: repo=http://git.linaro.org/lava/django-crowd-rest-backend.git - dest=/srv/django-crowd-rest-backend version="HEAD" - register: crowdbackend - -- name: Install django-crowd-rest-backed - command: python ./setup.py install - chdir=/srv/django-crowd-rest-backend - when: crowdbackend is defined and crowdbackend.changed - - name: Create base directory for installation file: path={{install_base}}/{{hostname}} owner={{apache_user}} group={{apache_user}} mode=0755 state=directory @@ -40,10 +25,3 @@ notify: restart-apache tags: - update - -- name: Enable mod-rewrite - command: a2enmod {{ item }} - creates=/etc/apache2/mods-enabled/{{ item }}.load - with_items: - - rewrite - notify: restart-apache diff --git a/per-service/patchwork/roles/patchwork/tasks/main.yml b/per-service/patchwork/roles/patchwork/tasks/main.yml index 86962fd1..a7c5dfd1 100644 --- a/per-service/patchwork/roles/patchwork/tasks/main.yml +++ b/per-service/patchwork/roles/patchwork/tasks/main.yml @@ -14,3 +14,13 @@ owner=root group=root mode=0644 tags: - cron + +- name: Clone django-crowd-rest-backend repository + git: repo=http://git.linaro.org/lava/django-crowd-rest-backend.git + dest=/srv/django-crowd-rest-backend version="HEAD" + register: crowdbackend + +- name: Install django-crowd-rest-backed + command: python ./setup.py install + chdir=/srv/django-crowd-rest-backend + when: crowdbackend is defined and crowdbackend.changed diff --git a/per-service/patchwork/templates/patches.linaro.org_local_settings.py b/per-service/patchwork/templates/patches.linaro.org_local_settings.py index 4ca47174..e30b6256 100644 --- a/per-service/patchwork/templates/patches.linaro.org_local_settings.py +++ b/per-service/patchwork/templates/patches.linaro.org_local_settings.py @@ -36,7 +36,7 @@ ADMINS = ( DEFAULT_FROM_EMAIL = 'Patchwork <patchwork@{{hostname}}>' NOTIFICATION_FROM_EMAIL = DEFAULT_FROM_EMAIL -STATIC_URL = '/static/' +STATIC_ROOT = '{{install_base}}/{{hostname}}/static' IMAP_SERVER = '{{imap_server}}' IMAP_USER = '{{imap_user}}' diff --git a/per-service/patchwork/templates/patches.opendataplane.org_local_settings.py b/per-service/patchwork/templates/patches.opendataplane.org_local_settings.py index 6c1e3910..8a08ecfc 100644 --- a/per-service/patchwork/templates/patches.opendataplane.org_local_settings.py +++ b/per-service/patchwork/templates/patches.opendataplane.org_local_settings.py @@ -26,7 +26,7 @@ DEFAULT_FROM_EMAIL = 'Patchwork <patchwork@{{hostname}}>' NOTIFICATION_FROM_EMAIL = DEFAULT_FROM_EMAIL ENABLE_XMLRPC = True -STATIC_URL = '/static/' +STATIC_ROOT = '{{install_base}}/{{hostname}}/static' IMAP_SERVER = '{{imap_server}}' IMAP_USER = '{{imap_user}}' |