From 36bc34ae57f64b0531bcb8cc0a47a9cd455d458f Mon Sep 17 00:00:00 2001
From: Lars Beckers <lars.beckers@rwth-aachen.de>
Date: Fri, 4 Sep 2020 01:18:24 +0200
Subject: [PATCH] uwsgi: wahlsystem-2018, plus related fixes for shibd

---
 shibboleth/handlers/main.yml          |  2 +-
 shibboleth/tasks/main.yml             | 19 ++----------------
 uwsgi-python/handlers/main.yml        |  3 +++
 uwsgi-python/vars/wahlsystem-2018.yml | 28 +++++++++++++++++++++++++++
 webserver/templates/nginx-proxy.conf  |  2 --
 5 files changed, 34 insertions(+), 20 deletions(-)
 create mode 100644 uwsgi-python/vars/wahlsystem-2018.yml

diff --git a/shibboleth/handlers/main.yml b/shibboleth/handlers/main.yml
index edeb5b0..43308bb 100644
--- a/shibboleth/handlers/main.yml
+++ b/shibboleth/handlers/main.yml
@@ -7,4 +7,4 @@
   systemd: name=supervisor state=reloaded
 
 - name: reload shibd
-  systemd: name=shibd state=reloaded
+  systemd: name=shibd state=restarted
diff --git a/shibboleth/tasks/main.yml b/shibboleth/tasks/main.yml
index 9317d0f..e5ae378 100644
--- a/shibboleth/tasks/main.yml
+++ b/shibboleth/tasks/main.yml
@@ -1,24 +1,9 @@
 ---
-# file: webservices/shibboleth/tasks/main.yml
-
-- name: activate the shibboleth apt repository
-  apt_repository:
-    # yamllint disable-line rule:line-length
-    repo: "deb [arch=amd64] https://repo.fsmpi.rwth-aachen.de/ {{ansible_facts.distribution_release}} shibboleth"
-    state: present
-  notify:
-    - update apt cache
-  tags:
-    - packages
-    - repos
-    - shibboleth
-
-- meta: flush_handlers
 
 - name: install the required packages for shibboleth
   apt:
     name:
-      - nginx-extras
+      - nginx-full
       - libnginx-mod-http-shibboleth
       - libnginx-mod-http-headers-more-filter
       - supervisor
@@ -78,7 +63,7 @@
 - name: put the nginx example snippet there
   copy:
     src: nginx-snippet.conf
-    dest: /etc/nginx/snippets/
+    dest: /etc/nginx/snippets/shibd.conf
     owner: root
     group: root
     mode: '0644'
diff --git a/uwsgi-python/handlers/main.yml b/uwsgi-python/handlers/main.yml
index ed929f3..6943805 100644
--- a/uwsgi-python/handlers/main.yml
+++ b/uwsgi-python/handlers/main.yml
@@ -45,6 +45,9 @@
   service: name="wahlsystem-celery" state=restarted
   listen: "restart uwsgi instance wahlsystem"
 
+- name: restart uwsgi instance wahlsystem-2018
+  service: name="uwsgi@wahlsystem-2018" state=restarted
+
 - name: restart uwsgi instance meckerkasten
   service: name="uwsgi@meckerkasten" state=restarted
 
diff --git a/uwsgi-python/vars/wahlsystem-2018.yml b/uwsgi-python/vars/wahlsystem-2018.yml
new file mode 100644
index 0000000..1f49757
--- /dev/null
+++ b/uwsgi-python/vars/wahlsystem-2018.yml
@@ -0,0 +1,28 @@
+---
+
+app_name: wahlsystem-2018
+app_user: wahl
+app_group: wahl
+app_home: /var/www/wahlsystem-2018
+app_path: /var/www/wahlsystem-2018/program
+app_python_version: 3
+app_enable_threads: true
+app_harakiri: 120
+app_venv: /var/www/wahlsystem-2018/program
+app_program: server.py
+app_callable: app
+app_command: "runserver"
+app_mountpoint: /
+
+app_db_name: wahl2018
+app_db_type: postgres
+
+app_additional_software: []
+
+app_deploy_key: "{{ inventory_dir }}/files/deploy-keys/wahlsystem-2018"
+app_git_url: "git@git.stud.rwth-aachen.de:wahlausschuss/website.git"
+app_git_version: HEAD
+
+app_requirements_file: requirements.txt
+app_config_file: ""
+app_secret_config: false
diff --git a/webserver/templates/nginx-proxy.conf b/webserver/templates/nginx-proxy.conf
index 8decc0e..d4da389 100644
--- a/webserver/templates/nginx-proxy.conf
+++ b/webserver/templates/nginx-proxy.conf
@@ -2,9 +2,7 @@ user nginx-proxy;
 worker_processes {{ webserver_workers }};
 worker_rlimit_nofile {{ webserver_worker_rlimit_nofile|default(100000) }};
 pid /run/nginx-proxy.pid;
-{% if debian_version == "stretch" %}
 include /etc/nginx/modules-enabled/*.conf;
-{% endif %}
 pcre_jit on;
 
 events {
-- 
GitLab