eduardolat / pgbackweb

🐘 Effortless PostgreSQL backups with a user-friendly web interface! 🌐💾
MIT License
935 stars 45 forks source link

[BUG] Wrong time written on backup file and in the Executions page #25

Closed SpasovskiFilip closed 2 months ago

SpasovskiFilip commented 2 months ago

It's not some feature breaking bug, but I just thought I'd report it, just in case.

First to clarify that the backup is executed at the desired time, there is no issue there. The issue is that the time written on the backup file (both local and S3) and in the Executions page, doesn't match the time specified on the cron schedule according to the time zone I've set.

This is the setup I have for the backup with the cron and timezone it's set up at 5:20 AM image

This is the executions page showing the backup time as 3:20 AM image

And Here is the file on Cloudflare R2 storage with the time of 3:20 AM in the filename image

P.S. Same goes for manual backup execution and local backup files. Also I tried setting the TZ in the docker-compose file and redeploying, but it didn't change anything.

julien-wff commented 2 months ago

Hi @SpasovskiFilip,

The name of the backup file is tied to the container's timezone. By default it's UTC. I just tested, setting the TZ env variable does modify the file name. Can you give me your compose file? Also, are the logs on the same timezone as the one you specified?

image image image

SpasovskiFilip commented 2 months ago

I think I might have made a mistake, unknowingly. The issue is I had the timezone written as TZ: Europe/Skopje instead of using quotes like you are using.

version: "3.9"
services:
  pgbackweb:
    image: eduardolat/pgbackweb:latest
    container_name: PGBackWeb
    healthcheck:
      test: timeout 10s bash -c ':> /dev/tcp/127.0.0.1/8085' || exit 1
      interval: 10s
      timeout: 5s
      retries: 3
      start_period: 90s
    ports:
      - 8085:8085
    volumes:
      - /volume1/docker/vaultwarden/backupdb/pgbackweb:/backups
    environment:
      TZ: Europe/Skopje
      PBW_ENCRYPTION_KEY: SOME_ENC_KEY
      PBW_POSTGRES_CONN_STRING: PG_CONN_STRING
    depends_on:
      pgbackweb-db:
        condition: service_healthy

  pgbackweb-db:
    image: postgres:16
    hostname: pgbackweb-db
    container_name: PGBackWeb-DB
    environment:
      POSTGRES_USER: pgbackwebuser
      POSTGRES_DB: pgbackweb
      POSTGRES_PASSWORD: pgbackwebpass
    ports:
      - 8086:5432
    volumes:
      - /volume1/docker/pgbackwebdb:/var/lib/postgresql/data:rw
    healthcheck:
      test: ["CMD", "pg_isready", "-q", "-d", "pgbackweb", "-U", "pgbackwebuser"]
      timeout: 45s
      interval: 10s
      retries: 10

After fixing this, the backup naming works great The log also shows the correct time The only place the time is still UTC is in the Executions page

julien-wff commented 2 months ago

Happy to hear it's solved!

I've added a precision in #28, so people don't get confused. Changing Execution page TZ will certainly be my next PR.

julien-wff commented 2 months ago

This issue is resolved, it can be closed (@SpasovskiFilip, @eduardolat, since I don't have perms)