Sign inSign up

ssedov/dirbackup-s3cmd

By ssedov

•Updated 9 months ago

Create an archive from the /data (mounted volume) and send it to S3 (using s3cmd).

Image
0

3.0K

ssedov/dirbackup-s3cmd repository overview

The 'latest' image tag has been temporarily aliased to tag '1.0' to maintain compatibility and facilitate comprehensive testing.

Dev:

  • Currently, work is in progress to implement a file rotation feature for backup archives.
  • An enhancement has been made to the backup configuration, allowing for integration with data sources using the CIFS protocol.

Version 2.1:

  • Implemented multi-architecture support (including amd64, arm64).
  • Introduced features to exclude specific files and directories from the backup process using the BACKUP_EXCLUDE variable (e.g., 'ansible,roles,collections,.terraform,.DS_Store,node_modules,*.log').
  • Added an option to select the XZ compression utility for archiving purposes, configurable via BACKUP_FORMAT='xz'.

Example. Backup /data/web:
docker run --rm -v /data/web:/data:ro -e BACKUP_FORMAT='xz' -e BACKUP_EXCLUDE='ansible,roles,collections,.terraform,.DS_Store,node_modules,*.log' -e BACKUP_NAME=files -e S3_BACKET=web-backup -e S3_PATH=data -e S3_NAME_PREFIX=data -e S3_ACCESS_KEY='access_key' -e S3_SECRET_KEY='secret' ssedov/dirbackup-s3cmd:2.1

Example (dev). Backup /data/web with rotation:
docker run --pull=always --rm -v /data/web:/data:ro -e ROTATION=1 -e ROTATION_DRY_RUN=1 -e BACKUP_NAME=files -e S3_BACKET=web-backup -e S3_PATH=data -e S3_NAME_PREFIX=data -e S3_ACCESS_KEY='access_key' -e S3_SECRET_KEY='secret' ssedov/dirbackup-s3cmd:dev

Example (dev). Backup CIFS \\192.168.1.254\Web-Files:
docker run --pull=always --rm --privileged -e BACKUP_SRC=cifs -e CIFS_HOST=192.168.1.254 -e CIFS_SHARE=Web-Files -e CIFS_USER=cifsuser -e CIFS_PASSWORD=cifspass -e BACKUP_NAME=files -e S3_BACKET=web-backup -e S3_NAME_PREFIX=data -e S3_ACCESS_KEY='access_key' -e S3_SECRET_KEY='secret' ssedov/dirbackup-s3cmd:dev

Configuration Variables

  • BACKUP_DIR: Specifies the directory within the mounted volume that will be archived. By default, it will use the root directory '/'.
  • BACKUP_NAME: Sets the name of the backup archive. The default name is 'data'.
  • BACKUP_EXCLUDE: A comma-separated list of items to be excluded from the backup with no spaces. The default is an empty string.
  • BACKUP_FORMAT: Determines the archiving utility to be used. Options are either 'gzip' or 'xz'. The default format is 'gzip'.
  • S3_BUCKET: The required name for the bucket in S3 storage.
  • S3_ACCESS_KEY: The required S3 access key credential.
  • S3_SECRET_KEY: The required S3 secret key credential.
  • S3_PATH: Defines the path within the S3 bucket where the archive will be stored. It defaults to an empty string.
  • S3_NAME_PREFIX: Establishes a prefix for the archive name. The default is an empty string.
  • S3_PROVIDER: The S3 service is provided by either 'yandex' or 'selectel'. The default provider is 'yandex'.

Added in branch (tag) dev

  • ROTATION: Enables the rotation of archives. This is not set by default.
  • ROTATION_DRY_RUN: Outputs a notification about the intentions, but does not delete files from the storage. This is not set by default.
  • BACKUP_SRC: The data source for the backup process is provided by either 'cifs' for CIFS server sources or 'local' for local sources. The default provider is 'local'.
  • CIFS_HOST: The required hostname of the CIFS server. Use BACKUP_SRC=cifs then.
  • CIFS_SHARE: The required name of the CIFS share. Use BACKUP_SRC=cifs then.
  • CIFS_USER: The required user credential for accessing the CIFS share. Use BACKUP_SRC=cifs then.
  • CIFS_PASSWORD: The required password associated with the CIFS user account. Use BACKUP_SRC=cifs then.
  • CIFS_DOMAIN: The domain of the CIFS user, if applicable. Optional, use BACKUP_SRC=cifs then.

Rotation Policy Description The rotation policy ensures that the archives are maintained as follows:

  • Daily archives for the last 7 days, including the current day, are preserved when available.
  • Weekly archives for the last 4 weeks, including the current week. The policy retains the latest available archive created during that week.
  • Monthly archives for the last 4 months, including the current month. The policy retains the latest available archive created in that month.

Tag summary

Content type

Image

Digest

sha256:818a04d0e…

Size

65.2 MB

Last updated

over 3 years ago

docker pull ssedov/dirbackup-s3cmd