ttionya/vaultwarden-backup

Does it support postgresql database backup?

Seele0oO opened this issue · 15 comments

Use this parameter.

DATABASE_URL: "postgresql://exampleuser:examplepasswd@db/postgres"

The vault can be stored to it. Using this approach you can create distributed vaultwarden.

So does this backup function support postgresql backup function?

~/Documents/bitwarden/data ❯ tree                                                                                           12s 16:59:47
.
├── attachments
├── icon_cache
│   └── 1.cn.png.miss
├── rsa_key.pem
├── rsa_key.pub.pem
├── sends
└── tmp

At this point a password is stored in the database.

@Seele0oO ,

I have researched and only need to modify a small amount of code to support PostgreSQL and MariaDB/MySQL .

But I'm not good with databases and don't know how to backup and restore PostgreSQL and MariaDB/MySQL data properly.

Another problem occurs in the restore phase, sqlite can be restored by just copying the db file to the folder, but other databases need to execute sql, this is also the aspect that bothers me.

If you can provide the shell command for PostgreSQL database backup and restore, I will finish the support for PostgreSQL as soon as possible. If you can also provide commands for MariaDB/MySQL, that would be great.

Thank you for your attention,I have done some shell scripts, but I am not very skilled, so I wrote some example, hope it is useful for you.

Seele0oO@b9e1c24

by the way,It's not a good idea to use mysql, I think it's too heavy.
There is some example.
Seele0oO@4227273

In my view,the MariaDB/MySQL is the same in commands.
So it's probably universal.

@Seele0oO ,

The PostgreSQL backend is now supported, try it on 1.16.0-beta.0.

Please let me know if you have any questions.

I will continue to add MySQL/MariaDB support.

1.16.0-beta.1 is support Mysql(MariaDB) and PostgreSQL backend.

1.16.0-beta.2 is support PostgreSQL 15. And earlier beta versions are no longer available.

I'm wondering if I'm missing some environment variables that specify the backup method? In my tests, the data in the datagrip-connected postgresql database changed as I made changes, but the backup program still just backed up those files.
image
After I added some attachments to my test account, these two folders remained empty.
image

Please provide environment variables.

vaultwarden:
  environment:
     SIGNUPS_ALLOWED: 'true'
     DATABASE_URL: 'postgresql://postgres:example@db/postgres'
backup:
    environment:
      CRON: '*/5 * * * *'
  db:
    image: postgres
    restart: always
    environment:
      POSTGRES_PASSWORD: example

Sorry, please check the document.

@Seele0oO ,

Hello, is the postgresql database backup working?

It works fine on Debain 11.
I can't test it with mysql because of the preformance of my password-server.

Released stable version v1.16.0.