From 9c1ed78fac5ed643c9257c7ecbb4f1407bbc67b8 Mon Sep 17 00:00:00 2001 From: turtlebasket Date: Thu, 15 Jun 2023 16:42:42 -0700 Subject: [PATCH] update backup stuff --- .gitignore | 3 +++ cuddlefish/backup | 11 +++++++---- cuddlefish/docker-compose.yaml | 2 +- cuddlefish/example.env | 3 +++ 4 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 cuddlefish/example.env diff --git a/.gitignore b/.gitignore index c265584..55a58f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ # Docker volume mounts */*-data/ +# envfiles +.env + # backups *.tar diff --git a/cuddlefish/backup b/cuddlefish/backup index c7aac00..ea56d23 100755 --- a/cuddlefish/backup +++ b/cuddlefish/backup @@ -1,8 +1,11 @@ #!/bin/bash -# CONTAINER_ID=b581d6283772 -CONTAINER_ID=gitea +# NOTE: DEPENDING ON PERMISSIONING, YOU MAY NEED TO RUN THIS SCRIPT USING SUDO -docker commit -p $CONTAINER_ID gitea-checkpoint-latest -docker save -o gitea-checkpoint-$(date | tr '[:upper:]' '[:lower:]' | tr ' ' '_').tar checkpoint-latest +source .env +DATESTRING=$(date +"%Y-%m-%d_%H%M%S" | tr '[:upper:]' '[:lower:]' | tr ' ' '_') +ARCHIVE="gitea-data-${DATESTRING}.tar.gz" +tar -czvf $ARCHIVE gitea-data/ +scp -i $BACKUP_KEYPATH -P $BACKUP_SSH_PORT $ARCHIVE $BACKUP_HOST:~/backups/ +rm $ARCHIVE && echo Removed $ARCHIVE. diff --git a/cuddlefish/docker-compose.yaml b/cuddlefish/docker-compose.yaml index 6f2a163..4e1656b 100644 --- a/cuddlefish/docker-compose.yaml +++ b/cuddlefish/docker-compose.yaml @@ -6,7 +6,7 @@ networks: services: server: - image: gitea/gitea:latest + image: gitea/gitea:1.19.3 container_name: gitea environment: USER_UID: 1000 diff --git a/cuddlefish/example.env b/cuddlefish/example.env new file mode 100644 index 0000000..f3f209a --- /dev/null +++ b/cuddlefish/example.env @@ -0,0 +1,3 @@ +BACKUP_HOST=bob@1.2.3.4 +BACKUP_KEYPATH=~/.ssh/id_backup +BACKUP_SSH_PORT=22