bugzilla.mozilla.org has resumed normal operation. Attachments prior to 2014 will be unavailable for a few days. This is tracked in Bug 1475801.
Please report any other irregularities here.

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

RESOLVED FIXED

Status

Infrastructure & Operations
WebOps: IT-Managed Tools
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: peterbe, Assigned: cyliang)

Tracking

Details

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

(Reporter)

Description

3 years ago
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')

Updated

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

Comment 1

3 years ago
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
(Reporter)

Comment 2

3 years ago
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)

Updated

3 years ago
Assignee: server-ops-webops → cliang
(Assignee)

Comment 3

3 years ago
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?
(Reporter)

Comment 4

3 years ago
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
Last Resolved: 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.