Schedule icon
Request icon
Log icon
Switch icon
SlackIncomingWebhook icon
OutputValues icon

Forgejo Git Forge Health, Storage Engine, and Repository Sentinel

Audit Forgejo Git forge platform health, validate database connection pooling and repository storage engine readiness, and alert Slack via Kestra.

Categories
Infrastructure

How it works

  1. Automated Heartbeat Trigger: A scheduled cron trigger initiates an automated sentinel audit every 15 minutes, or execution is triggered on-demand via webhook or manual trigger.
  2. Multi-Stage Service Probes:
    • probe_healthz: Queries the native Forgejo /api/healthz endpoint to verify database connection pool stability, worker queues, and internal cache readiness.
    • probe_version: Queries /api/v1/version to confirm API gateway responsiveness and deployment version consistency.
    • probe_nodeinfo: Queries /api/v1/node/info to inspect cluster node metrics, Git binary compatibility, and user footprint.
    • probe_repository_engine: Queries /api/v1/repos/search?limit=5 to validate that the Git repository storage engine, bleve search indexer, and disk mounts are responsive.
  3. Pebble Health Classification: Evaluates HTTP status codes, latency thresholds, and JSON responses to classify the cluster state into OPERATIONAL, DEGRADED, or CRITICAL.
  4. Switch Routing & Safe Remediation:
    • CRITICAL: Emits high-priority error diagnostics and dispatches an immediate incident webhook alert to Slack containing failure details.
    • DEGRADED: Logs a warning for elevated probe latencies or indexer delays and dispatches a Slack notification if warning alerts are enabled.
    • OPERATIONAL: Logs a health verification summary with version and cluster statistics.
  5. Structured Telemetry Output: Emits structured outputs via io.kestra.plugin.core.output.OutputValues for downstream monitoring dashboards, APM tools, or data warehouse landing.
  6. Error Incident Fallback: Dedicated errors task handles uncaught network timeouts or connection drops, alerting SRE teams instantly.

What you get

  • Continuous validation of the Forgejo self-hosted software forge and Git repository engine.
  • Automated detection of database connection pool exhaustion or indexer corruption before users encounter failed git pushes or pull request errors.
  • Configurable multi-threshold alerting to Slack with rich message blocks and error diagnostics.
  • Comprehensive telemetry audit log with timestamped metrics for long-term health tracking.
  • Zero vendor lock-in, fully testable against standard open-source Forgejo Docker images.

Who it's for

  • DevOps & Platform Engineers: Ensuring continuous availability of developer Git infrastructure and CI/CD triggers.
  • Site Reliability Engineers (SREs): Automating proactive drift detection and platform heartbeat monitoring without external SaaS dependencies.
  • Engineering Managers: Maintaining high SLA uptime for internal self-hosted code repositories and Codeberg/Forgejo mirrors.

Why orchestrate this with Kestra

  • Declarative YAML Workflows: Define your infrastructure monitoring alongside your CI/CD pipelines in version-controlled Git repositories.
  • Built-in Resilience & Retries: Automatically handle transient network jitter with configurable retry policies on individual probe tasks.
  • Stateful Flow Control: Seamlessly branch between operational logs and multi-channel incident dispatches without writing fragile shell scripts.
  • Unified Telemetry & Auditability: Every execution retains full output history, timing metrics, and response payloads for forensic analysis.

Prerequisites

  • An operational Forgejo instance (accessible via HTTP or HTTPS).
  • Network connectivity from the Kestra worker to the Forgejo instance.
  • (Optional) An incoming Slack Webhook URL for incident notifications.
  • (Optional) A Forgejo API personal access token if your instance enforces private mode (REQUIRE_SIGNIN_VIEW = true).

Secrets

  • SLACK_WEBHOOK_URL: (Optional) Slack Incoming Webhook URL to dispatch alerts on degraded or critical status.
  • FORGEJO_API_TOKEN: (Optional) Personal access token for authenticated API requests if the Forgejo instance is in private mode.

Quick start

  1. Start a local Forgejo container for testing:
    docker run -d --name forgejo -p 3000:3000 codeberg.org/forgejo/forgejo:9
    
  2. Add the SLACK_WEBHOOK_URL secret in your Kestra namespace or pass it as an execution input.
  3. Import this flow into your Kestra instance.
  4. Execute the flow manually with forgejo_url: http://localhost:3000 to verify connectivity.
  5. Enable the schedule trigger for continuous 15-minute background monitoring.

How to extend

  • PagerDuty / Opsgenie Escalation: Add incident management tasks to trigger on-call pages when consecutive probes enter CRITICAL state.
  • Git Push/Pull Smoke Test: Add a container task running git clone and git push against an automated canary repository to test the SSH/HTTP Git wire protocol end-to-end.
  • Disk Space Monitoring: Query the Forgejo admin API /api/v1/admin/cron to trigger internal repository garbage collection and storage quota checks.
  • Prometheus Metric Export: Push probe latency and health scores to a Prometheus Pushgateway or OpenTelemetry collector for unified Grafana dashboards.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.