aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/status/templates
diff options
context:
space:
mode:
authorMilo Casagrande <milo.casagrande@linaro.org>2014-01-22 18:05:48 +0100
committerMilo Casagrande <milo.casagrande@linaro.org>2014-01-24 11:24:47 +0100
commit5aabb19dd0d86e92a4ffdb173aed0a2de306a8fa (patch)
treed05ffd3de7966cbc41fa31f9d710974b92f7980f /ansible/roles/status/templates
parent3b2b918781c50b789999d2649cfe25af112f5084 (diff)
Added ansible configuration to deploy roadmap.
Change-Id: Id9c00f87faa17fa18b4c76e2dd005c3baf31cebf
Diffstat (limited to 'ansible/roles/status/templates')
-rw-r--r--ansible/roles/status/templates/apache_production.conf56
-rw-r--r--ansible/roles/status/templates/apache_staging.conf47
-rw-r--r--ansible/roles/status/templates/apache_website.conf8
-rw-r--r--ansible/roles/status/templates/roadmap.wsgi21
-rw-r--r--ansible/roles/status/templates/roadmap_update_cron.sh32
5 files changed, 164 insertions, 0 deletions
diff --git a/ansible/roles/status/templates/apache_production.conf b/ansible/roles/status/templates/apache_production.conf
new file mode 100644
index 0000000..bc3aa7e
--- /dev/null
+++ b/ansible/roles/status/templates/apache_production.conf
@@ -0,0 +1,56 @@
+<VirtualHost *:80>
+ ServerName {{ install_dir }}
+ ServerAdmin webmaster@linaro.org
+
+ Redirect permanent / https://{{ install_dir }}
+</VirtualHost>
+
+<VirtualHost *:443>
+ ServerName {{ install_dir }}
+ ServerAdmin webmaster@linaro.org
+
+ CustomLog ${APACHE_LOG_DIR}/{{ install_dir }}-access.log combined
+ ErrorLog ${APACHE_LOG_DIR}/{{ install_dir }}-error.log
+
+ SSLEngine on
+ SSLCertificateFile /etc/ssl/certs/{{ install_dir }}.crt
+ SSLCertificateKeyFile /etc/ssl/certs/{{ install_dir }}.key
+ SSLCACertificateFile /etc/ssl/certs/gd_bundle.crt
+
+ SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
+ #DocumentRoot /var/www/{{ install_dir }}
+ WSGIScriptAlias / {{ install_base }}/{{ install_dir }}/{{ install_dir }}.wsgi
+
+ ExpiresActive On
+ ExpiresDefault "access plus 300 seconds"
+
+ ExpiresByType text/css "access plus 1 month"
+ ExpiresByType text/javascript "access plus 1 month"
+ ExpiresByType image/png "access plus 1 month"
+ ExpiresByType image/jpg "access plus 1 month"
+ ExpiresByType image/jpeg "access plus 1 month"
+ ExpiresByType image/x-icon "access plus 1 month"
+
+ Header append Cache-Control "public, no-transform"
+
+ <FilesMatch "\.(html|htm)$">
+ Header add Cache-Control "must-revalidate"
+ </FilesMatch>
+
+ <FilesMatch "\.(js|css)$">
+ Header add Cache-Control "max-age=604800"
+ </FilesMatch>
+
+ Alias /static/ /var/www/{{ install_dir }}/static/
+ <Location "/static/">
+ Options -Indexes
+ SetOutputFilter DEFLATE
+
+ BrowserMatch ^Mozilla/4 gzip-only-text/html
+ BrowserMatch ^Mozilla/4\.0[678] no-gzip
+ BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
+
+ SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
+ Header append Vary User-Agent env=!dont-vary
+ </Location>
+</VirtualHost>
diff --git a/ansible/roles/status/templates/apache_staging.conf b/ansible/roles/status/templates/apache_staging.conf
new file mode 100644
index 0000000..68e1995
--- /dev/null
+++ b/ansible/roles/status/templates/apache_staging.conf
@@ -0,0 +1,47 @@
+<VirtualHost *:80>
+ ServerName {{ install_dir }}
+ ServerAdmin webmaster@linaro.org
+
+ CustomLog ${APACHE_LOG_DIR}/{{ install_dir }}-access.log combined
+ ErrorLog ${APACHE_LOG_DIR}/{{ install_dir }}-error.log
+
+ SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
+ #DocumentRoot /var/www/{{ install_dir }}
+
+ WSGIDaemonProcess {{ install_dir }} maximum-requests=10000
+ WSGIProcessGroup {{ install_dir }}
+ WSGIScriptAlias / {{ install_base }}/{{ install_dir }}/{{ install_dir }}.wsgi
+
+ ExpiresActive On
+ ExpiresDefault "access plus 300 seconds"
+
+ ExpiresByType text/css "access plus 1 month"
+ ExpiresByType text/javascript "access plus 1 month"
+ ExpiresByType image/png "access plus 1 month"
+ ExpiresByType image/jpg "access plus 1 month"
+ ExpiresByType image/jpeg "access plus 1 month"
+ ExpiresByType image/x-icon "access plus 1 month"
+
+ Header append Cache-Control "public, no-transform"
+
+ <FilesMatch "\.(html|htm)$">
+ Header add Cache-Control "must-revalidate"
+ </FilesMatch>
+
+ <FilesMatch "\.(js|css)$">
+ Header add Cache-Control "max-age=604800"
+ </FilesMatch>
+
+ Alias /static/ /var/www/{{ install_dir }}/static/
+ <Location "/static/">
+ Options -Indexes
+ SetOutputFilter DEFLATE
+
+ BrowserMatch ^Mozilla/4 gzip-only-text/html
+ BrowserMatch ^Mozilla/4\.0[678] no-gzip
+ BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
+
+ SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
+ Header append Vary User-Agent env=!dont-vary
+ </Location>
+</VirtualHost>
diff --git a/ansible/roles/status/templates/apache_website.conf b/ansible/roles/status/templates/apache_website.conf
new file mode 100644
index 0000000..c6e763e
--- /dev/null
+++ b/ansible/roles/status/templates/apache_website.conf
@@ -0,0 +1,8 @@
+WSGIRestrictEmbedded On
+WSGILazyInitialization On
+
+{% if role == 'staging' %}
+{% extends "apache_staging.conf" %}
+{% else %}
+{% extends "apache_production.conf" %}
+{% endif %}
diff --git a/ansible/roles/status/templates/roadmap.wsgi b/ansible/roles/status/templates/roadmap.wsgi
new file mode 100644
index 0000000..dde7fd5
--- /dev/null
+++ b/ansible/roles/status/templates/roadmap.wsgi
@@ -0,0 +1,21 @@
+import os
+import sys
+import site
+
+# Add the site-packages of the chosen virtualenv to work with
+site.addsitedir('{{ install_base }}/virtualenv/{{ install_dir }}/'
+ 'local/lib/python2.7/site-packages')
+
+# Add the app's directory to the PYTHONPATH
+sys.path.append('{{ install_base }}/{{ install_dir }}/')
+sys.path.append('{{ install_base }}/{{ install_dir }}/linaroroadmap/')
+
+os.environ['DJANGO_SETTINGS_MODULE'] = 'linaroroadmap.settings'
+
+# Activate your virtual env
+activate_env = os.path.expanduser(
+ "{{ install_base }}/virtualenv/{{ install_dir }}/bin/activate_this.py")
+execfile(activate_env, dict(__file__=activate_env))
+
+import django.core.handlers.wsgi
+application = django.core.handlers.wsgi.WSGIHandler()
diff --git a/ansible/roles/status/templates/roadmap_update_cron.sh b/ansible/roles/status/templates/roadmap_update_cron.sh
new file mode 100644
index 0000000..b4fdf7d
--- /dev/null
+++ b/ansible/roles/status/templates/roadmap_update_cron.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+# Copyright (C) 2013, 2014 Linaro
+#
+# This file is part of roadmap.
+#
+# roadmap is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# roadmap is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with roadmap. If not, see <http://www.gnu.org/licenses/>.
+
+export WORKON_HOME={{install_base }}/virtualenv
+source /usr/local/bin/virtualenvwrapper.sh
+
+workon {{ install_dir }}
+
+cd /srv/{{ install_dir }}
+
+{% if role == 'staging' %}
+./manage.py roadmap_import --debug
+./manage.py burndown_snapshot --debug
+{% else %}
+./manage.py roadmap_import
+./manage.py burndown_snapshot
+{% endif %} \ No newline at end of file