mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-22 05:10:28 +01:00
Deprecate BACKUP_FROM_SNAPSHOT (#81)
This commit is contained in:
parent
1ea0b51b23
commit
51af8c3c77
37
README.md
37
README.md
@ -27,6 +27,7 @@ It handles __recurring or one-off backups of Docker volumes__ to a __local direc
|
|||||||
- [Using with Docker Swarm](#using-with-docker-swarm)
|
- [Using with Docker Swarm](#using-with-docker-swarm)
|
||||||
- [Manually triggering a backup](#manually-triggering-a-backup)
|
- [Manually triggering a backup](#manually-triggering-a-backup)
|
||||||
- [Update deprecated email configuration](#update-deprecated-email-configuration)
|
- [Update deprecated email configuration](#update-deprecated-email-configuration)
|
||||||
|
- [Replace deprecated `BACKUP_FROM_SNAPSHOT` usage](#replace-deprecated-backup_from_snapshot-usage)
|
||||||
- [Using a custom Docker host](#using-a-custom-docker-host)
|
- [Using a custom Docker host](#using-a-custom-docker-host)
|
||||||
- [Run multiple backup schedules in the same container](#run-multiple-backup-schedules-in-the-same-container)
|
- [Run multiple backup schedules in the same container](#run-multiple-backup-schedules-in-the-same-container)
|
||||||
- [Recipes](#recipes)
|
- [Recipes](#recipes)
|
||||||
@ -149,6 +150,11 @@ You can populate below template according to your requirements and use it as you
|
|||||||
|
|
||||||
# BACKUP_LATEST_SYMLINK="backup.latest.tar.gz"
|
# BACKUP_LATEST_SYMLINK="backup.latest.tar.gz"
|
||||||
|
|
||||||
|
# ************************************************************************
|
||||||
|
# The BACKUP_FROM_SNAPSHOT option has been deprecated and will be removed
|
||||||
|
# in the next major version. Please use exec-pre and exec-post
|
||||||
|
# as documented below instead.
|
||||||
|
# ************************************************************************
|
||||||
# Whether to copy the content of backup folder before creating the tar archive.
|
# Whether to copy the content of backup folder before creating the tar archive.
|
||||||
# In the rare scenario where the content of the source backup volume is continously
|
# In the rare scenario where the content of the source backup volume is continously
|
||||||
# updating, but we do not wish to stop the container while performing the backup,
|
# updating, but we do not wish to stop the container while performing the backup,
|
||||||
@ -660,6 +666,37 @@ After:
|
|||||||
NOTIFICATION_URLS=smtp://me:secret@posteo.de:587/?fromAddress=no-reply@example.com&toAddresses=you@example.com
|
NOTIFICATION_URLS=smtp://me:secret@posteo.de:587/?fromAddress=no-reply@example.com&toAddresses=you@example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Replace deprecated `BACKUP_FROM_SNAPSHOT` usage
|
||||||
|
|
||||||
|
Starting with version 2.15.0, the `BACKUP_FROM_SNAPSHOT` feature has been deprecated.
|
||||||
|
If you need to prepare your sources before the backup is taken, use `exec-pre`, `exec-post` and an intermediate volume:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
my_app:
|
||||||
|
build: .
|
||||||
|
volumes:
|
||||||
|
- data:/var/my_app
|
||||||
|
- backup:/tmp/backup
|
||||||
|
labels:
|
||||||
|
- docker-volume-backup.exec-pre=cp -r /var/my_app /tmp/backup/my-app
|
||||||
|
- docker-volume-backup.exec-post=rm -rf /tmp/backup/my-app
|
||||||
|
|
||||||
|
backup:
|
||||||
|
image: offen/docker-volume-backup:latest
|
||||||
|
environment:
|
||||||
|
BACKUP_SOURCES: /tmp/backup
|
||||||
|
volumes:
|
||||||
|
- backup:/backup:ro
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
data:
|
||||||
|
backup:
|
||||||
|
```
|
||||||
|
|
||||||
### Using a custom Docker host
|
### Using a custom Docker host
|
||||||
|
|
||||||
If you are interfacing with Docker via TCP, set `DOCKER_HOST` to the correct URL.
|
If you are interfacing with Docker via TCP, set `DOCKER_HOST` to the correct URL.
|
||||||
|
@ -356,6 +356,12 @@ func (s *script) takeBackup() error {
|
|||||||
backupSources := s.c.BackupSources
|
backupSources := s.c.BackupSources
|
||||||
|
|
||||||
if s.c.BackupFromSnapshot {
|
if s.c.BackupFromSnapshot {
|
||||||
|
s.logger.Warn(
|
||||||
|
"Using BACKUP_FROM_SNAPSHOT has been deprecated and will be removed in the next major version.",
|
||||||
|
)
|
||||||
|
s.logger.Warn(
|
||||||
|
"Please use `exec-pre` and `exec-post` commands to prepare your backup sources. Refer to the README for an upgrade guide.",
|
||||||
|
)
|
||||||
backupSources = filepath.Join("/tmp", s.c.BackupSources)
|
backupSources = filepath.Join("/tmp", s.c.BackupSources)
|
||||||
// copy before compressing guard against a situation where backup folder's content are still growing.
|
// copy before compressing guard against a situation where backup folder's content are still growing.
|
||||||
s.registerHook(hookLevelPlumbing, func(error) error {
|
s.registerHook(hookLevelPlumbing, func(error) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user