From 6dff46a1d5ba76ca867485b64b6f192c270092f4 Mon Sep 17 00:00:00 2001
From: Hinrikus Wolf <hinrikus@fsmpi.rwth-aachen.de>
Date: Sun, 1 Jul 2018 14:18:17 +0200
Subject: [PATCH] migrate schildergenerator role

---
 uwsgi-python/handlers/main.yml          |  5 ++
 uwsgi-python/tasks/apps/schilder.yml    |  8 +++
 uwsgi-python/templates/apps/schilder.j2 | 69 +++++++++++++++++++++++++
 uwsgi-python/vars/schilder.yml          | 33 ++++++++++++
 4 files changed, 115 insertions(+)
 create mode 100644 uwsgi-python/tasks/apps/schilder.yml
 create mode 100644 uwsgi-python/templates/apps/schilder.j2
 create mode 100644 uwsgi-python/vars/schilder.yml

diff --git a/uwsgi-python/handlers/main.yml b/uwsgi-python/handlers/main.yml
index d12586e..f8d6c5e 100644
--- a/uwsgi-python/handlers/main.yml
+++ b/uwsgi-python/handlers/main.yml
@@ -13,3 +13,8 @@
 - name: restart uwsgi instance lehrpreis
   service: name="uwsgi@lehrpreis" state=restarted
 
+- name: restart uwsgi instance schilder
+  service: name="uwsgi@schilder" state=restarted
+  
+- name: restart uwsgi instance boxes
+  service: name="uwsgi@boxes" state=restarted
diff --git a/uwsgi-python/tasks/apps/schilder.yml b/uwsgi-python/tasks/apps/schilder.yml
new file mode 100644
index 0000000..55b2847
--- /dev/null
+++ b/uwsgi-python/tasks/apps/schilder.yml
@@ -0,0 +1,8 @@
+- name: ensure we have our templates
+  git:
+    repo: "{{ schilder_templates_url }}"
+    dest: "{{ app_home }}/tex"
+    key_file: /root/.ssh/schildergenerator
+    version: HEAD
+  notify:
+    - "restart uwsgi instance {{ app.instance }}"
diff --git a/uwsgi-python/templates/apps/schilder.j2 b/uwsgi-python/templates/apps/schilder.j2
new file mode 100644
index 0000000..0952fa5
--- /dev/null
+++ b/uwsgi-python/templates/apps/schilder.j2
@@ -0,0 +1,69 @@
+#### BASIC CONFIGURATION
+
+# Secret key (used for session cookie encryption). Needs to be set to some random string.
+# Yes, just smash your keyboard for some random characters. No, don't publish them anywhere.
+# Yes, you will need this. If you get random RuntimeErrors, you did not set this.
+
+from secret_config import secret_key as app_secret
+
+## You will need to use absolute paths!
+
+# Base directory. You need to set this again in schilder.wsgi if you use WSGI.
+basedir = '{{ app_path }}'
+
+# Temp directory for imagemagick/pdflatex work files (needs to be writeable)
+tmpdir = '/tmp'
+
+## All following directories derive from basedir, you don't really need to alter them
+
+# Data directory (needs to be writeable)
+datadir = basedir + '/data'
+
+# HTML template directory
+templatedir = basedir + '/templates'
+
+# TeX template directory
+textemplatedir = '{{ app_home }}/tex'
+
+# TeX support file directory (all files that might be needed by a tex template)
+texsupportdir = textemplatedir + '/support'
+
+# PDF data directory (needs to be writeable)
+pdfdir = datadir + '/pdf'
+
+# Image data directory (needs to be writeable)
+imagedir = datadir + '/images'
+
+# Cache dir (needs to be writable)
+cachedir = datadir + '/cache'
+
+# Upload temp directory (needs to be writeable)
+uploaddir = datadir + '/upload'
+
+# allowed image upload file extensions
+allowed_extensions = set(['png', 'jpg', 'jpeg', 'gif', 'svg'])
+
+
+#### PRINTER OPTIONS
+
+# CUPS printer names
+printers = { 
+  {% for printer in schilder_printers %}
+    '{{ printer.description }}': '{{ printer.name }}',
+  {% endfor %}
+}
+printserver = '{{ schilder_printsrv }}'
+
+# additional lpr options. Use an empty list if not needed.
+lproptions = [
+{% for option in schilder_lproptions %}
+    '{{ option }}',
+{% endfor %}
+]
+
+#### DEVELOPERS ONLY
+# Listening interface and port, usually '127.0.0.1' or '0.0.0.0'
+# Only effective if started from command line (instead via webserver/WSGI),
+# therefore these options would only be interesting to a developer.
+listen = '127.0.0.1'
+port = 5432
diff --git a/uwsgi-python/vars/schilder.yml b/uwsgi-python/vars/schilder.yml
new file mode 100644
index 0000000..1a5fdf1
--- /dev/null
+++ b/uwsgi-python/vars/schilder.yml
@@ -0,0 +1,33 @@
+app_name: schilder
+app_user: schilder
+app_group: schilder
+app_home: /var/www/schilder
+app_path: /var/www/schilder/program
+app_python_version: 2
+app_venv: /var/www/schilder/program
+app_program: schilder.py
+app_callable: app
+app_command: ""
+app_mountpoint: /
+
+app_db_type: ""
+
+app_additional_software: ["graphicsmagick", "python-pythonmagick"]
+
+app_deploy_key: "{{ inventory_dir }}/files/deploy-keys/schildergenerator"
+app_git_url: "git@git.fsmpi.rwth-aachen.de:schilder/schildergenerator.git"
+app_git_version: HEAD
+
+app_config_file: config.py
+app_secret_config: true
+
+
+schilder_printsrv: printsrv.example.de
+schilder_printers:
+  - description: "1 - Kopierer Turing"
+    name: "Kopierer1"
+  - description: "2 - Kopierer Moore"
+    name: "Kopierer2"
+schilder_lproptions:
+  - "-o fitplot"
+schilder_templates_url: git@git.example.com:schilder/templates-example-schilder.git
-- 
GitLab