guillaumeaubert / gmvault-docker

A Docker image that runs Gmvault on a regular basis, with both quick (daily) and full (weekly) synchronization schedules. Emails out sync reports through ssmtp.
https://hub.docker.com/r/aubertg/gmvault-docker/
MIT License
30 stars 30 forks source link

Question about the usage of some env variables #11

Open ovizii opened 1 year ago

ovizii commented 1 year ago

Does this look right inside my docker-compose.yml? Trying to use "-c no" so no emails will be deleted locally to create an email archive.

environment:
  - GMVAULT_OPTIONS="-c no --no-compression"

Is there an option to run a full sync with "-c yes" MANUALLY?

GMVAULT_SYNC_ON_STARTUP

What type of sync does this trigger? I assume it would do a "gmvault sync -t full" as that is the default? EDIT: I tested it and the sync on startup is a quick sync.

GMVAULT_QUICK_SYNC_SCHEDULE and GMVAULT_FULL_SYNC_SCHEDULE

What variables/form can this take? (Answered my own question after looking at Dockerfile. It takes standard cron expressions.)

    GMVAULT_FULL_SYNC_SCHEDULE="1 3 * * 0" \
    GMVAULT_QUICK_SYNC_SCHEDULE="1 2 * * 1-6" \

If I don't want to automatically run GMVAULT_FULL_SYNC_SCHEDULE, is there a more elegant manner than setting it to0 5 31 2 * “At 05:00 on day-of-month 31 in February.” which basically means never?

ovizii commented 1 year ago

Here is my commented docker-compose.yml in case it helps anyone else.

version: '3.9'

services:

# https://github.com/guillaumeaubert/gmvault-docker

  gmvault:
    image: aubertg/gmvault-docker:latest
    container_name: gmvault
    hostname: gmvault
    tty: true
# tty: true is the equivalent of docker run -t 
    stdin_open: true
# stdin_open: true the equivalent of docker run -i but I am not sure if this is needed 
    networks:
      - gmvault
    volumes:
      - ./ssmtp.conf:/etc/ssmtp/ssmtp.conf
      - /path/to/store/Email-archive:/data
    restart: "no"
    environment:
      - GMVAULT_UID=1000
      - GMVAULT_GID=1000
      - GMVAULT_EMAIL_ADDRESS=me@vanitydomain.tld
      - GMVAULT_SEND_REPORTS_TO=me@vanitydomain.tld
      - GMVAULT_TIMEZONE=Europe/Berlin
      - GMVAULT_OPTIONS=-c no --no-compression
# -c no does not deleted local emails when they have been deleted from Gmail, compression is unnecessary as ZFS does that already for me
      - GMVAULT_SYNC_ON_STARTUP=yes
# does a quick sync on startup
      - GMVAULT_QUICK_SYNC_SCHEDULE=1 2 2-31 * *
# at 02:01 on every day except the 1st of every month - quick sync only goes back the last 7 days
      - GMVAULT_FULL_SYNC_SCHEDULE=1 3 1 * *
# at 03:01 on the first day of the month - full sync goes through the full mailbox
    cpus: 1
    mem_limit: 1G
# cpu and mem limits seem enough for gmvault
networks:
  gmvault:
    external: true
    name: gmvault
ovizii commented 1 year ago

If and when I would like to propagate deletions from Gmail to my local archive , I can run this command which runs a full sync WITH the "-c yes" option:

docker exec -i gmvault /usr/bin/gmvault sync -t full -d /data --no-compression -c yes --oauth me@vanitydomain.tld

You could look at https://github.com/guillaumeaubert/gmvault-docker/blob/master/backup_full.sh if you'd like a report after this manual sync, but this might be a bit beyond me.

It might look a bit like:

docker exec -i gmvault /usr/bin/gmvault sync -t full -d /data --no-compression -c yes --oauth me@vanitydomain.tld 2>&1 | tee /data/me@vanitydomain.tld_full.log | mail -s "Mail Backup (full) | me@vanitydomain.tld | `date +'%Y-%m-%d %r %Z'`" me@vanitydomain.tld
dasb00ter commented 1 year ago

@ovizii Thanks for your docker compose file it helped me but running into auth problems with google. Could you maybe give me a hint on getting that done. The older method with oauth seems to be not working anymore although maybe you can fix it with a work around by setting up a python webserver, which I dont know how to do. Than there is a setting up an app password but not sure how this would be done in docker? Can you help a little

ovizii commented 1 year ago

@ovizii Thanks for your docker compose file it helped me but running into auth problems with google. Could you maybe give me a hint on getting that done.

Unfortunately I can't remember. I remember that these instructions worked: http://gmvault.org/in_depth.html and when I followed this: https://github.com/gaubert/gmvault/issues/335#issuecomment-846483036 I was all sorted.

Btw. I am running it on Linux, never needed any Gmail workaround nor anything python related outside these instructions. The Gmail app password relates to using an app password for accessing it instead of the Gmail account password, that is totally unrelated to docker.

dasb00ter commented 1 year ago

Thanks for your response. The one article refers to a Google security update from 12.08.2012. The other I followed but get the 400 forbidden in the browser from Google. The alternative is app password which isn't great.The image log still complains about oauth set up too which is included in emails... Which come to think of I haven't got since the first run. Not sure what you mean in terms of Linux. I would suppose the image is built in alpine and Its running on Linux based host for me. I think this image is just getting old and needs some updating our at least the instructions which is too bad considering all the pulls and the lack of alternatives. Still many thanks for your compose

ovizii commented 1 year ago

Sorry, there might have been some confusion.

When I said:

Not sure what you mean in terms of Linux.

I was referring to your comment: ...although maybe you can fix it with a work around by setting up a python webserver

I wrongly assumed you might be working with docker on Windows or something as I haven't needed any workarounds. I only followed the two links I gave you and its working just fine. Sorry I can't contribute any more.