1
0
mirror of https://github.com/xzeldon/vwdump.git synced 2025-06-28 07:38:15 +03:00
vwdump/README.md
jmqm ae779ce6e5
Change execution schedule (#5)
**README**
- Changed `CRON_TIME` in `docker-compose`.
- Added info on when the script runs.

**Dockerfile**
- Changed execution schedule from 5am everyday to every 12 hours.
2021-05-25 21:10:41 -05:00

61 lines
3.2 KiB
Markdown

Backs up vaultwarden files using cron daemon.
Can be set to run automatically.
## Usage
#### Automatic Backups
Refer to the `docker-compose` section below. By default, backing up is automatic.
#### Manual Backups
Pass `manual` to `docker run` or `docker-compose` as a `command`.
## docker-compose
```
services:
vaultwarden:
# Vaultwarden configuration here.
backup:
image: jmqm/vaultwarden_backup
container_name: vaultwarden_backup
volumes:
- "/vaultwarden_data_directory:/data:ro"
- "/backup_directory:/backups"
- "/etc/localtime:/etc/localtime:ro" # Container uses date from host.
environment:
- DELETE_AFTER=30 #optional
- CRON_TIME=* */24 * * * # Runs every 24 hours.
- UID=1024
- GID=100
```
## Environment Variables
#### ⭐Required, 👍 Recommended
| Variable | Description |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| UID ⭐| User ID to run the cron job as. |
| GID ⭐| Group ID to run the cron job as. |
| CRON_TIME 👍| When to run (default is every 12 hours). Info [here](https://www.ibm.com/docs/en/db2oc?topic=task-unix-cron-format) and editor [here](https://crontab.guru/). |
| DELETE_AFTER 👍| Delete backups _X_ days old. _(unsupported at the moment)_ |
#### Optional
| Variable | Description |
| -------------- | -------------------------------------------------------------------------------------------- |
| TZ ¹ | Timezone inside the container. Can mount `/etc/localtime` instead as well _(recommended)_. |
| LOGFILE | Log file path relative to inside the container. |
| CRONFILE | Cron file path relative to inside the container. |
¹ See <https://en.wikipedia.org/wiki/List_of_tz_database_time_zones> for more information
## Errors
#### Wrong permissions
`Error: unable to open database file` is most likely caused by permission errors.
Note that sqlite3 creates a lock file in the source directory while running the backup.
So source *AND* destination have to be +rw for the user. You can set the user and group ID
via the `UID` and `GID` environment variables like described above.
#### Date Time issues / Wrong timestamp
If you need timestamps in your local timezone you should mount `/etc/timezone:/etc/timezone:ro` and `/etc/localtime:/etc/localtime:ro`
like it's done in the [docker-compose.yml](docker-compose.yml). An other possible solution is to set the environment variable accordingly (like `TZ=Europe/Berlin`)
(see <https://en.wikipedia.org/wiki/List_of_tz_database_time_zones> for more information).