Closed Bug 1192052 Opened 9 years ago Closed 9 years ago

[Air Mozilla] dev server unable to write out sent emails

Categories

(Infrastructure & Operations :: IT-Managed Tools, task)

task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: peterbe, Assigned: cliang)

Details

(Whiteboard: [kanban:https://webops.kanbanize.com/ctrl_board/2/1524] )

On the dev server we have configured the email sending backend to instead write to a static directory that is then accessible by apache viewing so you can see what emails *would* have been sent if it was sent to an SMTP server or something. 

This has stopped working in the new dev server.

Failed to send about <Event: Ma Face>
  File "/data/python-dev/src/air-dev.allizom.org/air/airmozilla/new/eventemails.py", line 43, in send_new_event_emails
    sending.send_about_new_event(event)
  File "/data/python-dev/src/air-dev.allizom.org/air/airmozilla/new/sending.py", line 56, in send_about_new_event
    email.send()
  File "/data/python-dev/src/air-dev.allizom.org/venv/lib/python2.6/site-packages/django/core/mail/message.py", line 276, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "/data/python-dev/src/air-dev.allizom.org/venv/lib/python2.6/site-packages/django/core/mail/message.py", line 237, in get_connection
    self.connection = get_connection(fail_silently=fail_silently)
  File "/data/python-dev/src/air-dev.allizom.org/venv/lib/python2.6/site-packages/django/core/mail/__init__.py", line 30, in get_connection
    return klass(fail_silently=fail_silently, **kwds)
  File "/data/python-dev/src/air-dev.allizom.org/venv/lib/python2.6/site-packages/django/core/mail/backends/filebased.py", line 30, in __init__
    raise ImproperlyConfigured('Could not create directory for saving email messages: %s (%s)' % (self.file_path, err))
ImproperlyConfigured: Could not create directory for saving email messages: /data/www/air-dev.allizom.org/air/media/emails ([Errno 13] Permission denied: '/data/www')
Whiteboard: [kanban:https://webops.kanbanize.com/ctrl_board/2/1524]
Is the email supposed to be generated by code running on the Air Mozilla web heads?  Or some other component (like a job invoked by manage.py / django-admin)?

I ask because the presence of "/data/python-dev/src/air-dev.allizom.org" in the traceback implies that this is being run on the admin node.  On that node, there is no /data/www/ directory, which is why writing a message to /data/www/air-dev.allizom.org/air/media/emails would fail.

That directory definitely does on the -dev web head and Apache can write to it. [1]  

[1] [cliang@python1.dev.webapp.phx1 ~]$ ls -lad /data/www/air-dev.allizom.org/air/media/emails
drwxrwxrwx 2 apache apache 20480 Aug  7 21:47 /data/www/air-dev.allizom.org/air/media/emails
Before we only sent emails from the webheads. I.e. as part of a request/response cycle. 
These emails do get sent from a cron job. 

Would it be possible to change things so that they both write to the same destination? Do they have any shared filesystem?
Assignee: server-ops-webops → cliang
The file system that's mounted as /data/www/air-dev.allizom.org/air/media on the webheads is *already* mounted on the admin node under a different file path.  As an experiment, I've changed the EMAIL_FILE_PATH in the local settings file to reflect the underlying file mount, which is present on both the admin node and the web-heads.  Can you please test and let me know if it works?
Emails from the admin node works
https://air-dev.allizom.org/media/emails/20150811-213018-75028688.log
And it works from the webheads too
https://air-dev.allizom.org/media/emails/20150811-213605-140507209849616.log

YAY!

Thanks for being awesome!
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.