diff --git a/uwsgi-python/handlers/main.yml b/uwsgi-python/handlers/main.yml index 8bfcc870cb2c6ebb4a118ebfcaace3550c516400..5d448ab90d8c393dcb3145dfe49fb919679a46ed 100644 --- a/uwsgi-python/handlers/main.yml +++ b/uwsgi-python/handlers/main.yml @@ -24,3 +24,11 @@ - name: restart uwsgi instance migration-webapp service: name="uwsgi@migration-webapp" state=restarted + +- name: restart uwsgi instance protokollsystem uwsgi + service: name="uwsgi@protokollsystem" state=restarted + listen: "restart uwsgi instance protokollsystem" + +- name: restart uwsgi instance protokollsystem celery + service: name="protokollsystem-celery" state=restarted + listen: "restart uwsgi instance protokollsystem" diff --git a/uwsgi-python/tasks/apps/protokollsystem.yml b/uwsgi-python/tasks/apps/protokollsystem.yml new file mode 100644 index 0000000000000000000000000000000000000000..ec6616225eb40162267959e2791513d1a4ddca63 --- /dev/null +++ b/uwsgi-python/tasks/apps/protokollsystem.yml @@ -0,0 +1,57 @@ +--- +# file: protokollsystem/tasks/main.yml + +- name: check our config + command: "{{app_path}/bin/python {{app_path}}/configproxy.py check --log-level warning" + args: + chdir: "{{app_path}}" + become: yes + become_user: "{{app_user}}" + changed_when: no + +- name: ensure data model upgrades are applied + command: "{{app_path}}/bin/python {{app_path}}/server.py db upgrade" + args: + chdir: "{{app_path}}" + become: yes + become_user: "{{app_user}}" + notify: + - "restart uwsgi instance {{app.instance}}" + +- name: ensure we have our local templates + copy: + src: "{{ protokolle_local_templates }}" + dest: "{{ app_path }}/" + owner: "{{ protokolle_user }}" + group: "{{ protokolle_group }}" + mode: 0644 + when: protokolle_local_templates|default('') != '' + notify: + - "restart uwsgi instance {{app.instance}}" + +- name: ensure one local template is the default + file: + src: "{{ app_path }}/{{ protokolle_latex_local_templates }}/{{ protokolle_local_templates_default }}/{{ item.path }}" + dest: "{{ app_path }}/{{ protokolle_latex_local_templates }}/{{ item.path }}" + state: link + with_filetree: "{{ protokolle_local_templates }}/{{ protokolle_local_templates_default }}" + when: protokolle_local_templates|default(False) and protokolle_local_templates_default|default(False) + notify: + - "restart uwsgi instance {{app.instance}}" + +- name: ensure the celery unit file exists + template: + src: celery.service.j2 + dest: "/etc/systemd/system/{{ app_name }}-celery.service" + owner: root + group: root + mode: 0644 + notify: + - reload systemd service files + - "restart uwsgi instance {{app.instance}}" + +- name: ensure the celery service is enabled + service: + name: "{{app_name}}-celery" + enabled: yes + state: started diff --git a/uwsgi-python/templates/apps/protokollsystem.j2 b/uwsgi-python/templates/apps/protokollsystem.j2 new file mode 100644 index 0000000000000000000000000000000000000000..7ccec5d4081cc181d35b00ca62d52de4e637cbf1 --- /dev/null +++ b/uwsgi-python/templates/apps/protokollsystem.j2 @@ -0,0 +1,242 @@ +SQLALCHEMY_DATABASE_URI = "postgresql://{{app_user}}:@/{{app_name}}" +SQLALCHEMY_TRACK_MODIFICATIONS = False + +from secret_config import secret_key as SECRET_KEY, security_key as SECURITY_KEY + +DEBUG = False + +MAIL_ACTIVE = {{ protokolle_mail }} +MAIL_FROM = "{{ protokolle_mail_from }}" +MAIL_HOST = "{{ protokolle_mail_host }}" +MAIL_USER = "{{ protokolle_mail_user }}" +MAIL_PASSWORD = "{{ protokolle_mail_password }}" +{% if protokolle_mail_tls == 'tls' %} +MAIL_USE_TLS = True +MAIL_USE_STARTTLS = False +{% elif protokolle_mail_tls == 'starttls' %} +MAIL_USE_TLS = False +MAIL_USE_STARTTLS = True +{% else %} +MAIL_USE_TLS = False +MAIL_USE_STARTTLS = False +{% endif %} + +CELERY_BROKER_URL = "{{ protokolle_celery_broker }}" +CELERY_TASK_SERIALIZER = "pickle" +CELERY_ACCEPT_CONTENT = ["pickle"] + +{% if protokolle_sentry_dsn is defined %} +SENTRY_DSN = "{{protokolle_sentry_dsn}}" +{% endif %} + +SERVER_NAME = "{{ protokolle_url_root }}" +PREFERRED_URL_SCHEME = "{{ protokolle_url_proto }}" +URL_ROOT = "{{ protokolle_url_root }}" +URL_PROTO = "{{ protokolle_url_proto }}" +URL_PATH = "{{ protokolle_url_path }}" +URL_PARAMS = "" + +PRINTING_ACTIVE = {{ protokolle_printing }} +PRINTING_SERVER = "{{ protokolle_printing_server }}" +PRINTING_USER = "{{ protokolle_printing_user }}" +PRINTING_PRINTERS = { +{% for p in protokolle_printing_printers %} + "{{ p.printer }}": [ +{% for o in p.options %} + "{{ o }}", +{% endfor %} + ], +{% endfor %} +} + +ETHERPAD_ACTIVE = {{ protokolle_etherpad }} +ETHERPAD_URL = "{{ protokolle_etherpad_url }}" +EMPTY_ETHERPAD = """Welcome to Etherpad! + +This pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents! + +Get involved with Etherpad at http://etherpad.org + +""" + +WIKI_ACTIVE = {{ protokolle_wiki }} +WIKI_TYPE = "{{ protokolle_wiki_type }}" +WIKI_API_URL = "{{ protokolle_wiki_api }}" +WIKI_ANONYMOUS = {{ protokolle_wiki_anonymous }} +WIKI_USER = "{{ protokolle_wiki_user }}" +WIKI_PASSWORD = "{{ protokolle_wiki_password }}" +WIKI_DOMAIN = "{{ protokolle_wiki_domain }}" + +CALENDAR_ACTIVE = {{ protokolle_calendar }} +CALENDAR_URL = "{{ protokolle_calendar_url }}" +CALENDAR_DEFAULT_DURATION = 3 +CALENDAR_MAX_REQUESTS = 10 +CALENDAR_TIMEZONE_MAP = { + "CET": "Europe/Berlin", + "CEST": "Europe/Berlin", +} + +SESSION_PROTECTION = "strong" + +SECURITY_KEY = "{{ protokolle_security_key }}" +from common.auth import LdapManager, ADManager +AUTH_MAX_DURATION = {{ protokolle_auth_max_duration }} +AUTH_BACKENDS = [ +{% for auth in protokolle_auth_backends %} + {{ auth.type }}( + {% if auth.host is defined %} + host="{{ auth.host }}", + {% elif auth.hosts is defined %} + host=( + {% for host in auth.hosts %} + "{{host}}", + {% endfor %} + ) + {% endif %} + domain="{{ auth.domain }}", + user_dn="{{ auth.user_dn }}", + group_dn="{{ auth.group_dn }}", + ca_cert="{{ auth.ca_cert }}"), +{% endfor %} +] + +OBSOLETION_WARNING = "{{ protokolle_auth_obsoletion_warning }}" + +ERROR_CONTEXT_LINES = 3 + +PAGE_LENGTH = 20 +PAGE_DIFF = 3 + +MAX_INDEX_DAYS = 14 +MAX_PAST_INDEX_DAYS = 2 +MAX_PAST_INDEX_DAYS_BEFORE_REMINDER = 14 + +HTML_LEVEL_OFFSET = 3 + +ADMIN_MAIL = "{{ protokolle_admin_mail }}" +ADMIN_GROUP = "{{ protokolle_admin_group }}" + +PARSER_LAZY = False + +FUZZY_MIN_SCORE = 90 + +{# +FONTS = { + "main": { + "extension": ".otf", + "path": "/usr/share/fonts/OTF/", + "regular": "NimbusSans-Regular", + "bold": "NimbusSans-Bold", + "italic": "NimbusSans-Oblique", + "bolditalic": "NimbusSans-BoldOblique" + }, + "roman": { + "extension": ".otf", + "path": "/usr/share/fonts/OTF/", + "regular": "NimbusRoman-Regular", + "bold": "NimbusRoman-Bold", + "italic": "NimbusRoman-Italic", + "bolditalic": "NimbusRoman-BoldItalic" + }, + "sans": { + "extension": ".otf", + "path": "/usr/share/fonts/OTF/", + "regular": "NimbusSans-Regular", + "bold": "NimbusSans-Bold", + "italic": "NimbusSans-Oblique", + "bolditalic": "NimbusSans-BoldOblique" + }, + "mono": { + "extension": ".otf", + "path": "/usr/share/fonts/OTF/", + "regular": "NimbusMonoPS-Regular", + "bold": "NimbusMonoPS-Bold", + "italic": "NimbusMonoPS-Italic", + "bolditalic": "NimbusMonoPS-BoldItalic" + } +} +#} + +FONTS = { + "main": { + "extension": ".pfb", + "path": "/usr/share/fonts/type1/gsfonts/", + "regular": "n019003l", + "bold": "n019004l", + "italic": "n019023l", + "bolditalic": "n019024l" + }, + "roman": { + "extension": ".pfb", + "path": "/usr/share/fonts/type1/gsfonts/", + "regular": "n021003l", + "bold": "n021004l", + "italic": "n021023l", + "bolditalic": "n021024l" + }, + "sans": { + "extension": ".pfb", + "path": "/usr/share/fonts/type1/gsfonts/", + "regular": "n019003l", + "bold": "n019004l", + "italic": "n019023l", + "bolditalic": "n019024l" + }, + "mono": { + "extension": ".pfb", + "path": "/usr/share/fonts/type1/gsfonts/", + "regular": "n022003l", + "bold": "n022004l", + "italic": "n022023l", + "bolditalic": "n022024l" + } +} + +DOCUMENTS_PATH = "documents" + +PRIVATE_KEYWORDS = ["private", "internal", "privat", "intern"] + +LATEX_BULLETPOINTS = [ + r"\textbullet", + r"\normalfont \bfseries \textendash", + r"$\circ$", + r"\textperiodcentered" +] + +{% if protokolle_latex_local_templates %} +LATEX_LOCAL_TEMPLATES = "{{ protokolle_latex_local_templates }}" +{% endif %} +{% if protokolle_latex_logo_template %} +LATEX_LOGO_TEMPLATE = "{{ protokolle_latex_logo_template }}" +{% endif %} +{% if protokolle_latex_geometry %} +LATEX_GEOMETRY = "{{ protokolle_latex_geometry }}" +{% endif %} +{% if protokolle_latex_pagestyle %} +LATEX_PAGESTYLE = "{{ protokolle_latex_pagestyle }}" +{% endif %} +{% if protokolle_latex_packages %} +LATEX_ADDITIONAL_PACKAGES = ["{{ protokolle_latex_packages|join('", "') }}"] +{% endif %} +{% if protokolle_latex_header_footer %} +LATEX_HEADER_FOOTER = True +{% elif protokolle_latex_header_footer == False %} +LATEX_HEADER_FOOTER = False +{% endif %} + +LATEX_TEMPLATES = { +{% for logo in protokolle_logos %} + "{{ logo.id }}": { + "name": "{{ logo.name }}", + "logo": "{{ logo.tex }}", + }, +{% endfor %} +} + +#def dummy_todomail_provider(): +# return {"example": ("Name", "mail@example.com")} +# +#ADDITIONAL_TODOMAIL_PROVIDERS = [ +# dummy_todomail_provider +#] + diff --git a/uwsgi-python/vars/protokollsystem.yml b/uwsgi-python/vars/protokollsystem.yml new file mode 100644 index 0000000000000000000000000000000000000000..d98b12542fb41ecad61eeae6773bffa0d9b6b6a0 --- /dev/null +++ b/uwsgi-python/vars/protokollsystem.yml @@ -0,0 +1,35 @@ +app_name: protokollsystem +app_user: protokolle +app_group: protokolle +app_home: /var/www/protokollsystem +app_path: /var/www/protokollsystem/program +app_python_version: 3 +app_mules: 1 +app_enable_threads: true +app_venv: /var/www/protokollsystem/program/ +app_program: server.py +app_callable: app +app_command: "" +app_mountpoint: / + +app_db_name: protokollsystem +app_db_type: postgres + +app_additional_software: + - "libxml2-dev" + - "libxslt-dev" + - "fontconfig" + - "tex-gyre" + +app_deploy_key: "{{ inventory_dir }}/files/deploy-keys/protokollsystem" +app_git_url: "git@git.fsmpi.rwth-aachen.de:protokollsystem/proto3.git" +app_git_version: HEAD + +app_config_file: config.py +app_secret_config: true +app_secret_config_keys: ["security_key"] + +protokolle_celery_broker: 'redis://localhost:6379/0' +protokolle_celery_concurrency: 4 + +protokolle_sentry_dsn: "https://3bbe6efca11645488bc1fb7297013e3a:4747c40e928d401e8e5e9aac49d3b42d@sentry.fsmpi.rwth-aachen.de//4"