feat(sources): add Dokploy source #8
No reviewers
Labels
No labels
bug
docs
duplicate
enhancement
help wanted
invalid
nice-to-have
pre-1.0
question
security
wontfix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jfro/lamplighter!8
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/1-dokploy"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #1
Adds a Dokploy source (
dokploy) with both roles,:problemsand:context, reading Dokploy's REST API (/api/<router>.<procedure>,x-api-keyheader). Written against Dokploy v0.30.11's source.What it reports
One
service:<id>:incidentsignal per application, Compose service, and database:status: error): a warning while the previous containers still run, serious if containers can't be checked, critical if nothing is running. Why is the failed deployment'serrorMessage, and the report starts at itsfinishedAt(looked up viadeployment.all/deployment.allByCompose, for at most 10 failed services per poll)donewith no running container): critical; a container stuckrestarting: criticalExited (2)) while others run: serious.Exited (0)one-shots and old Swarm tasks (<appName>.<slot>.<task>) don't countrunning) → pending;idle(never deployed or stopped in Dokploy) → suppressedServices come from
overview.services(Dokploy ≥ 0.26, includes databases, appName, and server), falling back toproject.allon a 404 (apps and Compose only, no container check, since it gives no appName). Containers come fromdocker.getContainersonce per server the services run on, matched by appName.Settings
URL (with or without
/api), API key (secret), Only these projects, Check that containers are running (needs Docker read; a 403 says to grant it or turn this off), and the usual TLS trust fields.Context queries
services,deployments(10 newest, with status, times, error),deployment_log(tail, default 200 lines, capped at 64 KB from the end), andcontainersfor a service.context_summarysays how many services and projects it sees and how many have failed deploys.Logging
Every failed API call logs
Dokploy: GET <path> <params> failed after N ms: <reason>, a failed poll logs the URL and duration, and successful polls log service/container counts at debug. A server whosedocker psfails (Dokploy returns nothing) is logged and skipped.Screenshots
Settings form with example values, desktop and 390px:
(At 390px the app header's icons overflow to 472px on every page; that's on
maintoo and is passed to the gap audit.)Testing
test/lamplighter/sources/dokploy_test.exs: 19 tests withReq.Teststubs and fixtures shaped afteroverview.services/docker.getContainers(all statuses, two servers, Swarm and Compose names), theproject.allfallback, 401/403/transport errors, and every context querymix precommit: 625 tests pass, no warningsNot yet run against a live Dokploy; the request/response shapes come from Dokploy's source (routers,
@dokploy/trpc-openapiquery coercion), not a running instance.Review (Nye): checked against Dokploy v0.30.11 source. The endpoints, fields and tRPC query coercion all match, and precommit passes (625/625).
F3 (low): containers are matched by
appNameprefix plus any of. - _, so a down appwebpicks up a runningweb-api.1.<task>and is reported as running. Suggest anchoring Swarm tasks as^appName\.\d+\.[a-z0-9]+$and stack tasks as^appName_.+\.\d+\.[a-z0-9]+$, and keeping the dash form for Compose only (^appName-.+-\d+$). Repro test:test/review/dokploy_prefix_test.exs(sent to UW).Non-blocking:
docker: readalso gatesdocker.stopContainer,removeContainerandwriteContainerFile. The setup guide should warn that the container check's permission lets the key stop or remove containers.deployments,deployment_logandcontainerscontext queries ignore the source's project filter (find_service usesprojects: [], and readLogs takes any deploymentId). That's fine if intended; worth a line in the moduledoc.9de9067d4b8610690ebbRe-review (Nye) at
8610690(rebase of9de9067on main): the F3 fix holds for Swarm replicated services and precommit passes (627).F6 (low), still open: the exact-name match has two gaps.
<service>.<nodeID>.<taskID>(no numeric slot), so the match drops them; a global app whose tasks keep restarting shows as running.<appName>-), so a Compose appappborrowsapp-two's containers, the same hole as F3. Compose names are<project>-<service>-<n>; match on thecom.docker.compose.projectlabel (or^<appName>-[^-]+-\d+$) instead.Failing test:
test/review/dokploy_match_test.exs(2 of 3 fail on8610690).8610690ebb25ccc76383Re-review at
25ccc76(Nye): ready.<app>.<nodeID>.<task>) now match, so a restarting global app reports failing; each container goes to the longest appName that fits on its server, so "app" no longer picks up "app-two"'s containers.mix precommit: 664 tests pass. CI green.container_patterns/1is rebuilt per container×service pair; could precompute per service.