Webservices
Roles
-
acmetool
, manages let's encrypt certificates via acmetool -
debian-repository
, installs the software reprepro (very basic) -
lehrpreis
, teaching award nomination web app -
meckerkasten
, mimimi web app -
mediawiki
, setups mediawiki with php-fpm -
php-fpm
, setups php-fpm pools -
protokollsystem
, protocols, meetings, and everything management web app (TM) -
schildergenerator
, sign generator web app -
sentry
, error collection api and web app -
sso
, single signon web app -
uwsgi-php
, deprecated -
uwsgi-python
, unified web app deployment role for python-based web apps -
wahlhelfer
, setups wahlhelfer registration and scheduling web app -
wahlsystem
, setups an election management system -
webserver
, configures nginx -
wordpress
, setups wordpresses via an overlayfs technology
Note: Some roles are still undocumented.
uwsgi-python
The idea of the role is to have only one role for all the python-based web apps. Instead of a role (and group) for every single app. We distinguish between apps and instances. An app is the actual program, which can be instaciated more than once, which we call the instance.
The role iterates over the list webapps
(in the host vars) and import app and instance specific variable files.
An app specific task snippet is imported if it configured in the variable files (see below).
We place the instance specific variable file under <inventory_dir>/vars/.yml. The app specific variable file is <role_dir>/vars/.yml. In the latter file there should be sensible defaults for every variable used within the role.
This role needs the patch from this pull-request or ansible 2.6 or later.
Variables
-
app_name
: the name of the app -
app_user
: the user which runs the app---will be created -
app_group
: the user's group which runs the app---will be created -
app_home
: home directory of the user, usually/var/www/<app_user>
-
app_path
: the path where the program can be found, usually same asapp_home
-
app_python_version
: the app's python version as number (2|3) -
app_venv
: the absolut path to the virtualenv, which shall be used for the app -
app_program
: the python executable, which lies inapp_path
-
app_callable
: uwsgi variable , mostly app -
app_command
: commandline arguments for the app -
app_mountpoint
: the path in the URI, if the app shall be reachable under https://www.example.com/app, usually / -
app_db_name
: name of the db for the app, can be""
if not any database is needed, usally same asapp_user
-
app_db_type
: db type: (postgres|mysql|sqlite) -
app_additional_software
: list of software, which is additionally needed by the app e.g. LaTeX. If no additional software is needed it is[]
-
app_deploy_key
: path to a ssh-key which is needed to get the software usaally, "{{ inventory_dir }}/files/deploy-keys/<app_name>" -
app_git_url
: git url of the project -
app_git_version
: git version usuallyHEAD
-
app_config_file
: config file, usallyconfig.py
-
app_secret_config
: it might be useful to have the cookie's key in seperate config (true|false)
How to create a new app
Create the following files
-
uwsgi-python/vars/<app_name>.yml
Define the variable in it from above and the variables, you need for you config file. We recommend to define them as defaults (and as documentation) -
uwsgi-python/templates/apps/<app_name>.j2
That's your config template. -
uwsgi-python/tasks/apps/<app_name>.j2
If you need some additional tasks, you can define them in this file
If you have done this, you can create an instance of the app. Note, you have to define for every app an instance altough you only want to deploy it once.
How to create a new app's instance
Create for every instance <inventory_dir>/vars/<instance_name>.yml a variable in which you can override the defaults from uwsgi-python/vars/<app_name>.yml
Define in your host_vars/ the dictionary webapps
webapps:
- instance: <instancen_name>
app: <app_name>
app_vars: "<instance_name>.yml" <-- path to variable file from above
! Note, it very important, to add the handler
- name: restart uwsgi instance <instance_name> service: name="uwsgi@<instance_name>" state=restarted