@rcpooley/concord-kit 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 CHANGED
@@ -157,3 +157,33 @@ route opts into), `secretFiles`, `logFormats` and `rateLimits`.
157
157
  Also exported: `nginxEdge()` itself, `certFor`, `covers`, `EDGE_CONF`,
158
158
  `PROXY_CONF`, and the per-machine pieces (`dockerAptRepo`, `DOCKER_PACKAGES`,
159
159
  `nodeExporterUnit`) if you want to assemble differently.
160
+
161
+ ## Routing the Concord daemon through an edge
162
+
163
+ The daemon has two HTTP servers: the API and UI (`CONCORD_LISTEN`, token
164
+ required) and the GitHub webhook (`CONCORD_HOOK_LISTEN`, signature required).
165
+ The edge runs in a container, which cannot reach the host's loopback, so have
166
+ the daemon also listen on an address the container can reach — a private
167
+ (VPN) address of the machine — and route to that:
168
+
169
+ ```ts
170
+ // /etc/concord.env on the machine:
171
+ // CONCORD_LISTEN=127.0.0.1:7600,10.0.0.1:7600
172
+ // CONCORD_HOOK_LISTEN=10.0.0.1:7601
173
+
174
+ export const concord: App<Host, typeof ZONES> = {
175
+ name: 'concord',
176
+ host: 'web',
177
+ routes: [
178
+ // Private plane only: the UI and API. Add the token here (a secret file
179
+ // with `proxy_set_header Authorization "Bearer …";`, via secretInclude)
180
+ // and the UI and CLI need no login through this route.
181
+ { names: ['concord.internal.example.com'], listen: 'private', upstream: { address: '10.0.0.1', port: 7600 } },
182
+ // Public: ONLY the webhook server. Nothing else is on that port.
183
+ { names: ['concord-hook.example.com'], listen: 'public', upstream: { address: '10.0.0.1', port: 7601 } },
184
+ ],
185
+ }
186
+ ```
187
+
188
+ Then point the GitHub webhook at `https://concord-hook.example.com/hook`.
189
+
@@ -59,9 +59,9 @@ export type Upstream =
59
59
  port: number;
60
60
  }
61
61
  /**
62
- * A unix socket bind-mounted in from the host. The way to reach a process
63
- * that is NOT a container, such as the Concord daemon's webhook and UI
64
- * sockets in /run/concord.
62
+ * A unix socket bind-mounted in from the host, for a process that is not a
63
+ * container and listens only on a socket. (The edge mounts no host socket
64
+ * directory itself; one that needs this must add the mount.)
65
65
  */
66
66
  | {
67
67
  socket: string;
@@ -599,16 +599,6 @@ export function nginxEdge(opts) {
599
599
  { hostPath: CONF_DIR, mountPath: EDGE_CONF, readOnly: true },
600
600
  { hostPath: `${ROOT}/secrets`, mountPath: '/etc/nginx/secrets', readOnly: true },
601
601
  { hostPath: CERT_DIR, mountPath: '/certs', readOnly: true },
602
- // The Concord daemon runs on the HOST under systemd, so there is no
603
- // network alias to proxy to; it listens on unix sockets in its
604
- // systemd RuntimeDirectory instead (the webhook and the UI). Read-only is fine: connect() on
605
- // a socket is not a filesystem write (sb_permission only returns
606
- // EROFS for REG/DIR/LNK), so a ro mount still connects.
607
- //
608
- // ⚠️ concord.service MUST keep RuntimeDirectoryPreserve=yes. Without
609
- // it a daemon restart deletes and recreates /run/concord, this mount
610
- // stays pinned to the orphaned inode, and every webhook 502s.
611
- { hostPath: '/run/concord', mountPath: '/run/concord', readOnly: true },
612
602
  ],
613
603
  },
614
604
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rcpooley/concord-kit",
3
- "version": "0.4.1",
3
+ "version": "0.5.1",
4
4
  "description": "Opinionated building blocks for a Concord config repo: apps as one file each, machines that derive their base layers, an nginx edge with derived certificate coverage, and assemble() to put the modules in order.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/rcpooley/concord/tree/main/kit",