coolify/scripts/webhook-tunnel.sh
Andras Bacsai 576f38da1c feat(github): add self-hosted Actions runner orchestration
Implement end-to-end GitHub Actions runner support with provisioning,
tracking, and cleanup flows.

- handle `workflow_job` webhooks to provision and tear down runners
- add runner config/execution models, enum states, and relationships
- create jobs for provisioning, cleanup, and stale-runner reaping
- schedule periodic stale runner cleanup in the console kernel
- add Livewire server UI to manage runner configuration and executions
- store GitHub App runner permissions and runner group metadata
- add migrations for runner permissions, configs, executions, and group id
- update GitHub permissions URL generation for organization app settings
- include feature/unit tests for runner behavior and permission paths
2026-03-03 14:27:19 +01:00

51 lines
2 KiB
Bash
Executable file

#!/usr/bin/env bash
#
# webhook-tunnel.sh
#
# Opens a Cloudflare quick tunnel to expose your local Coolify instance
# so GitHub can deliver webhook events during local development.
#
# Usage:
# bash scripts/webhook-tunnel.sh [local_port]
#
# Default local port: 8000
set -euo pipefail
LOCAL_PORT="${1:-8000}"
WEBHOOK_PATH="/source/github/events"
if ! command -v cloudflared &>/dev/null; then
echo ""
echo " ERROR: cloudflared is not installed."
echo " Install it with: brew install cloudflared"
echo ""
exit 1
fi
echo ""
echo " GitHub Webhook Tunnel (via Cloudflare)"
echo " ======================================="
echo " Forwarding: public HTTPS -> localhost:${LOCAL_PORT}"
echo ""
echo " Waiting for tunnel URL..."
echo ""
cloudflared tunnel --url "http://localhost:${LOCAL_PORT}" 2>&1 | while IFS= read -r line; do
if [[ "$line" =~ https://[a-zA-Z0-9_-]+\.trycloudflare\.com ]]; then
TUNNEL_URL="${BASH_REMATCH[0]}"
echo ""
echo " ✔ Tunnel is live!"
echo ""
echo " ┌─────────────────────────────────────────────────────────────────┐"
echo " │ Webhook endpoint: │"
echo "${TUNNEL_URL}${WEBHOOK_PATH}"
echo " │ │"
echo " │ Configure your GitHub App: │"
echo " │ GitHub -> App Settings -> Webhook URL -> paste the URL above │"
echo " │ │"
echo " │ Press Ctrl+C to stop the tunnel. │"
echo " └─────────────────────────────────────────────────────────────────┘"
echo ""
fi
done