Merge pull request #104 from ttionya/feature/backup-command
support trigger a backup manually (close #94 )
This commit is contained in:
5 files changed
+48
-1
No files matched your search
@@ -493,6 +493,7 @@ We recommend re-downloading the `docker-compose.yml` file, replacing your enviro
|
||||
|
||||
- [Run as non-root user](docs/run-as-non-root-user.md)
|
||||
- [Multiple remote destinations](docs/multiple-remote-destinations.md)
|
||||
- [Manually trigger a backup](docs/manually-trigger-a-backup.md)
|
||||
- [Using the PostgreSQL backend](docs/using-the-postgresql-backend.md)
|
||||
- [Using the MySQL(MariaDB) backend](docs/using-the-mysql-or-mariadb-backend.md)
|
||||
|
||||
|
||||
@@ -490,6 +490,7 @@ docker run --rm -it -e MAIL_SMTP_VARIABLES='<your smtp variables>' -e MAIL_TO='<
|
||||
|
||||
- [以非 root 用户运行](docs/run-as-non-root-user.md)
|
||||
- [备份到多个远程目标](docs/multiple-remote-destinations.md)
|
||||
- [手动触发备份](docs/manually-trigger-a-backup.md)
|
||||
- [使用 PostgreSQL 数据库](docs/using-the-postgresql-backend.md)
|
||||
- [使用 MySQL(MariaDB) 数据库](docs/using-the-mysql-or-mariadb-backend.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
# Manually trigger a backup
|
||||
|
||||
Sometimes, it's necessary to manually trigger backup actions.
|
||||
|
||||
This can be useful when other programs are used to consistently schedule tasks or to verify that environment variables are properly configured.
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Previously, performing an immediate backup required overwriting the entrypoint of the image. However, with the new setup, you can perform a backup directly with a parameterless command.
|
||||
|
||||
```shell
|
||||
docker run \
|
||||
--rm \
|
||||
--name vaultwarden_backup \
|
||||
--volumes-from=vaultwarden \
|
||||
--mount type=volume,source=vaultwarden-rclone-data,target=/config/ \
|
||||
-e ... \
|
||||
ttionya/vaultwarden-backup:latest backup
|
||||
```
|
||||
|
||||
You also need to mount the rclone config file and set the environment variables.
|
||||
|
||||
The only difference is that the environment variable `CRON` does not work because it does not start the CRON program, but exits the container after the backup is done.
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
## IMPORTANT
|
||||
|
||||
**Manually triggering a backup only verifies that the environment variables are configured correctly, not that CRON is working properly. This is the [issue](https://github.com/ttionya/vaultwarden-backup/issues/53) that CRON may not work properly on ARM devices.**
|
||||
|
||||
@@ -53,5 +53,14 @@ configure_postgresql
|
||||
configure_timezone
|
||||
configure_cron
|
||||
|
||||
# backup manually
|
||||
if [[ "$1" == "backup" ]]; then
|
||||
color yellow "Manually triggering a backup will only execute the backup script once, and the container will exit upon completion."
|
||||
|
||||
bash "/app/backup.sh"
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# foreground run crond
|
||||
exec supercronic -passthrough-logs -quiet "${CRON_CONFIG_FILE}"
|
||||
Reference in new issue
Block a user