Tracing service for the TU Wien Space Team and TU Wien Racing Team.
- Login with Space / Racing Team Google account (SAML).
- Decode and verify EU Digital COVID Certificates
- Upload certificates as PDF or Image.
- Export contacts in day range
- Smart Export by defining time range and person.
You can either set up the environment yourself or use the VSCode Docker environment. Some dependencies, such as zbar
, are platform-specific and therefore cause potential installation issues (e.g. on Windows and Mac M1 Apple Silicon). With the Docker VSCode setup, you should not encounter such issues.
-
Install Python3.8 (or higher),
zbar
,popper
,libxml2
-
Install all dependencies with:
python3 -m venv venv source venv/bin/activate pip install -r requirements.txt
-
Setup the config by copying
instance/config_example.toml
toinstance/config.toml
and editing the new config (the comments in the file will guide you). -
Start the server with:
export FLASK_APP=space_trace FLASK_ENV=development flask run
This launces a simple webserver which can only be accessed from the localhost.
Note: Don't use this server in production, it is insecure and low performance.
The project has a VSCode remote container development environment, so you don't have to deal with platform-specific program installations.
- Open this project in VSCode
- Install the Remote-Containers extension
- Press
CMD + SHIFT + P
(macOS) orCTRL + SHIFT + P
(Linux & Windows) - Run
Remote-Containers: Rebuild and Reopen in Container
- Setup the config by copying
instance/config_example.toml
toinstance/config.toml
and editing the new config (the comments in the file will guide you). - Run
flask run
in container
The login does not work in the development environment as SAML would redirect
to the production service. To work around this limitation you can can visit
/login-debug
which will log you in as the user defined by the DEBUG_EMAIL
key in the config.toml
. However this, only works when FLASK_ENV=development
.
Be sure to also add that email to the ADMINS
list if you want to test the admin
interface, and if you want to test certificate upload the email must be in the
format: <firstname>.<lastname>@<anydomain>
because the service will verify
with the email that the certificate belongs to the user that uploaded it.
In the development environment the templates are hot reloadable, as is the
python backend, however editing config.toml
requires a restart.
- Use
black
to format code - Try to follow the python style guide PEP 8
- Run all tests before committing with:
python3 -m pytest
How we deploy this app on Ubuntu.
Install the requirements with:
sudo apt -y install python3-venv python3-pip libzbar0 libxml2-dev libxmlsec1-dev libxmlsec1-openssl poppler-utils
Create a virtual env with:
python3 -m venv venv
Copy instance/config_example.toml
to instance/config.toml
and edit all
the fields in it.
Clone instance/saml_example
into instance/saml_st
and instance/saml_rt
and fill out your SAML configuration. For saml we use the python library
python3-saml and documentation to
setup SAML can be found here.
Open space-trace.service
and edit the username and all paths to the working
directory.
Start the systemd service with:
sudo cp space-trace.service /etc/systemd/system
sudo systemctl daemon-reload
sudo systemctl enable space-trace.service
sudo systemctl start space-trace.service
The service should now be up and running 🎉
To stop the service run:
sudo systemctl stop space-trace.service
To update the service to a new version (commit) run:
git pull
sudo systemctl restart space-trace.service
Some links I found helpful in dealing with the certificate: