[mod] backup
This commit is contained in:
parent
51e0851ae1
commit
ed6a7ab2eb
3 changed files with 19 additions and 7 deletions
7
gitea/backup.sh
Normal file
7
gitea/backup.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
# backup gitea
|
||||
echo "stopping"
|
||||
docker-compose stop
|
||||
echo "stopping"
|
||||
backup_gitea.sh
|
||||
echo "restart"
|
||||
docker-compose -up
|
|
@ -14,22 +14,22 @@
|
|||
# * /repositories/ - containing the bundles, structured owner/name.bundle
|
||||
# * /lfs/ - containing all the direct LFS data
|
||||
#
|
||||
# Stop on errors
|
||||
set -e
|
||||
# Stop on errors or undefined
|
||||
set -e -u
|
||||
|
||||
# Gitea config / SQL DB backup rotation
|
||||
CONTAINER=gitea
|
||||
# Backup dir from our perspective
|
||||
HOST_BACKUP_DIR="/mnt/drive/backups/gitea"
|
||||
HOST_BACKUP_DIR=$DEST
|
||||
# Git repo dir from our perspective (it's outside container)
|
||||
HOST_GIT_REPO_DIR="/mnt/drive/docker/thedocks/gitea/data/git/repositories"
|
||||
HOST_GIT_REPO_DIR="$SRC/git/repositories"
|
||||
# Git LFS dir from our perspective (it's outside container)
|
||||
HOST_GIT_LFS_DIR="/mnt/drive/docker/thedocks/gitea/data/git/lfs"
|
||||
HOST_GIT_LFS_DIR="$SRC/git/lfs"
|
||||
# Where we work on things (host and container)
|
||||
TEMP_DIR="/tmp"
|
||||
|
||||
GITEA_DATA_FILENAME="gitea_backup.zip"
|
||||
HOST_BACKUP_FILE="$HOST_BACKUP_DIR/$GITEA_DATA_FILENAME"
|
||||
HOST_BACKUP_FILE="$DEST/$GITEA_DATA_FILENAME"
|
||||
|
||||
# Back up to temp files then copy on success to prevent syncing incomplete/bad files
|
||||
CONTAINER_BACKUP_FILE_TEMP="$TEMP_DIR/gitea_dump_temp.zip"
|
||||
|
@ -43,7 +43,7 @@ docker cp $CONTAINER:$CONTAINER_BACKUP_FILE_TEMP $HOST_BACKUP_FILE
|
|||
echo Backing up git repositories
|
||||
# Git repos are in 2-level structure, owner/repository
|
||||
# Again we MUST tar to a TEMP file and move into place when successful
|
||||
GITREPO_BACKUP_FILE="$HOST_BACKUP_DIR/gitrepos_backup.tar.bz2"
|
||||
GITREPO_BACKUP_FILE="$DEST/gitrepos_backup.tar.bz2"
|
||||
GITREPO_BACKUP_FILE_TEMP=`mktemp -p $TEMP_DIR gitrepos_backup.tar.bz2.XXXXXX`
|
||||
tar cjf $GITREPO_BACKUP_FILE_TEMP -C $HOST_GIT_REPO_DIR .
|
||||
mv -f $GITREPO_BACKUP_FILE_TEMP $GITREPO_BACKUP_FILE
|
||||
|
|
5
gitea/omv.profile
Normal file
5
gitea/omv.profile
Normal file
|
@ -0,0 +1,5 @@
|
|||
# for gitea_backup
|
||||
#!/bin/bash
|
||||
|
||||
export SRC="/root/thedocks/gitea/data"
|
||||
export DEST="/srv/dev-disk-by-uuid-45e2e732-9e00-4a82-a7cc-9c743e033671/datastore/gitea"
|
Loading…
Add table
Reference in a new issue