@rcpooley/concord 0.1.0
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/LICENSE +21 -0
- package/README.md +318 -0
- package/bin/concord.service +69 -0
- package/dist/age.d.ts +20 -0
- package/dist/age.d.ts.map +1 -0
- package/dist/age.js +58 -0
- package/dist/age.js.map +1 -0
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +301 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/daemon.d.ts +4 -0
- package/dist/daemon.d.ts.map +1 -0
- package/dist/daemon.js +394 -0
- package/dist/daemon.js.map +1 -0
- package/dist/eval-config.d.ts +2 -0
- package/dist/eval-config.d.ts.map +1 -0
- package/dist/eval-config.js +45 -0
- package/dist/eval-config.js.map +1 -0
- package/dist/exec.d.ts +168 -0
- package/dist/exec.d.ts.map +1 -0
- package/dist/exec.js +313 -0
- package/dist/exec.js.map +1 -0
- package/dist/git.d.ts +59 -0
- package/dist/git.d.ts.map +1 -0
- package/dist/git.js +265 -0
- package/dist/git.js.map +1 -0
- package/dist/hook.d.ts +37 -0
- package/dist/hook.d.ts.map +1 -0
- package/dist/hook.js +89 -0
- package/dist/hook.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/init.d.ts +76 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +236 -0
- package/dist/init.js.map +1 -0
- package/dist/loader.d.ts +35 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +230 -0
- package/dist/loader.js.map +1 -0
- package/dist/module.d.ts +116 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +100 -0
- package/dist/module.js.map +1 -0
- package/dist/modules/apt/index.d.ts +45 -0
- package/dist/modules/apt/index.d.ts.map +1 -0
- package/dist/modules/apt/index.js +249 -0
- package/dist/modules/apt/index.js.map +1 -0
- package/dist/modules/apt/schema.d.ts +63 -0
- package/dist/modules/apt/schema.d.ts.map +1 -0
- package/dist/modules/apt/schema.js +75 -0
- package/dist/modules/apt/schema.js.map +1 -0
- package/dist/modules/checkout/index.d.ts +88 -0
- package/dist/modules/checkout/index.d.ts.map +1 -0
- package/dist/modules/checkout/index.js +382 -0
- package/dist/modules/checkout/index.js.map +1 -0
- package/dist/modules/checkout/schema.d.ts +52 -0
- package/dist/modules/checkout/schema.d.ts.map +1 -0
- package/dist/modules/checkout/schema.js +132 -0
- package/dist/modules/checkout/schema.js.map +1 -0
- package/dist/modules/cloudflare/api.d.ts +64 -0
- package/dist/modules/cloudflare/api.d.ts.map +1 -0
- package/dist/modules/cloudflare/api.js +98 -0
- package/dist/modules/cloudflare/api.js.map +1 -0
- package/dist/modules/cloudflare/index.d.ts +74 -0
- package/dist/modules/cloudflare/index.d.ts.map +1 -0
- package/dist/modules/cloudflare/index.js +374 -0
- package/dist/modules/cloudflare/index.js.map +1 -0
- package/dist/modules/cloudflare/schema.d.ts +62 -0
- package/dist/modules/cloudflare/schema.d.ts.map +1 -0
- package/dist/modules/cloudflare/schema.js +85 -0
- package/dist/modules/cloudflare/schema.js.map +1 -0
- package/dist/modules/docker/index.d.ts +83 -0
- package/dist/modules/docker/index.d.ts.map +1 -0
- package/dist/modules/docker/index.js +470 -0
- package/dist/modules/docker/index.js.map +1 -0
- package/dist/modules/docker/registry.d.ts +35 -0
- package/dist/modules/docker/registry.d.ts.map +1 -0
- package/dist/modules/docker/registry.js +95 -0
- package/dist/modules/docker/registry.js.map +1 -0
- package/dist/modules/docker/render.d.ts +45 -0
- package/dist/modules/docker/render.d.ts.map +1 -0
- package/dist/modules/docker/render.js +162 -0
- package/dist/modules/docker/render.js.map +1 -0
- package/dist/modules/docker/schema.d.ts +231 -0
- package/dist/modules/docker/schema.d.ts.map +1 -0
- package/dist/modules/docker/schema.js +335 -0
- package/dist/modules/docker/schema.js.map +1 -0
- package/dist/modules/docker/sweeper.d.ts +64 -0
- package/dist/modules/docker/sweeper.d.ts.map +1 -0
- package/dist/modules/docker/sweeper.js +94 -0
- package/dist/modules/docker/sweeper.js.map +1 -0
- package/dist/modules/file/index.d.ts +79 -0
- package/dist/modules/file/index.d.ts.map +1 -0
- package/dist/modules/file/index.js +305 -0
- package/dist/modules/file/index.js.map +1 -0
- package/dist/modules/file/schema.d.ts +45 -0
- package/dist/modules/file/schema.d.ts.map +1 -0
- package/dist/modules/file/schema.js +114 -0
- package/dist/modules/file/schema.js.map +1 -0
- package/dist/modules/index.d.ts +20 -0
- package/dist/modules/index.d.ts.map +1 -0
- package/dist/modules/index.js +11 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/modules/porkbun/api.d.ts +36 -0
- package/dist/modules/porkbun/api.d.ts.map +1 -0
- package/dist/modules/porkbun/api.js +62 -0
- package/dist/modules/porkbun/api.js.map +1 -0
- package/dist/modules/porkbun/index.d.ts +50 -0
- package/dist/modules/porkbun/index.d.ts.map +1 -0
- package/dist/modules/porkbun/index.js +236 -0
- package/dist/modules/porkbun/index.js.map +1 -0
- package/dist/modules/porkbun/schema.d.ts +38 -0
- package/dist/modules/porkbun/schema.d.ts.map +1 -0
- package/dist/modules/porkbun/schema.js +39 -0
- package/dist/modules/porkbun/schema.js.map +1 -0
- package/dist/modules/script/index.d.ts +43 -0
- package/dist/modules/script/index.d.ts.map +1 -0
- package/dist/modules/script/index.js +116 -0
- package/dist/modules/script/index.js.map +1 -0
- package/dist/modules/script/schema.d.ts +25 -0
- package/dist/modules/script/schema.d.ts.map +1 -0
- package/dist/modules/script/schema.js +63 -0
- package/dist/modules/script/schema.js.map +1 -0
- package/dist/modules/systemd/index.d.ts +93 -0
- package/dist/modules/systemd/index.d.ts.map +1 -0
- package/dist/modules/systemd/index.js +394 -0
- package/dist/modules/systemd/index.js.map +1 -0
- package/dist/modules/systemd/render.d.ts +41 -0
- package/dist/modules/systemd/render.d.ts.map +1 -0
- package/dist/modules/systemd/render.js +252 -0
- package/dist/modules/systemd/render.js.map +1 -0
- package/dist/modules/systemd/schema.d.ts +293 -0
- package/dist/modules/systemd/schema.d.ts.map +1 -0
- package/dist/modules/systemd/schema.js +302 -0
- package/dist/modules/systemd/schema.js.map +1 -0
- package/dist/modules/systemd/sweeper.d.ts +31 -0
- package/dist/modules/systemd/sweeper.d.ts.map +1 -0
- package/dist/modules/systemd/sweeper.js +77 -0
- package/dist/modules/systemd/sweeper.js.map +1 -0
- package/dist/plans.d.ts +132 -0
- package/dist/plans.d.ts.map +1 -0
- package/dist/plans.js +315 -0
- package/dist/plans.js.map +1 -0
- package/dist/records.d.ts +37 -0
- package/dist/records.d.ts.map +1 -0
- package/dist/records.js +100 -0
- package/dist/records.js.map +1 -0
- package/dist/registry.d.ts +38 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +31 -0
- package/dist/registry.js.map +1 -0
- package/dist/runner.d.ts +48 -0
- package/dist/runner.d.ts.map +1 -0
- package/dist/runner.js +150 -0
- package/dist/runner.js.map +1 -0
- package/dist/scheduler.d.ts +36 -0
- package/dist/scheduler.d.ts.map +1 -0
- package/dist/scheduler.js +77 -0
- package/dist/scheduler.js.map +1 -0
- package/dist/schema.d.ts +762 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +185 -0
- package/dist/schema.js.map +1 -0
- package/dist/secret.d.ts +24 -0
- package/dist/secret.d.ts.map +1 -0
- package/dist/secret.js +3 -0
- package/dist/secret.js.map +1 -0
- package/dist/ui.d.ts +62 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +288 -0
- package/dist/ui.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Applied when an unproxied record omits `ttl`. Matches Cloudflare's "Auto". */
|
|
3
|
+
export declare const DEFAULT_TTL = 300;
|
|
4
|
+
/** Cloudflare's floor off Enterprise. 30 is Enterprise-only; we do not assume it. */
|
|
5
|
+
export declare const MIN_TTL = 60;
|
|
6
|
+
/** Cloudflare's sentinel for "Auto". Forced on every proxied record. */
|
|
7
|
+
export declare const TTL_AUTO = 1;
|
|
8
|
+
/**
|
|
9
|
+
* Free-plan cap on a record comment. Pro and above allow 500, but the ownership
|
|
10
|
+
* marker has to fit in the smallest box we actually deploy into.
|
|
11
|
+
*/
|
|
12
|
+
export declare const MAX_COMMENT = 100;
|
|
13
|
+
/**
|
|
14
|
+
* The ownership marker written into every record this module creates.
|
|
15
|
+
*
|
|
16
|
+
* Instance-scoped rather than a bare `concord:` so two instances pointed at one
|
|
17
|
+
* zone cannot claim each other's records, and so a plan line says which one
|
|
18
|
+
* owns what. A record's `note` is appended after it — the marker is a PREFIX,
|
|
19
|
+
* never the whole comment.
|
|
20
|
+
*/
|
|
21
|
+
export declare const marker: (id: string) => string;
|
|
22
|
+
export declare const DnsRecordSchema: z.ZodObject<{
|
|
23
|
+
type: z.ZodString;
|
|
24
|
+
name: z.ZodString;
|
|
25
|
+
content: z.ZodString;
|
|
26
|
+
ttl: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
priority: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
28
|
+
proxied: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
note: z.ZodOptional<z.ZodString>;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
export declare const ZoneConfigSchema: z.ZodObject<{
|
|
32
|
+
records: z.ZodArray<z.ZodObject<{
|
|
33
|
+
type: z.ZodString;
|
|
34
|
+
name: z.ZodString;
|
|
35
|
+
content: z.ZodString;
|
|
36
|
+
ttl: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
priority: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
38
|
+
proxied: z.ZodOptional<z.ZodBoolean>;
|
|
39
|
+
note: z.ZodOptional<z.ZodString>;
|
|
40
|
+
}, z.core.$strict>>;
|
|
41
|
+
}, z.core.$strict>;
|
|
42
|
+
export declare const CloudflareConfigSchema: z.ZodObject<{
|
|
43
|
+
type: z.ZodLiteral<"cloudflare">;
|
|
44
|
+
id: z.ZodString;
|
|
45
|
+
apiToken: z.ZodCustom<import("../../secret.js").Secret, import("../../secret.js").Secret>;
|
|
46
|
+
accountId: z.ZodOptional<z.ZodString>;
|
|
47
|
+
zones: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
48
|
+
records: z.ZodArray<z.ZodObject<{
|
|
49
|
+
type: z.ZodString;
|
|
50
|
+
name: z.ZodString;
|
|
51
|
+
content: z.ZodString;
|
|
52
|
+
ttl: z.ZodOptional<z.ZodNumber>;
|
|
53
|
+
priority: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
54
|
+
proxied: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
+
note: z.ZodOptional<z.ZodString>;
|
|
56
|
+
}, z.core.$strict>>;
|
|
57
|
+
}, z.core.$strict>>;
|
|
58
|
+
}, z.core.$strict>;
|
|
59
|
+
export type DnsRecordInput = z.output<typeof DnsRecordSchema>;
|
|
60
|
+
export type ZoneConfig = z.output<typeof ZoneConfigSchema>;
|
|
61
|
+
export type CloudflareConfig = z.output<typeof CloudflareConfigSchema>;
|
|
62
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/modules/cloudflare/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,iFAAiF;AACjF,eAAO,MAAM,WAAW,MAAM,CAAA;AAE9B,qFAAqF;AACrF,eAAO,MAAM,OAAO,KAAK,CAAA;AAEzB,wEAAwE;AACxE,eAAO,MAAM,QAAQ,IAAI,CAAA;AAEzB;;;GAGG;AACH,eAAO,MAAM,WAAW,MAAM,CAAA;AAE9B;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,GAAI,IAAI,MAAM,KAAG,MAAyB,CAAA;AAE7D,eAAO,MAAM,eAAe;;;;;;;;kBA0BxB,CAAA;AAEJ,eAAO,MAAM,gBAAgB;;;;;;;;;;kBAclB,CAAA;AAEX,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;kBAoBxB,CAAA;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,eAAe,CAAC,CAAA;AAC7D,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAC1D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAA"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SecretSchema } from '../../secret.js';
|
|
3
|
+
/** Applied when an unproxied record omits `ttl`. Matches Cloudflare's "Auto". */
|
|
4
|
+
export const DEFAULT_TTL = 300;
|
|
5
|
+
/** Cloudflare's floor off Enterprise. 30 is Enterprise-only; we do not assume it. */
|
|
6
|
+
export const MIN_TTL = 60;
|
|
7
|
+
/** Cloudflare's sentinel for "Auto". Forced on every proxied record. */
|
|
8
|
+
export const TTL_AUTO = 1;
|
|
9
|
+
/**
|
|
10
|
+
* Free-plan cap on a record comment. Pro and above allow 500, but the ownership
|
|
11
|
+
* marker has to fit in the smallest box we actually deploy into.
|
|
12
|
+
*/
|
|
13
|
+
export const MAX_COMMENT = 100;
|
|
14
|
+
/**
|
|
15
|
+
* The ownership marker written into every record this module creates.
|
|
16
|
+
*
|
|
17
|
+
* Instance-scoped rather than a bare `concord:` so two instances pointed at one
|
|
18
|
+
* zone cannot claim each other's records, and so a plan line says which one
|
|
19
|
+
* owns what. A record's `note` is appended after it — the marker is a PREFIX,
|
|
20
|
+
* never the whole comment.
|
|
21
|
+
*/
|
|
22
|
+
export const marker = (id) => `concord:${id}`;
|
|
23
|
+
export const DnsRecordSchema = z
|
|
24
|
+
.object({
|
|
25
|
+
/** A, AAAA, CNAME, TXT, MX, … */
|
|
26
|
+
type: z.string().min(1),
|
|
27
|
+
/** Relative to the zone. '@' or '' = apex. */
|
|
28
|
+
name: z.string(),
|
|
29
|
+
/** For CNAME/MX/NS/SRV a hostname; '@' expands to the zone apex. */
|
|
30
|
+
content: z.string().min(1),
|
|
31
|
+
ttl: z.number().int().min(MIN_TTL).max(86400).optional(),
|
|
32
|
+
/** MX/SRV only. */
|
|
33
|
+
priority: z.number().int().min(0).max(65535).nullable().optional(),
|
|
34
|
+
/** Orange cloud. Forces ttl to Auto — see the refinement below. */
|
|
35
|
+
proxied: z.boolean().optional(),
|
|
36
|
+
/** Free text appended to the ownership marker, for humans reading the dashboard. */
|
|
37
|
+
note: z.string().max(MAX_COMMENT).optional(),
|
|
38
|
+
})
|
|
39
|
+
.strict()
|
|
40
|
+
.refine((r) => !(r.proxied === true && r.ttl !== undefined), {
|
|
41
|
+
message: 'a proxied record cannot set ttl — Cloudflare forces proxied records to Auto ' +
|
|
42
|
+
'and refuses to store anything else, so a declared ttl would diff forever',
|
|
43
|
+
path: ['ttl'],
|
|
44
|
+
})
|
|
45
|
+
.refine((r) => !/[\r\n]/.test(r.note ?? ''), {
|
|
46
|
+
message: 'note cannot contain a newline — Cloudflare rejects them in comments',
|
|
47
|
+
path: ['note'],
|
|
48
|
+
});
|
|
49
|
+
export const ZoneConfigSchema = z
|
|
50
|
+
.object({
|
|
51
|
+
/**
|
|
52
|
+
* The records this instance OWNS in the zone. A declared record that has
|
|
53
|
+
* drifted is corrected; an owned record no longer declared here is deleted.
|
|
54
|
+
*
|
|
55
|
+
* What makes this different from `porkbun`, where a declared zone is the
|
|
56
|
+
* whole truth: a live record that does not carry this instance's ownership
|
|
57
|
+
* marker is not Concord's, and is never deleted or edited. It is reported
|
|
58
|
+
* in the plan preamble and otherwise ignored, so a zone can be shared with
|
|
59
|
+
* a human who adds records by hand.
|
|
60
|
+
*/
|
|
61
|
+
records: z.array(DnsRecordSchema),
|
|
62
|
+
})
|
|
63
|
+
.strict();
|
|
64
|
+
export const CloudflareConfigSchema = z
|
|
65
|
+
.object({
|
|
66
|
+
type: z.literal('cloudflare'),
|
|
67
|
+
/** Stable instance id — also the ownership marker's suffix. */
|
|
68
|
+
id: z
|
|
69
|
+
.string()
|
|
70
|
+
.regex(/^[a-z0-9][a-z0-9-]*$/, 'must be kebab-case, starting alphanumeric'),
|
|
71
|
+
/** Needs Zone:Read (name -> id) and DNS:Edit. */
|
|
72
|
+
apiToken: SecretSchema,
|
|
73
|
+
/**
|
|
74
|
+
* Scopes the zone-name lookup. Optional, but set it on any token that can
|
|
75
|
+
* see more than one account — two accounts can hold the same zone name,
|
|
76
|
+
* and resolving the wrong one would point every write at a stranger's DNS.
|
|
77
|
+
*/
|
|
78
|
+
accountId: z
|
|
79
|
+
.string()
|
|
80
|
+
.regex(/^[0-9a-f]{32}$/, 'must be a 32-character hex Cloudflare account id')
|
|
81
|
+
.optional(),
|
|
82
|
+
zones: z.record(z.string().min(1), ZoneConfigSchema),
|
|
83
|
+
})
|
|
84
|
+
.strict();
|
|
85
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/modules/cloudflare/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,iFAAiF;AACjF,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAA;AAE9B,qFAAqF;AACrF,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,CAAA;AAEzB,wEAAwE;AACxE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAA;AAEzB;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAA;AAE9B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EAAU,EAAU,EAAE,CAAC,WAA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AE,CAAC,MAAM,CAAC;CACf,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,CAAC;IACN;;;;;;;;;OASG;IACH,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC;CAClC,CAAC;KACD,MAAM,EAAE,CAAA;AAEX,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC;KACpC,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;IAC7B,+DAA+D;IAC/D,EAAE,EAAE,CAAC;SACF,MAAM,EAAE;SACR,KAAK,CAAC,sBAAsB,EAAE,2CAA2C,CAAC;IAC7E,iDAAiD;IACjD,QAAQ,EAAE,YAAY;IACtB;;;;OAIG;IACH,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,KAAK,CAAC,gBAAgB,EAAE,kDAAkD,CAAC;SAC3E,QAAQ,EAAE;IACb,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,gBAAgB,CAAC;CACrD,CAAC;KACD,MAAM,EAAE,CAAA"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Module, type BaseOp } from '../../module.js';
|
|
2
|
+
import { type DockerConfig } from './schema.js';
|
|
3
|
+
export type { DockerConfig } from './schema.js';
|
|
4
|
+
export { render, serialize, imageTag, imageRef } from './render.js';
|
|
5
|
+
export { resolveRefs, cloneUrl, githubSlug } from '../../git.js';
|
|
6
|
+
export { resolveDigest, parseImage } from './registry.js';
|
|
7
|
+
export interface ContainerState {
|
|
8
|
+
name: string;
|
|
9
|
+
/** A container for this app exists at all. */
|
|
10
|
+
present: boolean;
|
|
11
|
+
/** Commit (built app) or registry digest (image app), per the container's label. */
|
|
12
|
+
version: string | null;
|
|
13
|
+
/** Hash of the spec it was started with, per its label. */
|
|
14
|
+
specHash: string | null;
|
|
15
|
+
running: boolean;
|
|
16
|
+
/** null when there is no verdict: no healthcheck declared, or still starting. */
|
|
17
|
+
healthy: boolean | null;
|
|
18
|
+
}
|
|
19
|
+
export interface NetworkState {
|
|
20
|
+
name: string;
|
|
21
|
+
present: boolean;
|
|
22
|
+
/** null when absent — nothing to compare. */
|
|
23
|
+
driver: string | null;
|
|
24
|
+
}
|
|
25
|
+
export interface DockerState {
|
|
26
|
+
networks: NetworkState[];
|
|
27
|
+
containers: ContainerState[];
|
|
28
|
+
}
|
|
29
|
+
export interface DockerOp extends BaseOp {
|
|
30
|
+
entity: 'app' | 'network';
|
|
31
|
+
name: string;
|
|
32
|
+
action: 'deploy' | 'remove' | 'create-network';
|
|
33
|
+
/** For `remove`: the compose project to tear down, when the container has one. */
|
|
34
|
+
project?: string | null;
|
|
35
|
+
}
|
|
36
|
+
export declare function parseContainers(stdout: string): ContainerState[];
|
|
37
|
+
export declare class DockerModule extends Module<DockerState, DockerOp> {
|
|
38
|
+
#private;
|
|
39
|
+
private readonly config;
|
|
40
|
+
readonly kind = "docker";
|
|
41
|
+
constructor(config: DockerConfig);
|
|
42
|
+
/** Declared container names — the sweep keep-set contribution. These are
|
|
43
|
+
* also the compose project names (`dev.concord.app`), which is what the
|
|
44
|
+
* sweeper matches live containers against. */
|
|
45
|
+
owned(): string[];
|
|
46
|
+
private get containers();
|
|
47
|
+
private dir;
|
|
48
|
+
private composePath;
|
|
49
|
+
desired(): Promise<DockerState>;
|
|
50
|
+
/**
|
|
51
|
+
* Live state comes from the CONTAINER's own labels, not from files on disk.
|
|
52
|
+
*
|
|
53
|
+
* The container is what is actually running, so it is the honest source. It
|
|
54
|
+
* also means an out-of-band `docker run`, a hand-edited compose file, or a
|
|
55
|
+
* half-finished deploy all read as drift rather than as convergence — none of
|
|
56
|
+
* them carry a matching `dev.concord.spec`.
|
|
57
|
+
*/
|
|
58
|
+
read(): Promise<DockerState>;
|
|
59
|
+
/**
|
|
60
|
+
* `docker network ls`, filtered to what is declared.
|
|
61
|
+
*
|
|
62
|
+
* Additive: a network nobody declared is never read and never touched. This
|
|
63
|
+
* host has networks docker itself made (`bridge`, `host`, `none`) and others
|
|
64
|
+
* left behind by tools long gone — enumerating them would invite a diff that
|
|
65
|
+
* wants to delete them.
|
|
66
|
+
*/
|
|
67
|
+
private readNetworks;
|
|
68
|
+
diff(actual: DockerState, desired: DockerState): DockerOp[];
|
|
69
|
+
apply(ops: DockerOp[]): Promise<void>;
|
|
70
|
+
private deploy;
|
|
71
|
+
/**
|
|
72
|
+
* Fetch on the primary, extract on the target.
|
|
73
|
+
*
|
|
74
|
+
* The tar goes over the transport already established, base64 inside a quoted
|
|
75
|
+
* heredoc, so nothing is spliced into a remote shell and the target needs
|
|
76
|
+
* neither git nor any credential.
|
|
77
|
+
*/
|
|
78
|
+
private uploadContext;
|
|
79
|
+
private build;
|
|
80
|
+
/** Keep the newest N tags for this app; docker lists newest first. */
|
|
81
|
+
private prune;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/docker/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAIrD,OAAO,EAAiB,KAAK,YAAY,EAAuB,MAAM,aAAa,CAAA;AAEnF,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAChE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAOzD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,8CAA8C;IAC9C,OAAO,EAAE,OAAO,CA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