@rcpooley/concord 0.4.1 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -46
- package/bin/concord.service +0 -12
- package/dist/api.d.ts +130 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +21 -0
- package/dist/api.js.map +1 -0
- package/dist/cli/client.d.ts +53 -0
- package/dist/cli/client.d.ts.map +1 -0
- package/dist/cli/client.js +152 -0
- package/dist/cli/client.js.map +1 -0
- package/dist/cli/main.js +100 -22
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/remote.d.ts +18 -0
- package/dist/cli/remote.d.ts.map +1 -0
- package/dist/cli/remote.js +161 -0
- package/dist/cli/remote.js.map +1 -0
- package/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +66 -32
- package/dist/daemon.js.map +1 -1
- package/dist/hook.d.ts +9 -5
- package/dist/hook.d.ts.map +1 -1
- package/dist/hook.js +13 -26
- package/dist/hook.js.map +1 -1
- package/dist/init.d.ts +5 -0
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +32 -8
- package/dist/init.js.map +1 -1
- package/dist/plans.d.ts +2 -55
- package/dist/plans.d.ts.map +1 -1
- package/dist/plans.js.map +1 -1
- package/dist/server.d.ts +58 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +247 -0
- package/dist/server.js.map +1 -0
- package/dist-ui/assets/index-BPDholoa.css +1 -0
- package/dist-ui/assets/index-CGA96JMz.js +11 -0
- package/dist-ui/index.html +15 -0
- package/package.json +5 -3
- package/templates/starter/README.md +4 -1
package/README.md
CHANGED
|
@@ -71,9 +71,9 @@ concord init
|
|
|
71
71
|
|
|
72
72
|
`concord init` checks those prerequisites, then:
|
|
73
73
|
|
|
74
|
-
- writes `/etc/concord.env` (root-only, 0600) with a **new age key
|
|
75
|
-
empty `CONCORD_CONFIG_REPO`, and prints the key's public
|
|
76
|
-
repo's `age.pub`;
|
|
74
|
+
- writes `/etc/concord.env` (root-only, 0600) with a **new age key**, a new
|
|
75
|
+
**API token** and an empty `CONCORD_CONFIG_REPO`, and prints the key's public
|
|
76
|
+
half for your config repo's `age.pub`;
|
|
77
77
|
- writes `/etc/systemd/system/concord.service` for this user and this install
|
|
78
78
|
of node;
|
|
79
79
|
- enables and starts the service, which waits until it has a config repo.
|
|
@@ -90,34 +90,52 @@ Or pass `--config-repo <url>` to `concord init` to skip that step. The daemon
|
|
|
90
90
|
needs read access to the repo, so use a URL its user can already fetch, for
|
|
91
91
|
example over ssh with a deploy key.
|
|
92
92
|
|
|
93
|
-
`concord init` is safe to re-run. An existing env file is never
|
|
94
|
-
it holds the key your secrets are encrypted to
|
|
93
|
+
`concord init` is safe to re-run. An existing env file is never rewritten, since
|
|
94
|
+
it holds the key your secrets are encrypted to; settings an older install lacks
|
|
95
|
+
(the API token) are appended. An existing unit that differs
|
|
95
96
|
(after moving node, say) is replaced only with `--replace-unit`. `--dry-run`
|
|
96
97
|
shows what it would do.
|
|
97
98
|
|
|
98
99
|
## Usage
|
|
99
100
|
|
|
100
101
|
```
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
concord
|
|
104
|
-
concord keygen # generate an age keypair
|
|
105
|
-
concord secret set KEY # encrypt stdin into the config repo's secrets.ts
|
|
102
|
+
# Writing a config (on your own machine, in the config repo)
|
|
103
|
+
concord new DIR # scaffold a config repo
|
|
104
|
+
concord secret set KEY # encrypt stdin into secrets.ts (needs only age.pub)
|
|
106
105
|
concord secret list # list declared secret names
|
|
106
|
+
|
|
107
|
+
# Talking to a running daemon (on the server, or anywhere that can reach it)
|
|
108
|
+
concord login URL # save the daemon's address and API token
|
|
109
|
+
concord status # reconciling or idle, version, next run
|
|
110
|
+
concord runs [ID] # recent reconciles, or one with its log
|
|
111
|
+
concord reconcile --wait # reconcile now and follow it to the end
|
|
112
|
+
concord plan BRANCH # what merging BRANCH would change
|
|
113
|
+
concord plans # recent plans
|
|
114
|
+
|
|
115
|
+
# On the server
|
|
116
|
+
concord init # install the daemon
|
|
117
|
+
concord plan --local # plan in this process (needs the age key)
|
|
118
|
+
concord run # pull, plan and apply once, outside the daemon
|
|
107
119
|
```
|
|
108
120
|
|
|
109
|
-
|
|
121
|
+
`concord --help` lists every option. Commands that talk to a daemon find it
|
|
122
|
+
from `--server`/`--token`, then `CONCORD_SERVER`/`CONCORD_TOKEN`, then the saved
|
|
123
|
+
login, then — on the server itself — `/etc/concord.env` (read with `sudo`), so
|
|
124
|
+
there they need no setup.
|
|
125
|
+
|
|
126
|
+
Daemon environment (`/etc/concord.env`):
|
|
110
127
|
|
|
111
128
|
| Var | Purpose |
|
|
112
129
|
|---|---|
|
|
113
|
-
| `CONCORD_CONFIG_REPO` | git URL of the config repo (required
|
|
114
|
-
| `CONCORD_AGE_KEY` | age private key, which decrypts secrets at runtime (required
|
|
130
|
+
| `CONCORD_CONFIG_REPO` | git URL of the config repo (required) |
|
|
131
|
+
| `CONCORD_AGE_KEY` | age private key, which decrypts secrets at runtime (required) |
|
|
132
|
+
| `CONCORD_API_TOKEN` | the API's bearer token; without one there is no API or UI. `concord init` generates it |
|
|
133
|
+
| `CONCORD_LISTEN` | API + UI addresses, comma-separated `host:port` (default `127.0.0.1:7600`) |
|
|
134
|
+
| `CONCORD_HOOK_SECRET` | GitHub webhook HMAC secret; unset means no webhook |
|
|
135
|
+
| `CONCORD_HOOK_LISTEN` | webhook addresses (default `127.0.0.1:7601`) |
|
|
136
|
+
| `CONCORD_INTERVAL_SECONDS` | seconds between reconciles (default 900, minimum 30) |
|
|
115
137
|
| `CONCORD_HOME` | working dir, default `~/.concord` |
|
|
116
138
|
| `CONCORD_CONFIG_DIR` | override the config checkout path |
|
|
117
|
-
| `CONCORD_INTERVAL_SECONDS` | daemon: seconds between reconciles (default 900, minimum 30) |
|
|
118
|
-
| `CONCORD_HOOK_SECRET` | daemon: GitHub webhook HMAC secret; unset means no webhook |
|
|
119
|
-
| `CONCORD_HOOK_SOCKET` | daemon: webhook socket (default `/run/concord/hook.sock`) |
|
|
120
|
-
| `CONCORD_UI_SOCKET` | daemon: UI/API socket (default `/run/concord/ui.sock`; `off` disables) |
|
|
121
139
|
|
|
122
140
|
## Running the daemon
|
|
123
141
|
|
|
@@ -125,7 +143,7 @@ The daemon runs under systemd as an ordinary user with passwordless `sudo`
|
|
|
125
143
|
(the apt, file and systemd modules need it). `bin/concord.service` is the
|
|
126
144
|
template `concord init` renders the unit from. It reads its whole
|
|
127
145
|
configuration from `/etc/concord.env` (mode 0600, because it holds the age
|
|
128
|
-
key).
|
|
146
|
+
key and the API token).
|
|
129
147
|
|
|
130
148
|
**Until `CONCORD_CONFIG_REPO` and `CONCORD_AGE_KEY` are both set, the daemon
|
|
131
149
|
waits.** It logs which ones are missing and does nothing else. It doesn't
|
|
@@ -137,60 +155,92 @@ Day to day:
|
|
|
137
155
|
|
|
138
156
|
| | |
|
|
139
157
|
|---|---|
|
|
158
|
+
| Status | `concord status`, `concord runs`, or the web UI |
|
|
140
159
|
| Logs | `journalctl -u concord.service` |
|
|
141
|
-
| Reconcile now | `sudo systemctl reload concord` (SIGHUP to the daemon only). Never `systemctl kill -s HUP`, which signals every process in the unit and kills an apply in flight. |
|
|
160
|
+
| Reconcile now | `concord reconcile`, or `sudo systemctl reload concord` (SIGHUP to the daemon only). Never `systemctl kill -s HUP`, which signals every process in the unit and kills an apply in flight. |
|
|
142
161
|
| Stop | `sudo systemctl stop concord` finishes the cycle in flight first (up to 5 minutes) |
|
|
143
162
|
| Update | Concord never updates itself. The daemon logs a warning each cycle when a newer version exists: `sudo npm install -g @rcpooley/concord@<version>`, then `sudo systemctl restart concord`. |
|
|
144
163
|
|
|
145
|
-
|
|
146
|
-
on `CONCORD_HOOK_SOCKET` for GitHub push deliveries, verifies the HMAC, and
|
|
147
|
-
reconciles. It never parses the payload, because Concord resolves every tracked
|
|
148
|
-
ref itself, so one org-level webhook covers every repo. Route a public HTTPS
|
|
149
|
-
endpoint to the socket with your reverse proxy. If the route breaks, deploys
|
|
150
|
-
are slower, never lost: the interval still runs.
|
|
164
|
+
## The two servers: API + UI, and the webhook
|
|
151
165
|
|
|
152
|
-
|
|
166
|
+
The daemon serves HTTP on two separate servers, so access level follows the
|
|
167
|
+
port:
|
|
153
168
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
169
|
+
| | API + UI | Webhook |
|
|
170
|
+
|---|---|---|
|
|
171
|
+
| Listens on | `CONCORD_LISTEN` (default `127.0.0.1:7600`) | `CONCORD_HOOK_LISTEN` (default `127.0.0.1:7601`) |
|
|
172
|
+
| Serves | the web UI, `/api/*`, `/healthz` | `POST /hook`, `/healthz` — nothing else |
|
|
173
|
+
| Auth | `Authorization: Bearer $CONCORD_API_TOKEN` on every `/api` request | the GitHub HMAC signature |
|
|
174
|
+
| Runs when | `CONCORD_API_TOKEN` is set | `CONCORD_HOOK_SECRET` is set |
|
|
175
|
+
| Exposure | private only: loopback, an ssh tunnel, a VPN address | the only one that may face the internet |
|
|
158
176
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
177
|
+
An address that can't be bound yet (a VPN address before the VPN is up at boot)
|
|
178
|
+
is retried every 30 seconds. Neither server is ever load-bearing: if one is
|
|
179
|
+
down, the UI is missing or deploys are slower, but the interval still
|
|
180
|
+
reconciles.
|
|
181
|
+
|
|
182
|
+
**Reaching the UI.** On the server, it's at `http://127.0.0.1:7600`. From your
|
|
183
|
+
own machine, the simplest is an ssh tunnel:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
ssh -L 7600:127.0.0.1:7600 you@server # then open http://127.0.0.1:7600
|
|
187
|
+
concord login http://127.0.0.1:7600 # and the CLI works through it too
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Or add a private (VPN) address to `CONCORD_LISTEN`, or put it behind a reverse
|
|
191
|
+
proxy with TLS. A proxy may add the `Authorization` header itself, in which case
|
|
192
|
+
neither the UI nor the CLI asks for a token through it. **Never expose the API
|
|
193
|
+
on a public address without TLS**: the token is a bearer credential.
|
|
194
|
+
|
|
195
|
+
**The webhook is optional.** With `CONCORD_HOOK_SECRET` set, point a GitHub
|
|
196
|
+
(org-level) push webhook at `https://<public host>/hook`, routed by your reverse
|
|
197
|
+
proxy to the webhook server. The daemon verifies the HMAC and reconciles; it
|
|
198
|
+
never parses the payload, because Concord resolves every tracked ref itself, so
|
|
199
|
+
one org-level webhook covers every repo. If the route breaks, deploys are
|
|
200
|
+
slower, never lost.
|
|
201
|
+
|
|
202
|
+
## Planning a change
|
|
203
|
+
|
|
204
|
+
Work on a branch, push it, plan it, then merge it. Merging is the deploy.
|
|
162
205
|
|
|
163
206
|
```bash
|
|
164
207
|
git checkout -b my-change origin/main # in your config repo
|
|
165
208
|
# edit, npm run typecheck, commit
|
|
166
209
|
git push -u origin my-change
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
-d "{\"branch\": \"my-change\", \"sha\": \"$(git rev-parse HEAD)\"}"
|
|
170
|
-
# read result.modules[].ops, then merge my-change into main
|
|
210
|
+
concord plan my-change --sha "$(git rev-parse HEAD)"
|
|
211
|
+
# read the changes, then merge my-change into main
|
|
171
212
|
```
|
|
172
213
|
|
|
173
214
|
- A plan is the whole desired state of the branch, so **a branch behind `main`
|
|
174
215
|
is refused**, because it would show someone else's change being undone.
|
|
175
216
|
Rebase onto `origin/main` and push again.
|
|
176
|
-
-
|
|
177
|
-
-
|
|
178
|
-
|
|
179
|
-
- Plans run one at a time, in a child `concord plan --
|
|
180
|
-
|
|
217
|
+
- `--sha` is optional; when given, the plan is refused unless the branch is at it.
|
|
218
|
+
- The command exits 0 when the plan ran (with or without changes) and 1 when it
|
|
219
|
+
was refused or failed. `--json` prints the whole plan.
|
|
220
|
+
- Plans run one at a time, in a child `concord plan --local` against a clone of
|
|
221
|
+
their own (`$CONCORD_HOME/plans`), never the daemon's checkout.
|
|
222
|
+
|
|
223
|
+
### The API
|
|
224
|
+
|
|
225
|
+
All under the API server, all needing the bearer token. Request and response
|
|
226
|
+
types are in [`src/api.ts`](src/api.ts).
|
|
181
227
|
|
|
182
228
|
| | |
|
|
183
229
|
|---|---|
|
|
184
|
-
| `GET /api/status` | idle or reconciling, next run,
|
|
185
|
-
| `GET /api/runs`, `/api/runs/<id>` | recent reconciles; the detail has the log |
|
|
186
|
-
| `POST /api/
|
|
187
|
-
| `
|
|
230
|
+
| `GET /api/status` | idle or reconciling, next run, version and staleness |
|
|
231
|
+
| `GET /api/runs?limit=N`, `/api/runs/<id>` | recent reconciles; the detail has the log |
|
|
232
|
+
| `POST /api/reconcile` | reconcile now (`started`, or `queued` behind a run in flight) |
|
|
233
|
+
| `POST /api/plans?wait=S` `{branch, sha?}` | queue a plan (`202`); `400` bad input, `429` queue full. `wait` holds the request until it finishes (at most 600 s) |
|
|
234
|
+
| `GET /api/plans`, `/api/plans/<id>?wait=S` | recent plans; the detail has the changes per module and the log |
|
|
188
235
|
|
|
189
236
|
A plan's `status` is `queued`, `running`, `planned`, `refused` (behind main, no
|
|
190
237
|
such branch, sha mismatch; see `error`) or `failed` (the plan aborted, timed
|
|
191
238
|
out, or crashed). `result.modules[].ops` are the changes; `ahead` is what the
|
|
192
239
|
branch adds over main.
|
|
193
240
|
|
|
241
|
+
The web UI is a separate client of this API (`ui/`, Vite + React), built into
|
|
242
|
+
the package and served by the API server.
|
|
243
|
+
|
|
194
244
|
## Authoring a config repo
|
|
195
245
|
|
|
196
246
|
A config repo needs this package as a dev dependency (for the types and the
|
package/bin/concord.service
CHANGED
|
@@ -23,18 +23,6 @@ Type=simple
|
|
|
23
23
|
User={{USER}}
|
|
24
24
|
EnvironmentFile=/etc/concord.env
|
|
25
25
|
|
|
26
|
-
# systemd creates and cleans /run/concord, so the webhook socket has a home
|
|
27
|
-
# that survives nothing and needs no bootstrapping. A reverse proxy in a
|
|
28
|
-
# container should bind-mount this DIRECTORY, never the socket file — a file bind mount would pin the old inode
|
|
29
|
-
# the moment the daemon restarted and recreated it.
|
|
30
|
-
RuntimeDirectory=concord
|
|
31
|
-
RuntimeDirectoryMode=0755
|
|
32
|
-
# Without this, systemd DELETES and recreates /run/concord on every restart —
|
|
33
|
-
# and the proxy's bind mount then points at the old, orphaned directory inode,
|
|
34
|
-
# so every webhook request 502s until the container is recreated. Mounting the
|
|
35
|
-
# directory rather than the socket file is necessary but not sufficient; the
|
|
36
|
-
# directory has to outlive the service too.
|
|
37
|
-
RuntimeDirectoryPreserve=yes
|
|
38
26
|
WorkingDirectory={{HOME}}
|
|
39
27
|
# The node that ran `concord init`, by absolute path: apt, nvm and snap all put
|
|
40
28
|
# it somewhere different. PATH starts with node's own directory so the daemon's
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The daemon's HTTP API: request and response shapes.
|
|
3
|
+
*
|
|
4
|
+
* TYPES ONLY, with no runtime code and no Node imports, so the CLI and the web
|
|
5
|
+
* UI (ui/) can both import it and the three can never disagree about a field.
|
|
6
|
+
*
|
|
7
|
+
* Endpoints, all under the API listener (CONCORD_LISTEN) and all requiring
|
|
8
|
+
* `Authorization: Bearer <CONCORD_API_TOKEN>`:
|
|
9
|
+
*
|
|
10
|
+
* GET /api/status DaemonStatus
|
|
11
|
+
* GET /api/runs?limit=N { runs: RunSummary[] }
|
|
12
|
+
* GET /api/runs/<id> RunRecord
|
|
13
|
+
* POST /api/reconcile ReconcileResponse
|
|
14
|
+
* GET /api/plans?limit=N { plans: PlanSummary[] }
|
|
15
|
+
* POST /api/plans?wait=S PlanRecord & { url } body: PlanRequest
|
|
16
|
+
* GET /api/plans/<id>?wait=S PlanRecord & { url }
|
|
17
|
+
*
|
|
18
|
+
* Errors are `{ error: string }` with a 4xx/5xx status.
|
|
19
|
+
*/
|
|
20
|
+
/** One real reconcile, as the daemon recorded it. */
|
|
21
|
+
export interface RunRecord {
|
|
22
|
+
id: string;
|
|
23
|
+
/** What asked for it: `interval`, `startup`, `webhook`, `SIGHUP`. */
|
|
24
|
+
trigger: string;
|
|
25
|
+
/** `interrupted`: the daemon stopped (or was killed) before the run finished. */
|
|
26
|
+
status: 'running' | 'converged' | 'changed' | 'aborted' | 'error' | 'interrupted';
|
|
27
|
+
startedAt: string;
|
|
28
|
+
finishedAt?: string;
|
|
29
|
+
/** Config commit that was reconciled. */
|
|
30
|
+
sha?: string;
|
|
31
|
+
totalOps?: number;
|
|
32
|
+
/** The closing line — "converged", "3 change(s) …", "ABORTED at …". */
|
|
33
|
+
summary?: string;
|
|
34
|
+
log: string[];
|
|
35
|
+
}
|
|
36
|
+
export type RunSummary = Omit<RunRecord, 'log'>;
|
|
37
|
+
export interface DaemonStatus {
|
|
38
|
+
/** The running daemon's package version. */
|
|
39
|
+
version: string;
|
|
40
|
+
startedAt: string;
|
|
41
|
+
intervalSeconds: number;
|
|
42
|
+
/** `sha` for a git checkout, `version` for an npm install. */
|
|
43
|
+
reconciler: {
|
|
44
|
+
sha?: string;
|
|
45
|
+
version?: string;
|
|
46
|
+
behind?: string;
|
|
47
|
+
};
|
|
48
|
+
reconciling: boolean;
|
|
49
|
+
/** When the next interval run is due, if the daemon is sleeping. */
|
|
50
|
+
nextRunAt?: string;
|
|
51
|
+
configRepo?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface RunList {
|
|
54
|
+
runs: RunSummary[];
|
|
55
|
+
}
|
|
56
|
+
/** `started` woke the daemon; `queued` means a run was in flight and one more will follow it. */
|
|
57
|
+
export interface ReconcileResponse {
|
|
58
|
+
status: 'started' | 'queued';
|
|
59
|
+
}
|
|
60
|
+
export type PlanStatus = 'queued' | 'running' | 'refused' | 'failed' | 'planned';
|
|
61
|
+
/** One module's part of a plan — what `concord plan --result` writes. */
|
|
62
|
+
export interface PlanModule {
|
|
63
|
+
scope: string;
|
|
64
|
+
kind: string;
|
|
65
|
+
id: string;
|
|
66
|
+
host?: string;
|
|
67
|
+
ops: {
|
|
68
|
+
kind: string;
|
|
69
|
+
id: string;
|
|
70
|
+
summary: string;
|
|
71
|
+
}[];
|
|
72
|
+
error?: string;
|
|
73
|
+
unreachable?: boolean;
|
|
74
|
+
}
|
|
75
|
+
export interface PlanResult {
|
|
76
|
+
sha: string;
|
|
77
|
+
totalOps: number;
|
|
78
|
+
failed: boolean;
|
|
79
|
+
skipped: string[];
|
|
80
|
+
unreachable: string[];
|
|
81
|
+
warnings: {
|
|
82
|
+
scope: string;
|
|
83
|
+
message: string;
|
|
84
|
+
}[];
|
|
85
|
+
modules: PlanModule[];
|
|
86
|
+
}
|
|
87
|
+
export interface PlanRecord {
|
|
88
|
+
id: string;
|
|
89
|
+
branch: string;
|
|
90
|
+
/** The sha the caller said the branch should be at, if any. */
|
|
91
|
+
expectedSha?: string;
|
|
92
|
+
/** What the branch actually resolved to — the commit that was planned. */
|
|
93
|
+
sha?: string;
|
|
94
|
+
mainSha?: string;
|
|
95
|
+
/** Commits on the branch that are not on main, newest first. */
|
|
96
|
+
ahead?: {
|
|
97
|
+
sha: string;
|
|
98
|
+
subject: string;
|
|
99
|
+
}[];
|
|
100
|
+
status: PlanStatus;
|
|
101
|
+
/** Why a plan was refused or failed, in one line. */
|
|
102
|
+
error?: string;
|
|
103
|
+
/** A real reconcile was running at some point during this plan. */
|
|
104
|
+
overlappedRun?: boolean;
|
|
105
|
+
requestedAt: string;
|
|
106
|
+
startedAt?: string;
|
|
107
|
+
finishedAt?: string;
|
|
108
|
+
result?: PlanResult;
|
|
109
|
+
log: string[];
|
|
110
|
+
}
|
|
111
|
+
/** The fields a list shows. Logs and results stay on the detail. */
|
|
112
|
+
export type PlanSummary = Omit<PlanRecord, 'log' | 'result'> & {
|
|
113
|
+
totalOps?: number;
|
|
114
|
+
};
|
|
115
|
+
/** Body of POST /api/plans. */
|
|
116
|
+
export interface PlanRequest {
|
|
117
|
+
branch: string;
|
|
118
|
+
/** Refuse the plan unless the branch is at this commit. */
|
|
119
|
+
sha?: string;
|
|
120
|
+
}
|
|
121
|
+
export interface PlanList {
|
|
122
|
+
plans: PlanSummary[];
|
|
123
|
+
}
|
|
124
|
+
export type PlanResponse = PlanRecord & {
|
|
125
|
+
url: string;
|
|
126
|
+
};
|
|
127
|
+
export interface ApiError {
|
|
128
|
+
error: string;
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,qDAAqD;AACrD,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,qEAAqE;IACrE,OAAO,EAAE,MAAM,CAAA;IACf,iFAAiF;IACjF,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,CAAA;IACjF,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,yCAAyC;IACzC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,EAAE,CAAA;CACd;AAED,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;AAE/C,MAAM,WAAW,YAAY;IAC3B,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,EAAE,MAAM,CAAA;IACvB,8DAA8D;IAC9D,UAAU,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC/D,WAAW,EAAE,OAAO,CAAA;IACpB,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED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O,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC1C,MAAM,EAAE,UAAU,CAAA;IAClB,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mEAAmE;IACnE,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,GAAG,EAAE,MAAM,EAAE,CAAA;CACd;AAED,oEAAoE;AACpE,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,EAAE,KAAK,GAAG,QAAQ,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAEpF,+BAA+B;AAC/B,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,2DAA2D;IAC3D,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,WAAW,EAAE,CAAA;CACrB;AAED,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AAEvD,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAA;CACd"}
|
package/dist/api.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The daemon's HTTP API: request and response shapes.
|
|
3
|
+
*
|
|
4
|
+
* TYPES ONLY, with no runtime code and no Node imports, so the CLI and the web
|
|
5
|
+
* UI (ui/) can both import it and the three can never disagree about a field.
|
|
6
|
+
*
|
|
7
|
+
* Endpoints, all under the API listener (CONCORD_LISTEN) and all requiring
|
|
8
|
+
* `Authorization: Bearer <CONCORD_API_TOKEN>`:
|
|
9
|
+
*
|
|
10
|
+
* GET /api/status DaemonStatus
|
|
11
|
+
* GET /api/runs?limit=N { runs: RunSummary[] }
|
|
12
|
+
* GET /api/runs/<id> RunRecord
|
|
13
|
+
* POST /api/reconcile ReconcileResponse
|
|
14
|
+
* GET /api/plans?limit=N { plans: PlanSummary[] }
|
|
15
|
+
* POST /api/plans?wait=S PlanRecord & { url } body: PlanRequest
|
|
16
|
+
* GET /api/plans/<id>?wait=S PlanRecord & { url }
|
|
17
|
+
*
|
|
18
|
+
* Errors are `{ error: string }` with a 4xx/5xx status.
|
|
19
|
+
*/
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which daemon the CLI talks to, and how.
|
|
3
|
+
*
|
|
4
|
+
* Resolved in this order, first match wins:
|
|
5
|
+
*
|
|
6
|
+
* 1. --server URL / --token TOKEN
|
|
7
|
+
* 2. CONCORD_SERVER / CONCORD_TOKEN
|
|
8
|
+
* 3. the saved login (`concord login`), ~/.config/concord/config.json
|
|
9
|
+
* 4. ON the server: the daemon's own /etc/concord.env, read with sudo —
|
|
10
|
+
* so `concord status` there needs no setup at all
|
|
11
|
+
*
|
|
12
|
+
* A server with no token is allowed: a proxy in front of the API may add the
|
|
13
|
+
* token itself, and then the client must not need one.
|
|
14
|
+
*/
|
|
15
|
+
export interface ServerRef {
|
|
16
|
+
url: string;
|
|
17
|
+
token?: string;
|
|
18
|
+
/** Where this came from, for error messages. */
|
|
19
|
+
source: string;
|
|
20
|
+
}
|
|
21
|
+
export interface Saved {
|
|
22
|
+
server: string;
|
|
23
|
+
token?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ResolveDeps {
|
|
26
|
+
env: NodeJS.ProcessEnv;
|
|
27
|
+
readSaved: () => Saved | undefined;
|
|
28
|
+
/** The daemon's env file on this machine, if readable. */
|
|
29
|
+
readLocalEnv: () => Record<string, string> | undefined;
|
|
30
|
+
}
|
|
31
|
+
export declare class ClientError extends Error {
|
|
32
|
+
}
|
|
33
|
+
export declare const ENV_FILE = "/etc/concord.env";
|
|
34
|
+
export declare function configPath(env?: NodeJS.ProcessEnv): string;
|
|
35
|
+
/** Strip a trailing slash; add http:// to a bare host:port. */
|
|
36
|
+
export declare function normalizeUrl(url: string): string;
|
|
37
|
+
/** The first CONCORD_LISTEN address, as something a client can dial. */
|
|
38
|
+
export declare function localUrl(listen: string | undefined): string;
|
|
39
|
+
export declare function parseEnvFile(text: string): Record<string, string>;
|
|
40
|
+
export declare function resolveServer(flags: {
|
|
41
|
+
server?: string;
|
|
42
|
+
token?: string;
|
|
43
|
+
}, deps: ResolveDeps): ServerRef;
|
|
44
|
+
export declare function realDeps(env?: NodeJS.ProcessEnv): ResolveDeps;
|
|
45
|
+
export declare function saveLogin(saved: Saved, env?: NodeJS.ProcessEnv): string;
|
|
46
|
+
export declare function forgetLogin(env?: NodeJS.ProcessEnv): boolean;
|
|
47
|
+
export declare class ApiFailure extends ClientError {
|
|
48
|
+
readonly status: number;
|
|
49
|
+
constructor(message: string, status: number);
|
|
50
|
+
}
|
|
51
|
+
/** One API call. `timeoutMs` covers ?wait= requests, which hold open on purpose. */
|
|
52
|
+
export declare function call<T>(ref: ServerRef, method: 'GET' | 'POST', path: string, body?: unknown, timeoutMs?: number): Promise<T>;
|
|
53
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/cli/client.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,gDAAgD;IAChD,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,KAAK;IAC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;CAI1B;AAED,oFAAoF;AACpF,wBAAsB,IAAI,CAAC,CAAC,EAC1B,GAAG,EAAE,SAAS,EACd,MAAM,EAAE,KAAK,GAAG,MAAM,EACtB,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,EACd,SAAS,SAAS,GACjB,OAAO,CAAC,CAAC,CAAC,CA6CZ"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
export class ClientError extends Error {
|
|
6
|
+
}
|
|
7
|
+
export const ENV_FILE = '/etc/concord.env';
|
|
8
|
+
export function configPath(env = process.env) {
|
|
9
|
+
const base = env.XDG_CONFIG_HOME || join(homedir(), '.config');
|
|
10
|
+
return join(base, 'concord', 'config.json');
|
|
11
|
+
}
|
|
12
|
+
/** Strip a trailing slash; add http:// to a bare host:port. */
|
|
13
|
+
export function normalizeUrl(url) {
|
|
14
|
+
const u = /^[a-z]+:\/\//i.test(url) ? url : `http://${url}`;
|
|
15
|
+
return u.replace(/\/+$/, '');
|
|
16
|
+
}
|
|
17
|
+
/** The first CONCORD_LISTEN address, as something a client can dial. */
|
|
18
|
+
export function localUrl(listen) {
|
|
19
|
+
const first = (listen || '127.0.0.1:7600').split(',')[0].trim();
|
|
20
|
+
const m = /^(\[[^\]]+\]|[^:]+):(\d+)$/.exec(first);
|
|
21
|
+
if (!m)
|
|
22
|
+
return 'http://127.0.0.1:7600';
|
|
23
|
+
const host = m[1] === '0.0.0.0' ? '127.0.0.1' : m[1] === '[::]' ? '[::1]' : m[1];
|
|
24
|
+
return `http://${host}:${m[2]}`;
|
|
25
|
+
}
|
|
26
|
+
export function parseEnvFile(text) {
|
|
27
|
+
const out = {};
|
|
28
|
+
for (const line of text.split('\n')) {
|
|
29
|
+
const m = /^\s*([A-Z0-9_]+)=(.*)$/.exec(line);
|
|
30
|
+
if (m)
|
|
31
|
+
out[m[1]] = m[2].trim();
|
|
32
|
+
}
|
|
33
|
+
return out;
|
|
34
|
+
}
|
|
35
|
+
export function resolveServer(flags, deps) {
|
|
36
|
+
const { env } = deps;
|
|
37
|
+
if (flags.server) {
|
|
38
|
+
return { url: normalizeUrl(flags.server), ...tok(flags.token ?? env.CONCORD_TOKEN), source: '--server' };
|
|
39
|
+
}
|
|
40
|
+
if (env.CONCORD_SERVER) {
|
|
41
|
+
return { url: normalizeUrl(env.CONCORD_SERVER), ...tok(flags.token ?? env.CONCORD_TOKEN), source: 'CONCORD_SERVER' };
|
|
42
|
+
}
|
|
43
|
+
const saved = deps.readSaved();
|
|
44
|
+
if (saved)
|
|
45
|
+
return { url: saved.server, ...tok(flags.token ?? saved.token), source: 'concord login' };
|
|
46
|
+
const local = deps.readLocalEnv();
|
|
47
|
+
if (local) {
|
|
48
|
+
return { url: localUrl(local.CONCORD_LISTEN), ...tok(flags.token ?? local.CONCORD_API_TOKEN), source: ENV_FILE };
|
|
49
|
+
}
|
|
50
|
+
throw new ClientError('no Concord server configured — run `concord login <url>`, set CONCORD_SERVER, or pass --server');
|
|
51
|
+
}
|
|
52
|
+
const tok = (t) => (t ? { token: t } : {});
|
|
53
|
+
// -------------------------------------------------------- the real deps ---
|
|
54
|
+
export function realDeps(env = process.env) {
|
|
55
|
+
return {
|
|
56
|
+
env,
|
|
57
|
+
readSaved: () => {
|
|
58
|
+
const p = configPath(env);
|
|
59
|
+
if (!existsSync(p))
|
|
60
|
+
return undefined;
|
|
61
|
+
try {
|
|
62
|
+
const v = JSON.parse(readFileSync(p, 'utf8'));
|
|
63
|
+
return typeof v.server === 'string' ? v : undefined;
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
throw new ClientError(`${p} is not valid JSON — fix it or run \`concord logout\``);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
readLocalEnv: () => {
|
|
70
|
+
if (!existsSync(ENV_FILE))
|
|
71
|
+
return undefined;
|
|
72
|
+
// Root-only (it holds the age key). Never prompts: -n fails instead.
|
|
73
|
+
const r = spawnSync('sudo', ['-n', 'cat', ENV_FILE], { encoding: 'utf8', timeout: 10_000 });
|
|
74
|
+
return r.status === 0 ? parseEnvFile(r.stdout) : undefined;
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export function saveLogin(saved, env = process.env) {
|
|
79
|
+
const p = configPath(env);
|
|
80
|
+
mkdirSync(dirname(p), { recursive: true, mode: 0o700 });
|
|
81
|
+
writeFileSync(p, JSON.stringify(saved, null, 2) + '\n', { mode: 0o600 });
|
|
82
|
+
chmodSync(p, 0o600);
|
|
83
|
+
return p;
|
|
84
|
+
}
|
|
85
|
+
export function forgetLogin(env = process.env) {
|
|
86
|
+
const p = configPath(env);
|
|
87
|
+
if (!existsSync(p))
|
|
88
|
+
return false;
|
|
89
|
+
rmSync(p);
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
// ------------------------------------------------------------- requests ---
|
|
93
|
+
const causeOf = (err) => err.cause?.code ?? err.name;
|
|
94
|
+
const isReset = (err) => ['ECONNRESET', 'EPIPE', 'UND_ERR_SOCKET'].includes(causeOf(err));
|
|
95
|
+
const unreachable = (ref, err) => new ClientError(`cannot reach the Concord daemon at ${ref.url} (${causeOf(err)}; from ${ref.source})`);
|
|
96
|
+
export class ApiFailure extends ClientError {
|
|
97
|
+
status;
|
|
98
|
+
constructor(message, status) {
|
|
99
|
+
super(message);
|
|
100
|
+
this.status = status;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/** One API call. `timeoutMs` covers ?wait= requests, which hold open on purpose. */
|
|
104
|
+
export async function call(ref, method, path, body, timeoutMs = 30_000) {
|
|
105
|
+
const send = () => fetch(ref.url + path, {
|
|
106
|
+
method,
|
|
107
|
+
headers: {
|
|
108
|
+
...(ref.token ? { authorization: `Bearer ${ref.token}` } : {}),
|
|
109
|
+
...(body !== undefined ? { 'content-type': 'application/json' } : {}),
|
|
110
|
+
},
|
|
111
|
+
...(body !== undefined ? { body: JSON.stringify(body) } : {}),
|
|
112
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
113
|
+
});
|
|
114
|
+
let res;
|
|
115
|
+
try {
|
|
116
|
+
res = await send();
|
|
117
|
+
}
|
|
118
|
+
catch (err) {
|
|
119
|
+
// A reconcile can keep the daemon busy long enough for its server to close
|
|
120
|
+
// an idle keep-alive connection just as we reuse it: a reset, not a dead
|
|
121
|
+
// daemon. A read is safe to send again once.
|
|
122
|
+
if (method === 'GET' && isReset(err)) {
|
|
123
|
+
try {
|
|
124
|
+
res = await send();
|
|
125
|
+
}
|
|
126
|
+
catch (again) {
|
|
127
|
+
throw unreachable(ref, again);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else
|
|
131
|
+
throw unreachable(ref, err);
|
|
132
|
+
}
|
|
133
|
+
const text = await res.text();
|
|
134
|
+
let json;
|
|
135
|
+
try {
|
|
136
|
+
json = text ? JSON.parse(text) : undefined;
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
json = undefined;
|
|
140
|
+
}
|
|
141
|
+
if (res.status === 401) {
|
|
142
|
+
throw new ApiFailure(`the daemon at ${ref.url} rejected the token (from ${ref.source}) — \`concord login ${ref.url}\` with the right one`, 401);
|
|
143
|
+
}
|
|
144
|
+
if (!res.ok) {
|
|
145
|
+
const msg = json?.error ?? `HTTP ${res.status}`;
|
|
146
|
+
throw new ApiFailure(msg, res.status);
|
|
147
|
+
}
|
|
148
|
+
if (json === undefined)
|
|
149
|
+
throw new ClientError(`${ref.url}${path} did not return JSON — is this a Concord daemon?`);
|
|
150
|
+
return json;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/cli/client.ts"],"names":[],"mapp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