djangonaut-space / wagtail-indymeet

Djangonaut Space site
MIT License
14 stars 11 forks source link

feat: Add django-post_office for mail queueing #359

Closed sakhawy closed 6 months ago

sakhawy commented 6 months ago

312

sarahboyce commented 6 months ago

Sorry Moe I just merged a dependabot so this needs a rebase/conflict resolution ❤️

This looks good, we either need celery or something similar set up (https://github.com/djangonaut-space/wagtail-indymeet/issues/270) or a cron job (https://github.com/ui/django-post_office?tab=readme-ov-file#quickstart) in order to send these emails. I think we haven't quite figured out how to do this yet 🤔 (cc: @dawnwages @tim-schilling)

sakhawy commented 6 months ago

I tried to hack my way through with supervisord :smile:

[program:post_office_send_queued_mail]
command=bash -c 'python /app/manage.py send_queued_mail && sleep 30'
autorestart=true

[program:post_office_cleanup_mail]
command=bash -c 'python /app/manage.py python manage.py cleanup_mail --days=30 --delete-attachments && sleep 86400'
autorestart=true
tim-schilling commented 6 months ago

@sakhawy how much testing of that hack did you do? Is it something we can merge and go, or do I need to do some verification when it gets pushed to staging?

sakhawy commented 6 months ago

Here's how I tested it:

I'd say some verification is needed just to make sure.

tim-schilling commented 6 months ago

I changed it to default the production setting in base.py and override in dev rather than production.

tim-schilling commented 6 months ago

Thanks @sakhawy!

sarahboyce commented 6 months ago

We're no longer sending emails on staging

@sakhawy if it helps, the docker configuration is just to aid local setup. We're not deploying this image

sakhawy commented 6 months ago

Thanks @sarahboyce! Yeah, I was just trying to emulate supervisord running management commands periodically on startup.