joeyates / imap-backup

Backup and Migrate IMAP Email Accounts
MIT License
1.33k stars 74 forks source link

imap-backup with email-oauth2-proxy support in a container #201

Open mcrosson opened 2 months ago

mcrosson commented 2 months ago

I recently figured out how to deploy imap-backup in a container with email-oauth2-proxy setup as a background support service. I personally use office365/gmail and wanted a good container setup to backup my emails. The linked gist has everything needed to extend the standard imap-backup container to include email-oauth2-proxy support. I've tested this setup with both gmail and office365 with great success.

Posted as a ticket as I'm unsure if this is something others may find useful and/or if it would be a candidate for inclusion in the imap-backup repo or docs.

https://gist.github.com/mcrosson/b54f3092cd0d262dd59f2336fb2f3474

joeyates commented 1 month ago

Thanks @mcrosson

This looks really interesting. I had been musing about how to ease the dual setup of imap-backup and email-oauth2-proxy and this looks like a good start.

I would imagine that this would become another container build that would be done on top of the existing "minimal" container

mcrosson commented 1 month ago

I have the setup running via cron and it's been quite stable. The only 'problem' is if you need to do a full auth for email-oauth2-proxy. The interactive bit it has on initial login needs an interactive terminal which kind of forces you to re-run the container interactively with email-oauth2-proxy as a foreground task to do the auth. Once the auth is good and not prompting, email-oauth2-proxy can be a background task (I used s6-overlay for this purpose).

I did set things up to extend the 'minimal container' and to preserve the environment vars that are needed by ruby for running imap-backup without ruby errors.

If you'd like I can pack up my code as a zip and post it here. The paths on the gist are a bit messy and deep due to the way s6-overlay works.