diff --git a/.env b/.env index 34552b3..beb5120 100644 --- a/.env +++ b/.env @@ -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 diff --git a/.gitignore b/.gitignore index 23c7a86..7c81190 100644 --- a/.gitignore +++ b/.gitignore @@ -5,8 +5,9 @@ /app/.venv/ /node_modules/ -# Local development database +# Local development data /.postgres/ +/.gotify/ # Cache files and directories **/*.pyc diff --git a/README.md b/README.md index 73bd108..2aa9952 100644 --- a/README.md +++ b/README.md @@ -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=" -F "title=Time for a measurement." -F "message=Bla bla."` + + # Deployment This section is incomplete. diff --git a/development.docker-compose.yml b/development.docker-compose.yml index ee3e0ab..1aae4e1 100644 --- a/development.docker-compose.yml +++ b/development.docker-compose.yml @@ -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}