[SCHEMA] Migration for easeventuid.

Summary:
Note this does not include a script to backfill the table
for existing events.

Also note this does not include the msg_uid index because we don't need it
(will update code too).

Test Plan: Run it, visually inspect.

Reviewers: emfree

Reviewed By: emfree

Differential Revision: https://review.inboxapp.com/D874
make default test event local, since remote ones suppress transactions
Handle spurious UIDVALIDITY changes in generic IMAP.

Summary:
We're actually seeing this in the wild. We still can't do a full resync, but at
least this keeps syncs from getting totally stuck in the face of flaky
UIDVALIDITY responses.

Test Plan:
Poison sync logic to sporadically raise UidInvalid, check that
sync cleanly enters and exits uidinvalid state.

Reviewers: siro, spang

Reviewed By: spang

Differential Revision: https://review.inboxapp.com/D876
fix TypeError
Import SearchIndexCursor model too.
Optimize search time format conversion

Summary: Convert datetime to Unix timestamp at index-time rather than at search result processing.

Test Plan: Tested manually.

Reviewers: emfree

Reviewed By: emfree

Differential Revision: https://review.inboxapp.com/D877
Allow account-restricted checks with bin/inbox-syncstatus.
Improve setup.sh to avoid installing software in production.
Overhaul IMAP draft deletion.

Summary:
Basically, in order to do away with soft-deletes we have to restructure
syncback actions such that the syncback service doesn't need to access database
objects that have been legitimately deleted. So we need a strategy for deleting
drafts that were created on the remote (and hence have no X-Inbox-Id header).
Previously we'd delete the entire thread (!), which in any case is definitely
not what we want to do. Now we instead just use either the X-Inbox-Id header or
the Message-Id header to locate the message on the remote.

(This is a prerequisite to fixing T666.)

Test Plan: All manual for now.

Reviewers: kav-ya

Reviewed By: kav-ya

Differential Revision: https://review.inboxapp.com/D881
Dockerfile path fixes
Missing import
Docker entrypoint must be run as root
Don't sync the Gmail Inbox folder.

Summary:
Now that we correctly sync X-GM-LABELS and can quickly fetch changed UIDs for a
given HIGHESTMODSEQ value, we don't actually need to sync the Gmail Inbox
folder separately. This lets us use fewer IMAP connections, generally
removes much complexity, and improves sync performance.

We still order the uid download stack in initial sync such that threads in the
inbox get downloaded first.

Test Plan: Run sync. Watch sync run. Run, sync, run!

Reviewers: khamidou, spang

Reviewed By: spang

Differential Revision: https://review.inboxapp.com/D889
Also remove Gmail inbox syncs from Redis.

Otherwise account sync heartbeat logic gets confused.
Change exception handling in inbox.status.

Summary: This revision makes exception handling more "Pythonic".

Test Plan: Test with unicode string in /etc/inboxapp/config.json.

Reviewers: khamidou

Reviewed By: khamidou

Differential Revision: https://review.inboxapp.com/D899
Merge pull request #109 from aidanhs/docker-fixes

Assorted fixes for running in docker
Remove soft-delete mechanism.

Summary:
We weren't using it for any real purpose, and it tended just to complicate
queries and reasoning about relationships. In particular, drafts may be
soft-deleted via the API, which can cause major problems during IMAP sync
(where soft deletes are ignored).

* Syncing back deleted objects (drafts and events, currently) has to work
  without access to the object itself (because the object is deleted for real).
* Some relationships now require `passive_deletes=True` to be configured in
  order for database-level delete cascades to work properly.
* `session_scope()` and `InboxSession()` still accept an `ignore_soft_deletes`
  argument so that client code doesn't need to be updated immediately. This
  argument does nothing, and can be removed once all client code is updated.

Depends on D881.

Test Plan:
Run unit tests; should run on staging for a bit to shake out any
lingering issues.

Reviewers: kav-ya, spang

Reviewed By: kav-ya, spang

Differential Revision: https://review.inboxapp.com/D882
Tests log to a different log directory.
Add support for SMTP-over-SSL.

Summary:
This is needed to support some backends (looking at you, GoDaddy) that don't
support STARTTLS. We just see if the port is 465, and use smtplib.SMTP_SSL
instead of smtplib.SMTP if so.

Fixes T661.

Test Plan:
Basic unit test added. Manually check that sending works via either
mechanism on backends that support both.

Reviewers: spang, kav-ya

Reviewed By: kav-ya

Maniphest Tasks: T661

Differential Revision: https://review.inboxapp.com/D905
Use port 465, not 587, for godaddy SMTP.

Since they support neither SMTP message submission on port 587 per RFC2476, nor
STARTTLS on port 25 as far as we can tell, SMTP-over-SSL it is.