From 7680d762b66dce0bc0ca3b3f478e380b7e78d86b Mon Sep 17 00:00:00 2001 From: Mathias Beaulieu-Duncan Date: Mon, 25 Nov 2024 19:00:12 -0500 Subject: [PATCH] added agent --- backup.sh.save | 21 +++++++++++++++++++++ docker-compose.yaml | 13 +++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 backup.sh.save diff --git a/backup.sh.save b/backup.sh.save new file mode 100644 index 0000000..10bbdc8 --- /dev/null +++ b/backup.sh.save @@ -0,0 +1,21 @@ +#!/bin/bash + +BACKUP_DIR="/backup/$(date +%F_%H-%M)/" +DB_BACKUP_FILE="$BACKUP_DIR/gitea.sql" + +$container_id = docker ps --filter "name=^gitea$" -q +$user = docker inspect -f '{{json .Config.Env}}' $container_id | jq -r '.[] | select(startswith("USER=")) | split("=")[1]' + +PGPASSWORD="$DB_PASSWORD" pg_dump -h database -U $DB_USER -d $DB_DATABASE -F c -b -v -f $DB_BACKUP_FILE + +TARGET_PATH="s3://$BACKUP_SPACE_NAME/backups/$(date +%F_%H-%M)" +BACKUP_FILE=$(date +%F_%H-%M) +tar -czf "backup" + + +s3cmd put --encrypt $BACKUP_DIR* $TARGET_PATH --recursive + + +rm -rf $BACKUP_DIR + +echo "Files have been uploaded to $TARGET_PATH" diff --git a/docker-compose.yaml b/docker-compose.yaml index 3c5c368..080b5c5 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -24,6 +24,7 @@ services: - USER_GID=1000 - GITEA__security__SECRET=${GITEA_SECRET} - GITEA__security__INTERNAL_TOKEN=${GITEA_TOKEN} + - GITEA__security__ENFORCE_TWO_FACTOR_AUTH=true - GITEA__database__DB_TYPE=${DB_TYPE} - GITEA__database__HOST=database:5432 - GITEA__database__NAME=${DB_DATABASE} @@ -67,6 +68,18 @@ services: volumes: - ./postgres/data:/var/lib/postgresql/data + runner_A0: + image: gitea/act_runner + restart: always + networks: + - gitea + environment: + - GITEA_INSTANCE_URL=https://git.openharbor.io + - GITEA_RUNNER_REGISTRATION_TOKEN=${GITEA_RUNNER_A0_REGISTRATION_TOKEN} + - GITEA_RUNNER_NAME=A0 + volumes: + - /var/run/docker.sock:/var/run/docker.sock + networks: gitea: driver: bridge