diff --git a/uwsgi-python/tasks/apps/schrank-flask.yml b/uwsgi-python/tasks/apps/schrank-flask.yml new file mode 100644 index 0000000000000000000000000000000000000000..0b8e762675dcc0c0e18e64b9945e61c2d6754167 --- /dev/null +++ b/uwsgi-python/tasks/apps/schrank-flask.yml @@ -0,0 +1,40 @@ +--- + +# https://github.com/ansible/ansible/issues/42983 +- name: ensure there exists a .ansible folder + file: + path: "{{app_path}}/.ansible" + state: directory + owner: "{{app_user}}" + group: "{{app_group}}" + +- name: install pdf utils + apt: + name: poppler-utils + state: present + +- name: ensure data model upgrades are applied # noqa 301 + command: "{{app_venv}}/bin/flask db upgrade" + args: + chdir: "{{app_path}}" + environment: + FLASK_APP: "{{app_program}}" + become: true + become_user: "{{app_user}}" + notify: + - "restart uwsgi instance {{app.instance}}" + +- name: ensure there a directory for the documents + file: + path: "{{schrank_document_path}}" + state: directory + owner: "{{app_user}}" + group: "{{schrank_document_group}}" + mode: "{{schrank_document_permissions}}" + notify: + - "restart uwsgi instance {{app.instance}}" + +- name: ensure the folder from above is not present anymore + file: + path: "{{app_path}}/.ansible" + state: absent diff --git a/uwsgi-python/templates/apps/schrank-flask.j2 b/uwsgi-python/templates/apps/schrank-flask.j2 new file mode 100644 index 0000000000000000000000000000000000000000..2110a92f06425cbdb08e9028c3d20b574cd4959c --- /dev/null +++ b/uwsgi-python/templates/apps/schrank-flask.j2 @@ -0,0 +1,8 @@ +from secret_config import secret_key as SECRET_KEY + +SQLALCHEMY_DATABASE_URI = "postgresql://{{ app_user }}:@/{{ app_db_name }}" +SQLALCHEMY_TRACK_MODIFICATIONS = False + +DOCUMENT_PATH = "{{schrank_document_path}}" +SSO_URL = "{{schrank_sso_url}}" +SSO_GROUP = "{{schrank_sso_group}}" diff --git a/uwsgi-python/vars/schrank-flask.yml b/uwsgi-python/vars/schrank-flask.yml new file mode 100644 index 0000000000000000000000000000000000000000..ff17cca5c77200a1c71f9b7944019860139ed7a9 --- /dev/null +++ b/uwsgi-python/vars/schrank-flask.yml @@ -0,0 +1,17 @@ +--- + +app_name: schrank-flask +app_user: schrankweb +app_group: schrankweb +app_program: server.py + +app_db_name: schrank +app_db_type: postgres + +app_git_url: "git@git.fsmpi.rwth-aachen.de:fachschaft/schrank-web-flask.git" + +schrank_document_path: "{{app_path}}/documents" +schrank_document_group: schrank +schrank_document_permissions: "2750" +schrank_sso_url: "https://sso.fsmpi.rwth-aachen.de/" +schrank_sso_group: "fachschaft" diff --git a/uwsgi-python/vars/schrank.yml b/uwsgi-python/vars/schrank.yml deleted file mode 100644 index 84cf2b1e7bea1f1281ed55588e7471d99f44fdec..0000000000000000000000000000000000000000 --- a/uwsgi-python/vars/schrank.yml +++ /dev/null @@ -1,34 +0,0 @@ ---- - -app_name: schrank -app_user: schrankweb -app_group: schrankweb -app_home: /var/www/schrank -app_path: /var/www/schrank -app_python_version: 2 -app_venv: '' -app_program: main/wsgi.py -app_callable: application -app_command: '' -app_mountpoint: / -app_mules: 0 -app_enable_threads: false -app_uwsgi_options: [] -app_service_env: [] - -# There is a mysql database named schrank, but it is unmanaged by ansible. -app_db_type: '' -app_db_name: '' - -app_deploy_key: "{{ inventory_dir }}/files/deploy-keys/schrank" -app_git_url: "git@git.fsmpi.rwth-aachen.de:schrank/web.git" -app_git_version: HEAD - -# There is no requirements.txt file and no other documentation (e.g. venv) -# on needed software. The settings (including secret_key and db password) -# are also checked into the repository. -app_requirements_file: '' -app_config_file: '' -app_secret_config: false -app_secret_config_keys: [] -app_additional_software: []