ttionya / vaultwarden-backup

Backup vaultwarden (formerly known as bitwarden_rs) SQLite3/PostgreSQL/MySQL/MariaDB database by rclone. (Docker)
MIT License
1.04k stars 119 forks source link

No zip file in backup folder #33

Closed trapassati closed 3 years ago

trapassati commented 3 years ago

When run the container only the folder "Vaultwarden-backup" is created on Dropbox but with nothing inside.

Here is my only log file

========================================,
DATA_DIR: /data,
DATA_DB: /data/db.sqlite3,
DATA_CONFIG: /data/config.json,
DATA_RSAKEY: /data/rsa_key,
DATA_ATTACHMENTS: /data/attachments,
DATA_SENDS: /data/sends,
========================================,
CRON: 5 * * * *,
RCLONE_REMOTE_NAME: Dropbox,
RCLONE_REMOTE_DIR: Vaultwarden-backup,
RCLONE_REMOTE: Dropbox:Vaultwarden-backup,
ZIP_PASSWORD: 18 Chars,
BACKUP_FILE_DATE_FORMAT: %Y%m%d,
BACKUP_KEEP_DAYS: 2,
MAIL_SMTP_ENABLE: FALSE,
TIMEZONE: UTC,
========================================
ttionya commented 3 years ago

Hey @trapassati ,

The "Vaultwarden-backup" folder is automatically created on Dropbox, so I assume you have configured Rclone correctly.

The log you provided is just the base configuration that the backup program prints based on the environment variables, please provide the running log, it is usually after the base configuration.

Note that the backup program will not run when you start the container, it will run at xx:05 every hour according to your configuration.

trapassati commented 3 years ago

This is the only log that I have:

xx@yyyyyyy:~ $ docker logs vaultwarden_backup
========================================
DATA_DIR: /data
DATA_DB: /data/db.sqlite3
DATA_CONFIG: /data/config.json
DATA_RSAKEY: /data/rsa_key
DATA_ATTACHMENTS: /data/attachments
DATA_SENDS: /data/sends
========================================
CRON: 5 * * * *
RCLONE_REMOTE_NAME: Dropbox
RCLONE_REMOTE_DIR: Vaultwarden-backup
RCLONE_REMOTE: Dropbox:Vaultwarden-backup
ZIP_ENABLE: TRUE
ZIP_PASSWORD: 9 Chars
ZIP_TYPE: zip
BACKUP_FILE_DATE_FORMAT: %Y%m%d
BACKUP_KEEP_DAYS: 2
MAIL_SMTP_ENABLE: FALSE
TIMEZONE: UTC
========================================
trapassati commented 3 years ago

Ok I've checked the container, imho cron daemon is missing

The "init.d" folder is empty

bash-5.1# ls /etc/
alpine-release        fstab                 init.d                logrotate.d           nail.rc               periodic              services              sysctl.d
apk                   fuse.conf             inittab               modprobe.d            network               profile               shadow                terminfo
ca-certificates       group                 inputrc               modules               opt                   profile.d             shadow-               timezone
ca-certificates.conf  group-                issue                 modules-load.d        os-release            protocols             shells                udhcpd.conf
conf.d                hostname              krb5.conf             motd                  passwd                resolv.conf           ssl
crontabs              hosts                 localtime             mtab                  passwd-               securetty             sysctl.conf
bash-5.1# 
ttionya commented 3 years ago

Hey @trapassati ,

The crond configuration file is /etc/crontabs/root. Please check the contents of this file.

trapassati commented 3 years ago

This is the configuration in /etc/crontabs/root

# do daily/weekly/monthly maintenance
# min   hour    day     month   weekday command
*/15    *       *       *       *       run-parts /etc/periodic/15min
0       *       *       *       *       run-parts /etc/periodic/hourly
0       2       *       *       *       run-parts /etc/periodic/daily
0       3       *       *       6       run-parts /etc/periodic/weekly
0       5       1       *       *       run-parts /etc/periodic/monthly

5 * * * * bash /app/backup.sh > /dev/stdout

If I try to exec manually /app/backup.sh it works fine, only seems that the cron daemon isn't running or not execute the backup script

bash-5.1# ./backup.sh
running backup program...
========================================
DATA_DIR: /data
DATA_DB: /data/db.sqlite3
DATA_CONFIG: /data/config.json
DATA_RSAKEY: /data/rsa_key
DATA_ATTACHMENTS: /data/attachments
DATA_SENDS: /data/sends
========================================
CRON: 5 * * * *
RCLONE_REMOTE_NAME: Dropbox
RCLONE_REMOTE_DIR: Vaultwarden-backup
RCLONE_REMOTE: Dropbox:Vaultwarden-backup
ZIP_ENABLE: FALSE
ZIP_PASSWORD: 9 Chars
ZIP_TYPE: zip
BACKUP_FILE_DATE_FORMAT: %Y%m%d
BACKUP_KEEP_DAYS: 2
MAIL_SMTP_ENABLE: FALSE
TIMEZONE: UTC
========================================
backup vaultwarden sqlite database
backup vaultwarden config
backup vaultwarden rsakey
display rsakey tar file list
rsa_key.pub.pem
rsa_key.pem
backup vaultwarden attachments
display attachments tar file list
attachments/
attachments/a6d4cfb1-d537-41e6-bb41-71344f9456bf/
attachments/a6d4cfb1-d537-41e6-bb41-71344f9456bf/957f5886b1e47d58c31e
attachments/e9ca1491-92ed-4261-871a-1f6c19de6197/
attachments/e9ca1491-92ed-4261-871a-1f6c19de6197/706f8fd17013888c4d0e
backup vaultwarden sends
display sends tar file list
sends/
total 536K   
drwxr-xr-x    2 root     root        4.0K Oct 12  2021 .
drwxr-xr-x    3 root     root        4.0K Oct 12  2021 ..
-rw-r--r--    1 root     root      230.5K Oct 12  2021 attachments.20370508.tar
-rw-r--r--    1 root     root        1.3K Oct 12  2021 config.20370508.json
-rw-r--r--    1 root     root      280.0K Oct 12  2021 db.20370508.sqlite3
-rw-r--r--    1 root     root        4.5K Oct 12  2021 rsakey.20370508.tar
-rw-r--r--    1 root     root        1.5K Oct 12  2021 sends.20370508.tar
skip package backup files
upload backup file to storage system
delete 2 days ago backup files
ttionya commented 3 years ago

@trapassati ,

Note the time of the backup file, it shows 20370508.

Try running date in the container to see the current time and make sure he gets the correct current time.

If so, check this issue #34, it may be useful to you.

trapassati commented 3 years ago

It's strange, the host date-time is correct and in others containers the date-time is correct too.

root@32a3f1403:/# date
Tue Oct 12 20:19:56 CEST 2021
root@32a3f4cc1403:/# 

In the vaultwarden-backup date time is:

bash-5.1# date
Sun Apr 12 21:22:56 CEST 2037
bash-5.1# 

And in the /etc/timezone: "Europe/Rome"

ttionya commented 3 years ago

@trapassati ,

It looks like the problem is that the container is getting the wrong time, not sure if each execution of date returns a random time or otherwise.

Checking the whole internet, all I know is that https://bugs.launchpad.net/cloud-images/+bug/1896443 is a known issue and has a solution.

Check if your host is running on an arm/v7 platform? And is it using a debian/ubuntu system?

If not, please provide more information, thanks!

trapassati commented 3 years ago

Solved like issue #34, tnx. However it's strange, vaultwarden backup is the only container affected of this problem

ttionya commented 3 years ago

Hey @trapassati ,

Very happy that you have solved this problem. I don't know why it happened, I'm using buildx to build docker images via Github Action as usual.

Maybe it's caused by the upstream base image rclone/rclone:1.56.2?

If anyone has the same problem, please help test if rclone/rclone:1.56.2 has the same problem before fixing it and let me know the result, thanks.