feat(queue): offline operation queue for all panel integrations#62
Open
0kaba0hub wants to merge 3 commits into
Open
feat(queue): offline operation queue for all panel integrations#620kaba0hub wants to merge 3 commits into
0kaba0hub wants to merge 3 commits into
Conversation
Zone operations from panel hooks are enqueued into a local SQLite queue (/var/lib/seconddns/queue.db) and delivered immediately; when the SecondDNS API is unreachable (outage or maintenance) they stay queued and a per-minute cron replays them in strict FIFO order once the API is back. No customer operation is lost during SecondDNS downtime. - hosting-panels/common/seconddns-queue: enqueue/flush/status tool (WAL, busy_timeout, flock with portable fallback) - all six bash hooks (plesk/cpanel/directadmin) switched to queue-first + async flush; plesk rename enqueues delete+create - cyberpanel: network errors now caught; retryable failures enqueue via the same tool - installers deploy the tool + /etc/cron.d/seconddns-queue; uninstallers clean up - replay semantics: 409 create / 404 delete = success; 400/422 -> failed (does not block the queue); 5xx/timeout stop the drain - monitoring: nagios_plugins/check_seconddns_queue.sh (-w/-c age thresholds) + zabbix_templates/seconddns_queue.yaml - tests: hosting-panels/common/tests/test_queue.sh — 14 checks with a scripted mock API (FIFO, concurrency, all status branches) Ref: seconddns/k8s_web#265
- new seconddns-queued (python3 stdlib): watches the queue, delivers in strict FIFO, exponential backoff while the API is down, configurable via [queue] section in /etc/seconddns.conf; --once mode for manual flush; systemd unit with Restart=always - hooks are now enqueue-only (single INSERT, never block on API timeouts); delivery goes exclusively through the worker - cyberpanel: add_zone/remove_zone enqueue-only (reads stay direct) - seconddns-queue CLI simplified: enqueue/status; flush execs the worker --once - installers deploy worker + unit and enable the service; no cron - tests: 16 checks, incl. daemon-mode pickup and outage recovery Ref: seconddns/k8s_web#265
0kaba0hub
force-pushed
the
feat/offline-queue
branch
from
July 7, 2026 00:13
434dc5e to
e8095f2
Compare
Collaborator
Author
|
Reworked to the daemon model per review discussion:
Cross-server migration semantics (ownership check by master IP) intentionally NOT included — tracked separately in #63. |
- enqueue pokes /var/lib/seconddns/queued.sock after INSERT; the worker wakes immediately instead of polling - poll_interval becomes a rare fallback tick (default 60s) guarding lost wakeups only - AF_UNIX ~104-byte path limit handled by binding/sending via relative paths; socket dir auto-created Ref: seconddns/k8s_web#265
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When the SecondDNS API is down (outage or maintenance), zone operations fired by customers' panels (Plesk/cPanel/DirectAdmin/CyberPanel hooks) were logged and dropped — zones created during our downtime never reached SecondDNS.
Solution
Local offline queue on the panel server:
hosting-panels/common/seconddns-queue— enqueue/flush/status tool backed by SQLite (/var/lib/seconddns/queue.db, WAL + busy_timeout; flock with a portable fallback)/etc/cron.d/seconddns-queueflushes every minute; once the API is back everything drains automatically in orderfailed, drain continues; timeout/5xx/redirect → drain stops until next tickURLError); retryable failures enqueue via the same toolnagios_plugins/check_seconddns_queue.sh(WARN/CRIT by oldest-op age, perfdata) andzabbix_templates/seconddns_queue.yaml(items + triggers viaUserParameter)Tests
hosting-panels/common/tests/test_queue.sh— self-contained suite with a scripted mock API (14 checks, all passing): enqueue persistence, drain stop on API-down, FIFO order, 409/404 duplicate semantics, hard-error isolation, status exit codes, 20-way concurrent enqueue.Live E2E against the real maintenance switch (k8s_web
scripts/maintenance-on.sh) is the next step per the test plan in seconddns/k8s_web#265.Ref: seconddns/k8s_web#265