ftracker/README.md

133 lines
3.5 KiB
Markdown
Raw Normal View History

2020-12-05 16:21:21 +01:00
# FaSTTUBe Corona Tracker
2020-11-24 20:46:30 +01:00
2020-12-03 21:33:23 +01:00
Small webapp to track who was in which room at which time to backtrace
potential viral infections.
2020-11-24 21:17:54 +01:00
2020-12-05 16:21:21 +01:00
For Ideas, Progress, and Bugs visit
[Issues](https://git.fasttube.de/FaSTTUBe/ftracker/issues).
2020-11-24 22:50:17 +01:00
2020-12-03 21:32:49 +01:00
## Requirements
- Unixoid system (linux, BSD, macOS). Windows might also work.
- `python` 3.6+ (might be `python3` on your system)
- `pip` for python 3+ (might be `pip3` on your system)
## How to run
2020-12-05 16:21:21 +01:00
(Dev setup, for prod deployment see below)
```bash
# clone, cd into repo
2020-12-03 21:32:49 +01:00
pip install -e .
python3 -m ftracker
```
2020-12-03 21:32:49 +01:00
Edit `config.ini` to tune your installation.
2020-12-05 16:21:21 +01:00
Then, point your browser at <http://localhost:5000/>.
2020-12-03 21:32:49 +01:00
## Installation/Deployment
2020-12-07 14:22:47 +01:00
There are 2 methods: Docker and Manual.
2020-12-03 21:32:49 +01:00
2020-12-07 14:22:47 +01:00
### Method A: Docker
2020-12-07 17:46:50 +01:00
Pull the container from docker hub using
```bash
2020-12-07 17:46:50 +01:00
sudo docker pull fasttube/ftracker
```
OR build the container locally with
```bash
sudo docker build . -t fasttube/ftracker
```
Then, if you want the container to also handle SSL so it can run standalone you
need to pass it a domain and Email so it can obtain a certificate from `Let's
encrypt`:
2020-12-07 14:22:47 +01:00
```bash
sudo docker run \
2020-12-07 17:46:50 +01:00
-it --rm \
2020-12-07 14:22:47 +01:00
--name ftracker \
-e DOMAIN=example.com \
-e LE_EMAIL=admin@example.com \
2020-12-07 14:22:47 +01:00
-p 80:80 \
-p 443:443 \
2020-12-07 14:22:47 +01:00
-v /your/full/path/to/config.ini:/etc/ftracker/config.ini \
2020-12-07 17:46:50 +01:00
fasttube/ftracker
2020-12-07 14:22:47 +01:00
```
Otherwise you can run it without SSL (maybe behind your own web+ssl server)
using just
2020-12-07 14:22:47 +01:00
```bash
sudo docker run \
2020-12-07 17:46:50 +01:00
-it --rm \
2020-12-07 14:22:47 +01:00
--name ftracker \
-p 80:80 \
-v /your/full/path/to/config.ini:/etc/ftracker/config.ini \
2020-12-07 17:46:50 +01:00
fasttube/ftracker
2020-12-07 14:22:47 +01:00
```
2020-12-07 17:46:50 +01:00
If those work in the foreground and averything looks okay, you can start them
without `-it --rm` and with `-d` instead to run them in the background.
To stop/start/uninstall the container afterwards, run:
2020-12-07 14:22:47 +01:00
```bash
docker stop ftracker # might take up to 10 seconds
docker start ftracker # continue runniing
docker rm -f ftracker # uninstall
2020-12-07 14:22:47 +01:00
```
### Method B: Manual
#### 1. FTracker Backend
Install backend system wide:
2020-12-03 21:32:49 +01:00
```bash
# clone, cd into repo
2020-12-07 14:22:47 +01:00
sudo -H pip install . # Use -e if you want to hack on the backend while installed.
2020-12-03 21:32:49 +01:00
```
2020-12-07 14:22:47 +01:00
#### 2. WSGI Server + Service file
2020-12-03 21:32:49 +01:00
You need a WSGI Middleware (using `Flask`'s included `werkzeug` is discouraged
2020-12-05 16:21:21 +01:00
for production environments). I recommend `uwsgi` since it's flexible, fast and
has `nginx` integration. A sample configuration file as well as service
description files for both `systemd` and `rc` are included in `res/` for you to
adapt (file paths etc.) and install to your system (The `systemd` service file
still untested though, feel free to leave feedback).
2020-12-03 21:32:49 +01:00
2020-12-07 14:22:47 +01:00
#### 3. Webserver
2020-12-03 21:32:49 +01:00
You need a webserver. I recommend `nginx` because it's the industry standard
2020-12-05 16:21:21 +01:00
and fast. A sample config file is included in `res/` for you to adapt (domain,
SSL certs) and install to your system. The configuration should include:
Webroot in `web/` with a fallback to the WSGI handler for the backend.
2020-12-03 21:32:49 +01:00
Enabling SSL (https) and redirecting http to https is strongly encouraged, i
2020-12-05 16:21:21 +01:00
recommend using `Let's Encrypt`'s `certbot` to easily obtain certificates.
2020-12-03 21:32:49 +01:00
2020-12-07 14:22:47 +01:00
#### 4. Customization
2020-12-03 21:32:49 +01:00
Edit `config.ini` to your liking. Restart the backend by restarting the `uwsgi`
service, e.g. `sudo systemctl restart ftracker` or `sudo service ftracker
restart`
2020-12-05 19:26:02 +01:00
## Open Sources
This project uses the `QRCode.js` library (Copyright (C) 2012 davidshimjs)
licensed under the MIT License, see `web/qrcodejs/LICENSE`. Thanks!
## License
2020-12-05 19:26:02 +01:00
FTracker is licensed under the GNU GPL v3 license, see
2020-12-03 21:33:23 +01:00
[LICENSE.md](https://git.fasttube.de/FaSTTUBe/ft-corona-tracker/src/branch/master/LICENSE.md)
for details.
2020-11-24 22:41:26 +01:00
Copyright (C) 2020 Oskar/FaSTTUBe