feat: add gotify notification server

This commit is contained in:
Julian Lobbes 2023-07-27 13:29:32 +02:00
parent dfec5baeeb
commit b208631d64
4 changed files with 33 additions and 3 deletions

4
.env
View File

@ -1,6 +1,8 @@
TIMEZONE=Europe/Berlin
PG_NAME=medwings
PG_USER=medwings
PG_PASSWORD=medwings
PG_HOST=medwings-postgres
PG_PORT=5432
TIMEZONE=Europe/Berlin
GOTIFY_USER=gotify
GOTIFY_PASSWORD=gotify

3
.gitignore vendored
View File

@ -5,8 +5,9 @@
/app/.venv/
/node_modules/
# Local development database
# Local development data
/.postgres/
/.gotify/
# Cache files and directories
**/*.pyc

View File

@ -77,6 +77,18 @@ To enter django's interactive shell, run:
sudo docker exec -it medwings-django python manage.py shell
```
## Notification server
Steps to create a new user's channel on gotify:
1. Using admin credentials in basic auth, create a new gotify user with the django user's credentials.
2. Save the user's id in the DB.
3. Using the user's credentials in basic auth, create a new gotify application called `Medwings`.
4. Save the application token and application id in the DB.
5. Optional: upload an application picture to make the notifications look a bit nicer
6. Pushing notifications to this user now works as follows: `curl "https://medwings.com/message?token=<app token>" -F "title=Time for a measurement." -F "message=Bla bla."`
# Deployment
This section is incomplete.

View File

@ -59,6 +59,21 @@ services:
POSTGRES_USER: ${PG_USER}
POSTGRES_PASSWORD: ${PG_PASSWORD}
TZ: ${TIMEZONE}
medwings-gotify:
image: gotify/server
container_name: medwings-gotify
restart: unless-stopped
depends_on:
- medwings-postgres
ports:
- "8001:80"
volumes:
- ./.gotify:/app/data
environment:
TZ: ${TIMEZONE}
GOTIFY_SERVER_SSL_REDIRECTTOHTTPS: false
GOTIFY_DEFAULTUSER_NAME: ${GOTIFY_USER}
GOTIFY_DEFAULTUSER_PASS: ${GOTIFY_PASSWORD}
medwings-pgweb:
image: sosedoff/pgweb
container_name: medwings-pgweb
@ -66,7 +81,7 @@ services:
depends_on:
- medwings-postgres
ports:
- "8001:8081"
- "8002:8081"
environment:
PGWEB_DATABASE_URL: postgres://${PG_USER}:${PG_PASSWORD}@${PG_HOST}:${PG_PORT}/${PG_NAME}?sslmode=disable
TZ: ${TIMEZONE}