#!/bin/bash # Resume Site - Gitea Setup and Push Script set -e GITEA_URL="http://192.168.1.49:13001" GITEA_USER="admin" REPO_NAME="resume-site" echo "=== Resume Site - Gitea Setup ===" echo "" echo "This script will:" echo "1. Create the Gitea repository (requires admin password)" echo "2. Push the code to Gitea" echo "3. Verify Flux is syncing" echo "" # Prompt for password read -sp "Enter Gitea admin password: " GITEA_PASSWORD echo "" # Create repository via API echo "Creating repository in Gitea..." RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "$GITEA_URL/api/v1/admin/users/$GITEA_USER/repos" \ -u "$GITEA_USER:$GITEA_PASSWORD" \ -H "Content-Type: application/json" \ -d "{ \"name\": \"$REPO_NAME\", \"description\": \"Nicholas Haven Resume Site - Automated deployment via Flux CD\", \"private\": false, \"auto_init\": false }") HTTP_CODE=$(echo "$RESPONSE" | tail -n1) BODY=$(echo "$RESPONSE" | head -n-1) if [ "$HTTP_CODE" = "201" ]; then echo "✓ Repository created successfully" elif [ "$HTTP_CODE" = "409" ]; then echo "✓ Repository already exists" else echo "⚠ API response: $HTTP_CODE" echo "$BODY" fi # Configure git remote echo "" echo "Configuring git remote..." git remote remove origin 2>/dev/null || true git remote add origin "http://$GITEA_USER:$GITEA_PASSWORD@192.168.1.49:13001/$GITEA_USER/$REPO_NAME.git" # Push code echo "Pushing code to Gitea..." git branch -M main git push -u origin main echo "" echo "✓ Code pushed successfully!" echo "" # Clean up credentials from remote URL git remote remove origin git remote add origin "$GITEA_URL/$GITEA_USER/$REPO_NAME.git" echo "Waiting for Flux to sync..." sleep 10 # Check Flux status echo "" echo "=== Flux Status ===" kubectl get gitrepository -n flux-system resume-site echo "" kubectl get helmrelease -n default resume-site echo "" # Check build trigger echo "=== Build Trigger Status ===" kubectl get cronjob -n resume-site resume-site-build-trigger echo "" echo "=== Next Steps ===" echo "" echo "1. Monitor the build: kubectl get jobs -n flux-builds -l app=resume-site" echo "2. Check build logs: kubectl logs -n flux-builds -l app=resume-site" echo "3. Watch deployment: kubectl get pods -n default -l app.kubernetes.io/name=resume-site" echo "4. Once deployed, visit: https://resume.caffeinetux.com" echo "" echo "The build trigger runs every 5 minutes and will automatically" echo "build new images when you push commits to the main branch." echo ""