From c6024db849ac8d20f54a3fcb4b227d6f745b7f50 Mon Sep 17 00:00:00 2001 From: Chris Anderson Date: Wed, 24 Jun 2026 10:42:28 +0200 Subject: [PATCH] Disable Gitea Actions, use manual deploy script - Gitea Actions runner has Docker networking issues - Created deploy.sh for manual deployment - Created webhook.sh for future webhook-based deployment - Deployment is now: git pull && ./deploy.sh Co-Authored-By: Paperclip --- .gitea/workflows/deploy.yml | 19 ------------------- deploy.sh | 24 +++++++----------------- webhook.sh | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+), 36 deletions(-) delete mode 100644 .gitea/workflows/deploy.yml create mode 100755 webhook.sh diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml deleted file mode 100644 index 56a24851..00000000 --- a/.gitea/workflows/deploy.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Deploy hatch.surf - -on: - push: - branches: [main] - workflow_dispatch: - -jobs: - deploy: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Build and Deploy - run: | - chmod +x deploy.sh - ./deploy.sh diff --git a/deploy.sh b/deploy.sh index 2cb3f235..25efab3a 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,34 +1,24 @@ #!/bin/bash -# Deploy hatch.surf -# Run this script to build and deploy the Docker container +# Deploy hatch.surf - triggered by Gitea webhook or manually set -e echo "=== Deploying hatch.surf ===" +cd /home/nara/apps/web -# Build the Docker image -echo "Building Docker image..." +# Pull latest changes +git pull origin main + +# Build and deploy docker build -t hatch-web:latest . - -# Stop existing container -echo "Stopping existing container..." docker stop hatch-web 2>/dev/null || true docker rm hatch-web 2>/dev/null || true - -# Start new container -echo "Starting new container..." docker compose up -d -# Wait for health check -echo "Waiting for container to be healthy..." -sleep 5 - # Verify +sleep 5 if curl -s -o /dev/null -w "%{http_code}" http://localhost:8080 | grep -q "200"; then echo "✅ hatch.surf deployed successfully!" - echo " Container: hatch-web" - echo " Port: 8080" - echo " Status: $(curl -s -o /dev/null -w "%{http_code}" http://localhost:8080)" else echo "❌ Deployment failed!" docker logs hatch-web diff --git a/webhook.sh b/webhook.sh new file mode 100755 index 00000000..5508476b --- /dev/null +++ b/webhook.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Webhook endpoint for Gitea - triggers deployment +# Add this to Gitea repository webhooks: http://localhost:9000/deploy + +PORT=9000 +SCRIPT_DIR="/home/nara/apps/web" + +echo "Starting webhook server on port $PORT..." + +while true; do + # Wait for HTTP request + REQUEST=$(nc -l -p $PORT -q 1 2>/dev/null) + + if echo "$REQUEST" | grep -q "POST /deploy"; then + echo "Webhook received - deploying..." + $SCRIPT_DIR/deploy.sh >> /tmp/hatch-deploy.log 2>&1 + echo "Deploy complete" + fi +done