borgmatic-collective / docker-borgmatic

Borgmatic in Docker
GNU General Public License v3.0
364 stars 93 forks source link

Timezone appears not to be working #347

Open Hafnernuss opened 3 months ago

Hafnernuss commented 3 months ago

In my docker-compose file, I have set up the timezone as "Europe/Vienna":

environment:
      - TZ="Europe/Vienna"

with the folling in my config.yml file:

archive_name_format: 'myservice-files-{now:%Y-%m-%d_%H-%M-%S-%z}'

However, the backups are created in the following format:

myservice-files-2024-08-18T07:46:46+0000

Which appears to be plain UTC. Am I missing something here or is the TZ env not honored?

modem7 commented 6 days ago

What does docker exec -it Borgmatic date give you?

I've just checked on mine, and the TZ variable is definitely honoured.

Bubbelb commented 5 days ago

Just a quick one: At my compose.yaml, the environment node is not an array, but a dict. So, maybe instead of your example above, lose the dash at the beginning, and replace the = by ': '. Like so:

environment:
      TZ: "Europe/Vienna"

This is the way it works for me.

modem7 commented 5 days ago

This is mine in case it's useful:

  #############
  ##Borgmatic##
  #############

  borgmatic:
    image: modem7/borgmatic-docker
    # image: modem7/borgmatic-docker:1.8.13-1.4.0
    # image: borgmatic:test
    # image: ghcr.io/borgmatic-collective/borgmatic
    container_name: Borgmatic
    environment:
      TZ: $TZ # Europe/London
      BORG_PASSPHRASE: $BORG_PASSPHRASE
      BORG_SOURCE_1: $BORG_SOURCE_1
      BORG_SOURCE_2: $BORG_SOURCE_2
      BORG_REPO: $BORG_REPO
      BORG_HEALTHCHECK_URL: $BORG_HEALTHCHECK_URL
      # EXTRA_PKGS: postgresql16-client rclone coreutils jq
      DOCKERCLI: true
      CRON: $BORG_CRON
      CRON_COMMAND: $BORG_CRON_COMMAND
      # EXTRA_CRON: |-
      #   @daily borgmatic check -v 1 2>&1 > tee /mnt/log/check-$(date +\%Y-\%m-\%dT\%H:\%M:\%S).log
      #   0 7 1 * * command2
    logging:
      driver: "local"
      options:
        max-size: 10m
        max-file: "3"
    volumes:
      - $BORGHOMESOURCEDIR:/mnt/source/
      # - $CRONTAB:/mnt/source/Cron
      # - Pihole:/mnt/source/Pihole/Pihole
      # - Dnsmasq:/mnt/source/Pihole/Dnsmasq
      - $BORGSERVBACKUPDIR/Database:/mnt/borg-DBrepository
      - $BORGSERVBACKUPDIR/Docker:/mnt/borg-repository
      - $RAMDRIVEBACKUP/borg:/mnt/ramdrive
      - $USERDIR:/mnt/source/DockerApps/
      - $USERDIR/Borgmatic/borgmatic.d/:/etc/borgmatic.d/
      - $USERDIR/Borgmatic/.config/borg/:/root/.config/borg
      - $USERDIR/Borgmatic/.ssh/:/root/.ssh
      - $USERDIR/Borgmatic/.state/:/root/.borgmatic
      - $USERDIR/Borgmatic/.cache/borg/:/root/.cache/borg
      - $DOCKERDIR/HDA/.env:/mnt/docker/HDA/.env:ro
      - $DOCKERDIR/HDA/docker-compose.yml:/mnt/docker/HDA/docker-compose.yml:ro
      - $BORGSCRIPTS:/borgscripts:ro
      - /var/run/docker.sock:/var/run/docker.sock # So we can run scripts
      # - /mnt/downloads/script/:/custom-cont-init.d:ro
    networks:
      isonet:
      isolated:
    restart: always