diff --git a/uwsgi-python/handlers/main.yml b/uwsgi-python/handlers/main.yml index d37a25bd1689434d7a8184803a7404bf827b2f3a..d12586eb40465109f5d4ceb4954498076c098fa1 100644 --- a/uwsgi-python/handlers/main.yml +++ b/uwsgi-python/handlers/main.yml @@ -10,3 +10,6 @@ - name: restart uwsgi instance shorturl service: name="uwsgi@shorturl" state=restarted +- name: restart uwsgi instance lehrpreis + service: name="uwsgi@lehrpreis" state=restarted + diff --git a/uwsgi-python/tasks/apps/lehrpreis.yml b/uwsgi-python/tasks/apps/lehrpreis.yml new file mode 100644 index 0000000000000000000000000000000000000000..4063750f2835e45fa9344dc0a7e5ea277454cd6a --- /dev/null +++ b/uwsgi-python/tasks/apps/lehrpreis.yml @@ -0,0 +1,18 @@ +- name: ensure we have our branded logo + copy: + src: "{{ lehrpreis_branding_logo_src }}" + dest: "{{ app_path }}/static/images/{{ lehrpreis_branding_logo }}" + owner: "{{ app_user }}" + group: "{{ app_group }}" + mode: 0644 + notify: + - restart uwsgi instance {{ app.instance }} + when: lehrpreis_branding_logo and lehrpreis_branding_logo_src + +- name: ensure the translations are compiled + command: "{ {app_venv }}/bin/pybabel compile -d translations" + args: + chdir: "{{ app_path }}" + when: git.changed + notify: + - restart uwsgi instance {{ app.instance }} diff --git a/uwsgi-python/templates/apps/lehrpreis.j2 b/uwsgi-python/templates/apps/lehrpreis.j2 new file mode 100644 index 0000000000000000000000000000000000000000..d4f8a805975dc475a416a92b51044fa63b00fc44 --- /dev/null +++ b/uwsgi-python/templates/apps/lehrpreis.j2 @@ -0,0 +1,39 @@ +from secret_config import secret_key as SECRET_KEY +SQLALCHEMY_DATABASE_URI = 'postgresql://{{ app_user }}:@/{{ app_db_name }}' +DEBUG = False +PORT = 5001 +SESSION_COOKIE_SECURE = True + +import datetime +REMEMBER_COOKIE_NAME = 'remember_token' +REMEMBER_COOKIE_DURATION = datetime.timedelta(30) +REMEMBER_COOKIE_DOMAIN = None +REMEMBER_COOKIE_PATH = '/' +REMEMBER_COOKIE_SECURE = True +REMEMBER_COOKIE_HTTPONLY = True + +BABEL_DEFAULT_LOCALE = '{{ lehrpreis_default_locale }}' +BABEL_DEFAULT_TIMEZONE = '{{ lehrpreis_default_timezone }}' + +USER_GROUP = '{{ lehrpreis_auth_group }}' + +AD_HOST = '{{ lehrpreis_ad_host }}' +AD_DOMAIN = '{{ lehrpreis_ad_domain }}' +AD_USER_DN = '{{ lehrpreis_ad_user_dn }}' +AD_GROUP_DN = '{{ lehrpreis_ad_group_dn }}' +AD_CA_CERT = '{{ lehrpreis_ad_cert }}' + +BRANDING_APP_NAME = {'de': '{{ lehrpreis_branding_app_name_de }}', + 'en': '{{ lehrpreis_branding_app_name_en }}'} +BRANDING_APP_URL = '{{ lehrpreis_branding_app_url }}' +BRANDING_ORG_NAME = '{{ lehrpreis_branding_org_name }}' +BRANDING_CONTACT = '{{ lehrpreis_branding_contact }}' +BRANDING_LOGO = '{{ lehrpreis_branding_logo }}' +BRANDING_INFORMATION = {'de': '''{{ lehrpreis_branding_information_de }}''', + 'en': '''{{ lehrpreis_branding_information_en }}'''} + +MAIL_ENABLED = {{ lehrpreis_mail_enabled }} +MAIL_ADDRESS = '{{ lehrpreis_mail_address }}' +MAIL_HOST = '{{ lehrpreis_mail_host }}' +MAIL_LOCALE = '{{ lehrpreis_mail_locale }}' + diff --git a/uwsgi-python/vars/lehrpreis.yml b/uwsgi-python/vars/lehrpreis.yml new file mode 100644 index 0000000000000000000000000000000000000000..c30bf61011e7ee000dfb48337d04e344170d4414 --- /dev/null +++ b/uwsgi-python/vars/lehrpreis.yml @@ -0,0 +1,48 @@ +app_name: lehrpreis +app_user: lehrpreis +app_group: lehrpreis +app_home: /var/www/lehrpreis +app_path: /var/www/lehrpreis +app_python_version: 3 +app_venv: /var/www/lehrpreis/venv/ +app_program: lehrpreis.py +app_callable: app +app_command: "" +app_mountpoint: / + +app_db_name: lehrpreis +app_db_type: postgres + +app_additional_software: [] + +app_deploy_key: "{{ inventory_dir }}/files/deploy-keys/lehrpreis" +app_git_url: "git@git.fsmpi.rwth-aachen.de:studi-systeme/lehrpreis.git" +app_git_version: HEAD + +app_config_file: config.py +app_secret_config: true + +lehrpreis_default_locale: en +lehrpreis_default_timezone: Europe/Berlin +lehrpreis_auth_group: users + +lehrpreis_ad_host: ad.example.com +lehrpreis_ad_domain: EXAMPLE +lehrpreis_ad_user_dn: 'cn=users,dc=example,dc=com' +lehrpreis_ad_group_dn: 'cn=users,dc=example,dc=com' +lehrpreis_ad_cert: '' + +lehrpreis_branding_app_name_de: 'Lehrpreis WebApp' +lehrpreis_branding_app_name_en: 'Teaching Award WebApp' +lehrpreis_branding_app_url: 'https://example.com' +lehrpreis_branding_org_name: 'Example Org' +lehrpreis_branding_contact: 'committee@example.com' +lehrpreis_branding_logo: '' +lehrpreis_branding_logo_src: '' +lehrpreis_branding_information_de: '' +lehrpreis_branding_information_en: '' + +lehrpreis_mail_enabled: True +lehrpreis_mail_address: 'committee@example.com' +lehrpreis_mail_host: mail.example.com +lehrpreis_mail_locale: en