Skip to content

Commit

Permalink
allow setting borg_remote_path. fix elabftw/elabftw#4798
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasCARPi committed Dec 4, 2023
1 parent 62cf5ea commit 72ef875
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog for elabctl

## Version 3.6.0

* Allow setting `BORG_REMOTE_PATH` env var for `borg` backup. (fix elabftw/elabftw#4798)

## Version 3.5.0

* Change `bin/console db:install` to new `bin/init db:install`
Expand Down
3 changes: 3 additions & 0 deletions elabctl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@
# granularity of backups to keep
declare BORG_KEEP_DAILY=14
declare BORG_KEEP_MONTHLY=6

# optional, only set if required (rsync.net)
#declare BORG_REMOTE_PATH=borg1
5 changes: 4 additions & 1 deletion elabctl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# https://github.com/elabftw/elabctl/
# © 2022 Nicolas CARPi @ Deltablot
# License: GPLv3
declare -r ELABCTL_VERSION='3.5.0'
declare -r ELABCTL_VERSION='3.6.0'

# default backup dir
declare BACKUP_DIR='/var/backups/elabftw'
Expand Down Expand Up @@ -55,6 +55,9 @@ function borg-backup
# add these into env so it is picked up by borg
export BORG_REPO="${BORG_REPO}"
export BORG_PASSPHRASE="${BORG_PASSPHRASE}"
if [ -n "$BORG_REMOTE_PATH" ]; then
export BORG_REMOTE_PATH="${BORG_REMOTE_PATH}"
fi
# we add to the borg the uploaded files (web directory) and also the backup dir containing dumps of MySQL
"${BORG_PATH}" create "::$(hostname)-$(date +%F_%H-%M)" "${DATA_DIR}/web" "${BACKUP_DIR}"
"${BORG_PATH}" prune --keep-daily="${BORG_KEEP_DAILY:-14}" --keep-monthly="${BORG_KEEP_MONTHLY:-6}"
Expand Down

0 comments on commit 72ef875

Please sign in to comment.