diff --git a/.gitea/workflows/dev-deploy.yml b/.gitea/workflows/dev-deploy.yml index 6698077..a509893 100644 --- a/.gitea/workflows/dev-deploy.yml +++ b/.gitea/workflows/dev-deploy.yml @@ -54,8 +54,8 @@ jobs: HEALTH_PORT="3001" IMAGE_NAME="${{ env.DOCKER_IMAGE }}:${{ env.IMAGE_TAG }}" - # Backup current container ID if running - OLD_CONTAINER=$(docker ps -q -f name=$CONTAINER_NAME || echo "") + # Check for existing container (running or stopped) + EXISTING_CONTAINER=$(docker ps -aq -f name=$CONTAINER_NAME || echo "") # Export environment variables export NODE_ENV=production @@ -71,11 +71,21 @@ jobs: export N8N_SECRET_TOKEN=${N8N_SECRET_TOKEN:-''} export PORT=${HEALTH_PORT} - # Stop and remove old container if it exists - if [ ! -z "$OLD_CONTAINER" ]; then - echo "πŸ›‘ Stopping old container..." - docker stop $OLD_CONTAINER 2>/dev/null || true - docker rm $OLD_CONTAINER 2>/dev/null || true + # Stop and remove existing container if it exists (running or stopped) + if [ ! -z "$EXISTING_CONTAINER" ]; then + echo "πŸ›‘ Stopping and removing existing container..." + docker stop $EXISTING_CONTAINER 2>/dev/null || true + docker rm $EXISTING_CONTAINER 2>/dev/null || true + echo "βœ… Old container removed" + fi + + # Also check if port is in use by another process and free it + PORT_IN_USE=$(lsof -ti:${HEALTH_PORT} 2>/dev/null || echo "") + if [ ! -z "$PORT_IN_USE" ]; then + echo "⚠️ Port ${HEALTH_PORT} is in use by process $PORT_IN_USE" + echo "Attempting to free the port..." + kill -9 $PORT_IN_USE 2>/dev/null || true + sleep 2 fi # Start new container with updated image diff --git a/app/api/n8n/hardcover/currently-reading/route.ts b/app/api/n8n/hardcover/currently-reading/route.ts index 0ec007c..03b3bd7 100644 --- a/app/api/n8n/hardcover/currently-reading/route.ts +++ b/app/api/n8n/hardcover/currently-reading/route.ts @@ -81,7 +81,7 @@ export async function GET(request: NextRequest) { let data: unknown; try { data = JSON.parse(raw); - } catch (parseError) { + } catch (_parseError) { // Sometimes upstream sends HTML or a partial response; include a snippet for debugging. const snippet = raw.slice(0, 240); throw new Error( diff --git a/app/api/n8n/status/route.ts b/app/api/n8n/status/route.ts index 45aab8a..b597d83 100644 --- a/app/api/n8n/status/route.ts +++ b/app/api/n8n/status/route.ts @@ -80,7 +80,7 @@ export async function GET(request: NextRequest) { let data: unknown; try { data = JSON.parse(raw); - } catch (parseError) { + } catch (_parseError) { // Sometimes upstream sends HTML or a partial response; include a snippet for debugging. const snippet = raw.slice(0, 240); throw new Error( diff --git a/app/components/Footer.tsx b/app/components/Footer.tsx index 6308938..7c3a51f 100644 --- a/app/components/Footer.tsx +++ b/app/components/Footer.tsx @@ -1,6 +1,6 @@ "use client"; -import { useState, useEffect } from 'react'; +import { useState } from 'react'; import { motion } from 'framer-motion'; import { Heart, Code } from 'lucide-react'; import { SiGithub, SiLinkedin } from 'react-icons/si'; diff --git a/scripts/check-gitea-runner.sh b/scripts/check-gitea-runner.sh new file mode 100644 index 0000000..8bde2eb --- /dev/null +++ b/scripts/check-gitea-runner.sh @@ -0,0 +1,136 @@ +#!/bin/bash + +# Gitea Runner Status Check Script +# PrΓΌft den Status des Gitea Runners + +set -e + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +CYAN='\033[0;36m' +NC='\033[0m' # No Color + +echo -e "${BLUE}╔════════════════════════════════════════════════════════════╗${NC}" +echo -e "${BLUE}β•‘ Gitea Runner Status Check β•‘${NC}" +echo -e "${BLUE}β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•${NC}" +echo "" + +# Check 1: systemd service +echo -e "${CYAN}[1/5] Checking systemd service...${NC}" +if systemctl list-units --type=service --all | grep -q "gitea-runner.service"; then + echo -e "${GREEN}βœ“ systemd service found${NC}" + systemctl status gitea-runner --no-pager -l || true +else + echo -e "${YELLOW}⚠ systemd service not found (runner might be running differently)${NC}" +fi +echo "" + +# Check 2: Running processes +echo -e "${CYAN}[2/5] Checking for running runner processes...${NC}" +RUNNER_PROCESSES=$(ps aux | grep -E "(gitea|act_runner|woodpecker)" | grep -v grep || echo "") +if [ ! -z "$RUNNER_PROCESSES" ]; then + echo -e "${GREEN}βœ“ Found runner processes:${NC}" + echo "$RUNNER_PROCESSES" | while read line; do + echo " $line" + done +else + echo -e "${RED}βœ— No runner processes found${NC}" +fi +echo "" + +# Check 3: Docker containers (if runner runs in Docker) +echo -e "${CYAN}[3/5] Checking for runner Docker containers...${NC}" +RUNNER_CONTAINERS=$(docker ps -a --filter "name=runner" --format "{{.Names}}\t{{.Status}}" 2>/dev/null || echo "") +if [ ! -z "$RUNNER_CONTAINERS" ]; then + echo -e "${GREEN}βœ“ Found runner containers:${NC}" + echo "$RUNNER_CONTAINERS" | while read line; do + echo " $line" + done +else + echo -e "${YELLOW}⚠ No runner containers found${NC}" +fi +echo "" + +# Check 4: Common runner directories +echo -e "${CYAN}[4/5] Checking common runner directories...${NC}" +RUNNER_DIRS=( + "/tmp/gitea-runner" + "/opt/gitea-runner" + "/home/*/gitea-runner" + "~/.gitea-runner" + "/usr/local/gitea-runner" +) + +FOUND_DIRS=0 +for dir in "${RUNNER_DIRS[@]}"; do + # Expand ~ and wildcards + EXPANDED_DIR=$(eval echo "$dir" 2>/dev/null || echo "") + if [ -d "$EXPANDED_DIR" ]; then + echo -e "${GREEN}βœ“ Found runner directory: $EXPANDED_DIR${NC}" + FOUND_DIRS=$((FOUND_DIRS + 1)) + # Check for config files + if [ -f "$EXPANDED_DIR/.runner" ] || [ -f "$EXPANDED_DIR/config.yml" ]; then + echo " β†’ Contains configuration files" + fi + fi +done + +if [ $FOUND_DIRS -eq 0 ]; then + echo -e "${YELLOW}⚠ No runner directories found in common locations${NC}" +fi +echo "" + +# Check 5: Network connections (check if runner is connecting to Gitea) +echo -e "${CYAN}[5/5] Checking network connections to Gitea...${NC}" +GITEA_URL="${GITEA_URL:-https://git.dk0.dev}" +if command -v netstat >/dev/null 2>&1; then + CONNECTIONS=$(netstat -tn 2>/dev/null | grep -E "(git.dk0.dev|3000|3001)" || echo "") +elif command -v ss >/dev/null 2>&1; then + CONNECTIONS=$(ss -tn 2>/dev/null | grep -E "(git.dk0.dev|3000|3001)" || echo "") +fi + +if [ ! -z "$CONNECTIONS" ]; then + echo -e "${GREEN}βœ“ Found connections to Gitea:${NC}" + echo "$CONNECTIONS" | head -5 +else + echo -e "${YELLOW}⚠ No active connections to Gitea found${NC}" +fi +echo "" + +# Summary +echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" +echo -e "${BLUE}Summary:${NC}" +echo "" + +if [ ! -z "$RUNNER_PROCESSES" ] || [ ! -z "$RUNNER_CONTAINERS" ]; then + echo -e "${GREEN}βœ“ Runner appears to be running${NC}" + echo "" + echo "To check runner status in Gitea:" + echo " 1. Go to: https://git.dk0.dev/denshooter/portfolio/settings/actions/runners" + echo " 2. Check if runner-01 shows as 'online' or 'idle'" + echo "" + echo "To view runner logs:" + if [ ! -z "$RUNNER_PROCESSES" ]; then + echo " - Check process logs or journalctl" + fi + if [ ! -z "$RUNNER_CONTAINERS" ]; then + echo " - docker logs " + fi +else + echo -e "${RED}βœ— Runner does not appear to be running${NC}" + echo "" + echo "To start the runner:" + echo " 1. Find where the runner binary is located" + echo " 2. Check Gitea for registration token" + echo " 3. Run: ./act_runner register --config config.yml" + echo " 4. Run: ./act_runner daemon --config config.yml" +fi + +echo "" +echo -e "${CYAN}For more information, check:${NC}" +echo " - Gitea Runner Docs: https://docs.gitea.com/usage/actions/act-runner" +echo " - Runner Status: https://git.dk0.dev/denshooter/portfolio/settings/actions/runners" +echo ""