New to Kestra?
Use blueprints to kickstart your first workflows.
Audit CouchDB /_active_tasks for replication lag and stalled compactions, dispatch Slack incident alerts, and automate /_compact maintenance.
Apache CouchDB is an open-source, distributed document-oriented NoSQL database featuring multi-version concurrency control (MVCC) and master-master replication. Organizations rely on CouchDB for edge-to-cloud synchronization, offline-first mobile applications, and multi-region document stores. In distributed environments, background tasks for document replication, view indexing, and database compaction run concurrently and are exposed via the /_active_tasks management API. When network partitions occur, authentication credentials expire, or high-volume document updates saturate worker threads, continuous replication tasks stall and changes_pending accumulates rapidly. If left unchecked, target clusters fall out of synchronization and append-only .couch files exhaust host disk storage. This blueprint provides automated continuous surveillance over /_active_tasks, detects replication backlogs, alerts engineering teams via Slack, and automates safe database compaction via POST /{db}/_compact.
every_fifteen_minutes) initiates diagnostic health verification every 15 minutes, with manual runs supported via customizable inputs.probe_active_tasks) connects to the CouchDB HTTP REST interface (port 5984) via io.kestra.plugin.core.http.Request and queries /_active_tasks with HTTP Basic Authentication.max_pending_changes (CRITICAL), if moderate pending changes exist (WARNING), if all tasks are healthy (HEALTHY), or if the HTTP endpoint was unreachable (PROBE_FAILED).route_by_task_health) switches execution along dedicated paths according to the classified severity.CRITICAL or WARNING states, structured Slack incident cards notify operations channels with cluster host details, pending change counts, and targeted databases.check_remediation) checks whether auto_compact is enabled and dry_run is disabled. If confirmed, trigger_database_compaction dispatches a POST request to /{target_database}/_compact to reclaim disk space from old document revisions and unblock I/O bottlenecks.PROBE_FAILED, dedicated alerts notify administrators of unreachable ports or invalid credentials.log_audit_summary) writes execution metadata and classified status to task logs.POST /{db}/_compact without manual operator intervention./_active_tasks and trigger /{db}/_compact.COUCHDB_USERNAME: Username for authenticating to CouchDB administrative endpoints (e.g. admin).COUCHDB_PASSWORD: Password for the CouchDB administrative user.SLACK_WEBHOOK_URL: Incoming webhook URL for posting incident cards to Slack.COUCHDB_USERNAME, COUCHDB_PASSWORD, and SLACK_WEBHOOK_URL in your Kestra namespace secrets.dry_run: true to verify connectivity against your CouchDB server./_active_tasks response parsing.every_fifteen_minutes schedule trigger to activate automated continuous monitoring and remediation.GET /_node/_local/_up health checks to verify node-level cluster member readiness.io.kestra.plugin.pagerduty.notifications.PagerDutyAlert for continuous replication outages lasting longer than one hour.POST /{db}/_compact/{design_doc} to optimize MapReduce secondary indexes.