From e502500856b3f6cafbdf71ce52271bd8588f54ab Mon Sep 17 00:00:00 2001 From: Baerspektivo Date: Wed, 26 Nov 2025 20:10:58 +0100 Subject: [PATCH] first commit --- .gitea/workflows/build-and-deployment.yaml | 63 ++++++++++++++++++++++ compose.yaml | 18 +++++++ 2 files changed, 81 insertions(+) create mode 100644 .gitea/workflows/build-and-deployment.yaml create mode 100644 compose.yaml diff --git a/.gitea/workflows/build-and-deployment.yaml b/.gitea/workflows/build-and-deployment.yaml new file mode 100644 index 0000000..679542d --- /dev/null +++ b/.gitea/workflows/build-and-deployment.yaml @@ -0,0 +1,63 @@ +--- +name: Build and Deploy +on: + push: + branches: + - main + paths: + - "compose.yaml" + - "config/**" + - ".gitea/workflows/build-and-deployment.yaml" + workflow_dispatch: + +jobs: + deploy: + runs-on: proxmox + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Ensure directory exists + run: | + mkdir -p ${{ secrets.DEPLOY_PATH }} + + - name: Copy compose file + run: cp compose.yaml ${{ secrets.DEPLOY_PATH }} + + - name: Stop containers + run: docker compose down || true + working-directory: ${{ secrets.DEPLOY_PATH }} + + - name: Pull latest images + run: docker compose pull + working-directory: ${{ secrets.DEPLOY_PATH }} + + - name: Start containers with latest image + run: docker compose up -d --force-recreate + working-directory: ${{ secrets.DEPLOY_PATH }} + + - name: Check running containers + run: docker ps + + - name: Wait for container to be healthy + run: | + echo "Waiting for container to become healthy..." + # This loop will wait for up to 5 minutes for the container to report a 'healthy' status. + # It checks the status every 5 seconds. If the container doesn't become healthy + # within the timeout, the script will exit with an error, failing the workflow. + end_time=$(( $(date +%s) + 300 )) # 5 minute timeout + while [ "$(docker inspect -f {{.State.Health.Status}} tor 2>/dev/null || echo 'unhealthy')" != "healthy" ]; do + if [ $(date +%s) -gt $end_time ]; then + echo "Timeout: Container did not become healthy within 5 minutes." + docker logs tor # Print logs for debugging + exit 1 + fi + sleep 5 + echo "Container not healthy yet. Retrying in 5 seconds..." + done + echo "Container is healthy! Proceeding with next step." + + - name: Show tor version + run: | + sleep 5 + docker exec tor cat /app/package.json | grep version || echo "Could not get version" diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..85f7ed4 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,18 @@ +--- +services: + # Dein Tor Proxy + tor: + image: osminogin/tor-simple + container_name: tor-proxy + restart: always + ports: + - "9050:9050" + + # Der Auto-Updater + watchtower: + image: containrrr/watchtower + container_name: watchtower + restart: always + volumes: + - /var/run/docker.sock:/var/run/docker.sock + command: --interval 86400 --cleanup # Prüft alle 24h (86400 sek) und löscht alte Images