chore(homelab): retire git-sync + mirror Gitea, git.plate-software.de now proxies single TrueNAS Gitea
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
services:
|
||||
git-sync:
|
||||
image: alpine/git:latest
|
||||
container_name: git-sync
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./sync.sh:/sync.sh:ro
|
||||
- git-sync-data:/tmp/git-sync
|
||||
entrypoint: ["/bin/sh", "/sync.sh"]
|
||||
environment:
|
||||
# IONOS Gitea token (source of truth — Work Lumen pushes here)
|
||||
IONOS_TOKEN: ${IONOS_TOKEN}
|
||||
# TrueNAS Gitea token (homelab — pull target)
|
||||
TRUENAS_TOKEN: ${TRUENAS_TOKEN}
|
||||
TRUENAS_HOST: 192.168.188.119:30008
|
||||
IONOS_HOST: git.plate-software.de
|
||||
GITEA_USER: pplate
|
||||
# Space-separated list of repos to sync IONOS → TrueNAS
|
||||
# cannamanage.wiki = Gitea wiki (separate git repo)
|
||||
REPOS: cannamanage cannamanage.wiki inspectflow inspectflow.wiki
|
||||
# Sync interval in seconds (300 = 5 minutes)
|
||||
INTERVAL: "300"
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
volumes:
|
||||
git-sync-data:
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "../.."
|
||||
},
|
||||
{
|
||||
"path": "../../../IdeaProjects"
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"java.configuration.updateBuildConfiguration": "automatic"
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
#!/bin/sh
|
||||
# git-sync: bidirectional mirror between IONOS (git.plate-software.de) and TrueNAS Gitea
|
||||
# IONOS = source of truth for cannamanage (Work Lumen pushes there)
|
||||
# TrueNAS push mirror already handles TrueNAS → IONOS for homelab pushes
|
||||
# This script handles the missing direction: IONOS → TrueNAS (pull mirror)
|
||||
|
||||
set -e
|
||||
|
||||
IONOS_TOKEN="${IONOS_TOKEN}"
|
||||
TRUENAS_TOKEN="${TRUENAS_TOKEN}"
|
||||
TRUENAS_HOST="${TRUENAS_HOST:-192.168.188.119:30008}"
|
||||
IONOS_HOST="${IONOS_HOST:-git.plate-software.de}"
|
||||
GITEA_USER="${GITEA_USER:-pplate}"
|
||||
INTERVAL="${INTERVAL:-300}" # 5 minutes default
|
||||
|
||||
WORKDIR="/tmp/git-sync"
|
||||
mkdir -p "$WORKDIR"
|
||||
|
||||
sync_repo() {
|
||||
REPO="$1"
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Syncing $REPO ..."
|
||||
|
||||
IONOS_URL="https://${GITEA_USER}:${IONOS_TOKEN}@${IONOS_HOST}/${GITEA_USER}/${REPO}.git"
|
||||
TRUENAS_URL="http://${GITEA_USER}:${TRUENAS_TOKEN}@${TRUENAS_HOST}/${GITEA_USER}/${REPO}.git"
|
||||
|
||||
REPO_DIR="${WORKDIR}/${REPO}"
|
||||
|
||||
# bare clone has HEAD file instead of .git directory
|
||||
if [ ! -f "${REPO_DIR}/HEAD" ]; then
|
||||
echo " Cloning $REPO from IONOS..."
|
||||
git clone --mirror "$IONOS_URL" "$REPO_DIR"
|
||||
cd "$REPO_DIR"
|
||||
git remote add truenas "$TRUENAS_URL"
|
||||
else
|
||||
cd "$REPO_DIR"
|
||||
# Update remote URLs (tokens may rotate, protocol may change)
|
||||
git remote set-url origin "$IONOS_URL"
|
||||
git remote set-url truenas "$TRUENAS_URL" 2>/dev/null || git remote add truenas "$TRUENAS_URL"
|
||||
echo " Fetching from IONOS..."
|
||||
git fetch --all --prune 2>&1 | tail -5
|
||||
fi
|
||||
|
||||
echo " Pushing to TrueNAS..."
|
||||
git push truenas --all --force 2>&1 | tail -5
|
||||
git push truenas --tags --force 2>&1 | tail -3
|
||||
echo " Done."
|
||||
}
|
||||
|
||||
# Repos to sync IONOS → TrueNAS
|
||||
REPOS="${REPOS:-cannamanage}"
|
||||
|
||||
echo "=== git-sync starting, interval=${INTERVAL}s ==="
|
||||
echo "Repos: $REPOS"
|
||||
|
||||
while true; do
|
||||
for REPO in $REPOS; do
|
||||
sync_repo "$REPO" || echo "[WARN] sync failed for $REPO — will retry next cycle"
|
||||
done
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Sleeping ${INTERVAL}s..."
|
||||
sleep "$INTERVAL"
|
||||
done
|
||||
Reference in New Issue
Block a user