You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2021/01/15 00:04:26 UTC

[airavata] branch master updated: Ansible: adding geo gateway redirect

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata.git


The following commit(s) were added to refs/heads/master by this push:
     new 6591afa  Ansible: adding geo gateway redirect
6591afa is described below

commit 6591afaaf6a594ceb9723738543224fd1d14bcfb
Author: Marcus Christie <ma...@iu.edu>
AuthorDate: Thu Jan 14 19:03:53 2021 -0500

    Ansible: adding geo gateway redirect
---
 .../ansible/inventories/scigap/production/host_vars/geo/vars.yml | 4 ++++
 dev-tools/ansible/roles/django/defaults/main.yml                 | 1 +
 .../ansible/roles/django/templates/django-ssl-vhost.conf.j2      | 9 +++++++++
 dev-tools/ansible/roles/django/templates/django-vhost.conf.j2    | 9 +++++++++
 4 files changed, 23 insertions(+)

diff --git a/dev-tools/ansible/inventories/scigap/production/host_vars/geo/vars.yml b/dev-tools/ansible/inventories/scigap/production/host_vars/geo/vars.yml
index acf1f88..d4d5a62 100644
--- a/dev-tools/ansible/inventories/scigap/production/host_vars/geo/vars.yml
+++ b/dev-tools/ansible/inventories/scigap/production/host_vars/geo/vars.yml
@@ -28,6 +28,10 @@ airavata_django_extra_dependencies:
 
 vhost_servername: "geo-gateway.org"
 vhost_ssl: True
+vhost_redirects:
+  - from: "^/$"
+    to: "/geogateway_django_app/#/maptools"
+    regex: true
 ssl_certificate_file: "/etc/letsencrypt/live/geo-gateway.org/cert.pem"
 ssl_certificate_chain_file: "/etc/letsencrypt/live/geo-gateway.org/fullchain.pem"
 ssl_certificate_key_file: "/etc/letsencrypt/live/geo-gateway.org/privkey.pem"
diff --git a/dev-tools/ansible/roles/django/defaults/main.yml b/dev-tools/ansible/roles/django/defaults/main.yml
index 6dc25e8..df6b9bb 100644
--- a/dev-tools/ansible/roles/django/defaults/main.yml
+++ b/dev-tools/ansible/roles/django/defaults/main.yml
@@ -27,6 +27,7 @@ real_user_data_dir: "{{ user_data_dir }}"
 vhost_servername: "{{ groups['django'][0] }}"
 vhost_ssl: False
 vhost_aliases: []
+vhost_redirects: []
 vhost_timeout: 60
 django_vhost_conf_name: "django-{{ gateway_id }}"
 httpd_confd_file_location:
diff --git a/dev-tools/ansible/roles/django/templates/django-ssl-vhost.conf.j2 b/dev-tools/ansible/roles/django/templates/django-ssl-vhost.conf.j2
index 28a9030..3e6e4b7 100644
--- a/dev-tools/ansible/roles/django/templates/django-ssl-vhost.conf.j2
+++ b/dev-tools/ansible/roles/django/templates/django-ssl-vhost.conf.j2
@@ -64,6 +64,15 @@
     </Directory>
     {% endfor %}
 
+    {# Custom redirects #}
+    {% for redirect in vhost_redirects %}
+    {% if redirect.regex is defined and redirect.regex %}
+    RedirectMatch "{{ redirect.from }}" "{{ redirect.to }}"
+    {% else %}
+    Redirect "{{ redirect.from }}" "{{ redirect.to }}"
+    {% endif %}
+    {% endfor %}
+
     WSGIDaemonProcess {{ vhost_servername }} display-name=%{GROUP} python-home={{ doc_root_dir }}/venv python-path={{ doc_root_dir }}/airavata-django-portal processes={{ django_wsgi_processes }} user={{ user }} group={{ group }}
     WSGIProcessGroup {{ vhost_servername }}
 
diff --git a/dev-tools/ansible/roles/django/templates/django-vhost.conf.j2 b/dev-tools/ansible/roles/django/templates/django-vhost.conf.j2
index 1329271..dd9b271 100644
--- a/dev-tools/ansible/roles/django/templates/django-vhost.conf.j2
+++ b/dev-tools/ansible/roles/django/templates/django-vhost.conf.j2
@@ -55,6 +55,15 @@
     </Directory>
     {% endfor %}
 
+    {# Custom redirects #}
+    {% for redirect in vhost_redirects %}
+    {% if redirect.regex is defined and redirect.regex %}
+    RedirectMatch "{{ redirect.from }}" "{{ redirect.to }}"
+    {% else %}
+    Redirect "{{ redirect.from }}" "{{ redirect.to }}"
+    {% endif %}
+    {% endfor %}
+
     WSGIDaemonProcess {{ vhost_servername }} display-name=%{GROUP} python-home={{ doc_root_dir }}/venv python-path={{ doc_root_dir }}/airavata-django-portal processes={{ django_wsgi_processes }} user={{ user }} group={{ group }}
     WSGIProcessGroup {{ vhost_servername }}