From 8da575c31b91522f0f79235647b47732b55e35dd Mon Sep 17 00:00:00 2001 From: Timothy Hobbs Date: Mon, 25 Sep 2023 22:30:51 +0200 Subject: [PATCH] Add support for SES --- standalone/README.md | 24 +++++++++++++++++++++++- standalone/entrypoint.sh | 5 +++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/standalone/README.md b/standalone/README.md index 6ccf34ec..097257e9 100644 --- a/standalone/README.md +++ b/standalone/README.md @@ -9,7 +9,7 @@ To install run `setup.sh` and then `docker-compose up` in this directory. To create an admin user exec into the newly created container docker ps - docker exec -it standalone-web-1 bash + docker exec -it standalone-django-helpdesk-1 bash In the container cd to `/opt/django-helpdesk/standalone` and run @@ -38,3 +38,25 @@ You can change the logo at the top left of the helpdesk by bindmounting a file } ``` + +Here is an example `local_settings` file for using AWS SES for sending emails: + +``` +import os + +DEFAULT_FROM_EMAIL = "support@bitswan.space" +SERVER_EMAIL = "support@bitswan.space" +AWS_ACCESS_KEY_ID = os.environ.get("AWS_ACCESS_KEY_ID") +EMAIL_BACKEND = "django_ses.SESBackend" +AWS_SES_REGION_NAME = "eu-west-1" +AWS_SES_REGION_ENDPOINT = "email.eu-west-1.amazonaws.com" +AWS_SECRET_ACCESS_KEY = os.environ.get("AWS_SECRET_ACCESS_KEY") +``` + +In this case you'll also have to bindmout a file to `/opt/extra-dependencies.txt` with the contents: + +``` +django-ses +``` + +You would of course also have to edit docker.env to add your secrets. diff --git a/standalone/entrypoint.sh b/standalone/entrypoint.sh index 26719cf3..6d161e1d 100644 --- a/standalone/entrypoint.sh +++ b/standalone/entrypoint.sh @@ -1,4 +1,9 @@ #!/bin/bash +# Install extra deps from /opt/extra-deps.txt if it exists +if [ -f /opt/extra-dependencies.txt ]; then + pip install -r /opt/extra-dependencies.txt +fi + cd /opt/django-helpdesk/standalone/ if python manage.py showmigrations | grep '\[ \]\|^[a-z]' | grep '[ ]' -B 1; then python manage.py migrate --noinput # Apply database migrations