@highstate/common 0.9.16 → 0.9.19
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/dist/{chunk-HZBJ6LLS.js → chunk-WDYIUWYZ.js} +659 -267
- package/dist/chunk-WDYIUWYZ.js.map +1 -0
- package/dist/highstate.manifest.json +12 -8
- package/dist/index.js +1 -1
- package/dist/units/access-point/index.js +16 -0
- package/dist/units/access-point/index.js.map +1 -0
- package/dist/units/databases/existing-mariadb/index.js +17 -0
- package/dist/units/databases/existing-mariadb/index.js.map +1 -0
- package/dist/units/databases/existing-mongodb/index.js +17 -0
- package/dist/units/databases/existing-mongodb/index.js.map +1 -0
- package/dist/units/databases/existing-postgresql/index.js +17 -0
- package/dist/units/databases/existing-postgresql/index.js.map +1 -0
- package/dist/units/dns/record-set/index.js +22 -11
- package/dist/units/dns/record-set/index.js.map +1 -1
- package/dist/units/existing-server/index.js +12 -12
- package/dist/units/existing-server/index.js.map +1 -1
- package/dist/units/network/l3-endpoint/index.js +1 -1
- package/dist/units/network/l3-endpoint/index.js.map +1 -1
- package/dist/units/network/l4-endpoint/index.js +1 -1
- package/dist/units/network/l4-endpoint/index.js.map +1 -1
- package/dist/units/script/index.js +1 -1
- package/dist/units/script/index.js.map +1 -1
- package/dist/units/server-dns/index.js +1 -1
- package/dist/units/server-dns/index.js.map +1 -1
- package/dist/units/server-patch/index.js +1 -1
- package/dist/units/server-patch/index.js.map +1 -1
- package/dist/units/ssh/key-pair/index.js +6 -6
- package/dist/units/ssh/key-pair/index.js.map +1 -1
- package/package.json +61 -8
- package/src/shared/access-point.ts +110 -0
- package/src/shared/command.ts +310 -69
- package/src/shared/dns.ts +150 -90
- package/src/shared/files.ts +34 -34
- package/src/shared/gateway.ts +117 -0
- package/src/shared/impl-ref.ts +123 -0
- package/src/shared/index.ts +4 -0
- package/src/shared/network.ts +41 -27
- package/src/shared/passwords.ts +38 -2
- package/src/shared/ssh.ts +261 -126
- package/src/shared/tls.ts +123 -0
- package/src/units/access-point/index.ts +12 -0
- package/src/units/databases/existing-mariadb/index.ts +14 -0
- package/src/units/databases/existing-mongodb/index.ts +14 -0
- package/src/units/databases/existing-postgresql/index.ts +14 -0
- package/src/units/dns/record-set/index.ts +21 -11
- package/src/units/existing-server/index.ts +12 -17
- package/src/units/ssh/key-pair/index.ts +6 -6
- package/dist/chunk-HZBJ6LLS.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/units/server-dns/index.ts"],"names":[],"mappings":";;;;AAIA,IAAM,EAAE,
|
1
|
+
{"version":3,"sources":["../../../src/units/server-dns/index.ts"],"names":[],"mappings":";;;;AAIA,IAAM,EAAE,IAAA,EAAM,MAAA,EAAQ,SAAQ,GAAI,OAAA,CAAQ,OAAO,SAAS,CAAA;AAE1D,IAAM,EAAE,SAAA,EAAU,GAAI,MAAM,uBAAA;AAAA,EAC1B,OAAO,MAAA,CAAO,SAAA;AAAA,EACd,IAAA,CAAK,IAAA;AAAA,EACL,IAAA,CAAK,cAAA;AAAA,EACL,IAAA,CAAK,SAAA;AAAA,EACL,MAAA,CAAO;AACT,CAAA;AAEA,IAAO,qBAAQ,OAAA,CAAQ;AAAA,EACrB,MAAA,EAAQ,MAAA,CAAO,MAAA,CAAO,KAAA,CAAM,CAAA,MAAA,MAAW;AAAA,IACrC,GAAG,MAAA;AAAA,IACH;AAAA,GACF,CAAE,CAAA;AAAA,EAEF,SAAA;AAAA,EAEA,aAAA,EAAe;AAAA,IACb,SAAA,EAAW,SAAA,CAAU,GAAA,CAAI,kBAAkB;AAAA;AAE/C,CAAC","file":"index.js","sourcesContent":["import { common } from \"@highstate/library\"\nimport { forUnit } from \"@highstate/pulumi\"\nimport { l3EndpointToString, updateEndpointsWithFqdn } from \"../../shared\"\n\nconst { args, inputs, outputs } = forUnit(common.serverDns)\n\nconst { endpoints } = await updateEndpointsWithFqdn(\n inputs.server.endpoints,\n args.fqdn,\n args.endpointFilter,\n args.patchMode,\n inputs.dnsProviders,\n)\n\nexport default outputs({\n server: inputs.server.apply(server => ({\n ...server,\n endpoints,\n })),\n\n endpoints,\n\n $statusFields: {\n endpoints: endpoints.map(l3EndpointToString),\n },\n})\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/units/server-patch/index.ts"],"names":[],"mappings":";;;;AAIA,IAAM,EAAE,
|
1
|
+
{"version":3,"sources":["../../../src/units/server-patch/index.ts"],"names":[],"mappings":";;;;AAIA,IAAM,EAAE,IAAA,EAAM,MAAA,EAAQ,SAAQ,GAAI,OAAA,CAAQ,OAAO,WAAW,CAAA;AAE5D,IAAM,YAAY,MAAM,eAAA;AAAA,EACtB,OAAO,MAAA,CAAO,SAAA;AAAA,EACd,IAAA,CAAK,SAAA;AAAA,EACL,MAAA,CAAO,SAAA;AAAA,EACP,IAAA,CAAK;AACP,CAAA;AAEA,IAAO,uBAAQ,OAAA,CAAQ;AAAA,EACrB,MAAA,EAAQ,MAAA,CAAO,MAAA,CAAO,KAAA,CAAM,CAAA,MAAA,MAAW;AAAA,IACrC,GAAG,MAAA;AAAA,IACH;AAAA,GACF,CAAE,CAAA;AAAA,EAEF,SAAA;AAAA,EAEA,aAAA,EAAe;AAAA,IACb,SAAA,EAAW,SAAA,CAAU,GAAA,CAAI,kBAAkB;AAAA;AAE/C,CAAC","file":"index.js","sourcesContent":["import { common } from \"@highstate/library\"\nimport { forUnit } from \"@highstate/pulumi\"\nimport { l3EndpointToString, updateEndpoints } from \"../../shared\"\n\nconst { args, inputs, outputs } = forUnit(common.serverPatch)\n\nconst endpoints = await updateEndpoints(\n inputs.server.endpoints,\n args.endpoints,\n inputs.endpoints,\n args.endpointsPatchMode,\n)\n\nexport default outputs({\n server: inputs.server.apply(server => ({\n ...server,\n endpoints,\n })),\n\n endpoints,\n\n $statusFields: {\n endpoints: endpoints.map(l3EndpointToString),\n },\n})\n"]}
|
@@ -1,12 +1,12 @@
|
|
1
|
-
import {
|
1
|
+
import { generateSshPrivateKey, sshPrivateKeyToKeyPair } from '../../../chunk-WDYIUWYZ.js';
|
2
2
|
import { ssh } from '@highstate/library';
|
3
|
-
import { forUnit
|
3
|
+
import { forUnit } from '@highstate/pulumi';
|
4
4
|
|
5
|
-
var { name,
|
6
|
-
var privateKey =
|
7
|
-
var keyPair =
|
5
|
+
var { name, getSecret, outputs } = forUnit(ssh.keyPair);
|
6
|
+
var privateKey = getSecret("privateKey", generateSshPrivateKey);
|
7
|
+
var keyPair = sshPrivateKeyToKeyPair(privateKey);
|
8
8
|
var key_pair_default = outputs({
|
9
|
-
keyPair
|
9
|
+
keyPair,
|
10
10
|
publicKeyFile: {
|
11
11
|
meta: {
|
12
12
|
name: `${name}.pub`,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../src/units/ssh/key-pair/index.ts"],"names":[],"mappings":";;;;AAIA,IAAM,EAAE,
|
1
|
+
{"version":3,"sources":["../../../../src/units/ssh/key-pair/index.ts"],"names":[],"mappings":";;;;AAIA,IAAM,EAAE,IAAA,EAAM,SAAA,EAAW,SAAQ,GAAI,OAAA,CAAQ,IAAI,OAAO,CAAA;AAExD,IAAM,UAAA,GAAa,SAAA,CAAU,YAAA,EAAc,qBAAqB,CAAA;AAChE,IAAM,OAAA,GAAU,uBAAuB,UAAU,CAAA;AAEjD,IAAO,mBAAQ,OAAA,CAAQ;AAAA,EACrB,OAAA;AAAA,EACA,aAAA,EAAe;AAAA,IACb,IAAA,EAAM;AAAA,MACJ,IAAA,EAAM,GAAG,IAAI,CAAA,IAAA,CAAA;AAAA,MACb,IAAA,EAAM;AAAA,KACR;AAAA,IACA,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,UAAA;AAAA,MACN,OAAO,OAAA,CAAQ;AAAA;AACjB,GACF;AAAA,EACA,aAAA,EAAe;AAAA,IACb,aAAa,OAAA,CAAQ,WAAA;AAAA,IACrB,WAAW,OAAA,CAAQ;AAAA;AAEvB,CAAC","file":"index.js","sourcesContent":["import { ssh } from \"@highstate/library\"\nimport { forUnit } from \"@highstate/pulumi\"\nimport { generateSshPrivateKey, sshPrivateKeyToKeyPair } from \"../../../shared\"\n\nconst { name, getSecret, outputs } = forUnit(ssh.keyPair)\n\nconst privateKey = getSecret(\"privateKey\", generateSshPrivateKey)\nconst keyPair = sshPrivateKeyToKeyPair(privateKey)\n\nexport default outputs({\n keyPair,\n publicKeyFile: {\n meta: {\n name: `${name}.pub`,\n mode: 0o644,\n },\n content: {\n type: \"embedded\",\n value: keyPair.publicKey,\n },\n },\n $statusFields: {\n fingerprint: keyPair.fingerprint,\n publicKey: keyPair.publicKey,\n },\n})\n"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@highstate/common",
|
3
|
-
"version": "0.9.
|
3
|
+
"version": "0.9.19",
|
4
4
|
"type": "module",
|
5
5
|
"files": [
|
6
6
|
"dist",
|
@@ -11,6 +11,54 @@
|
|
11
11
|
".": {
|
12
12
|
"mode": "manual",
|
13
13
|
"version": "1"
|
14
|
+
},
|
15
|
+
"./units/access-point": {
|
16
|
+
"mode": "manual",
|
17
|
+
"version": "1"
|
18
|
+
},
|
19
|
+
"./units/dns/record-set": {
|
20
|
+
"mode": "manual",
|
21
|
+
"version": "1"
|
22
|
+
},
|
23
|
+
"./units/network/l3-endpoint": {
|
24
|
+
"mode": "manual",
|
25
|
+
"version": "1"
|
26
|
+
},
|
27
|
+
"./units/network/l4-endpoint": {
|
28
|
+
"mode": "manual",
|
29
|
+
"version": "1"
|
30
|
+
},
|
31
|
+
"./units/existing-server": {
|
32
|
+
"mode": "manual",
|
33
|
+
"version": "1"
|
34
|
+
},
|
35
|
+
"./units/ssh/key-pair": {
|
36
|
+
"mode": "manual",
|
37
|
+
"version": "1"
|
38
|
+
},
|
39
|
+
"./units/script": {
|
40
|
+
"mode": "manual",
|
41
|
+
"version": "1"
|
42
|
+
},
|
43
|
+
"./units/server-dns": {
|
44
|
+
"mode": "manual",
|
45
|
+
"version": "1"
|
46
|
+
},
|
47
|
+
"./units/server-patch": {
|
48
|
+
"mode": "manual",
|
49
|
+
"version": "1"
|
50
|
+
},
|
51
|
+
"./units/databases/existing-mariadb": {
|
52
|
+
"mode": "manual",
|
53
|
+
"version": "1"
|
54
|
+
},
|
55
|
+
"./units/databases/existing-postgresql": {
|
56
|
+
"mode": "manual",
|
57
|
+
"version": "1"
|
58
|
+
},
|
59
|
+
"./units/databases/existing-mongodb": {
|
60
|
+
"mode": "manual",
|
61
|
+
"version": "1"
|
14
62
|
}
|
15
63
|
}
|
16
64
|
},
|
@@ -19,6 +67,7 @@
|
|
19
67
|
"types": "./src/index.ts",
|
20
68
|
"default": "./dist/index.js"
|
21
69
|
},
|
70
|
+
"./units/access-point": "./dist/units/access-point/index.js",
|
22
71
|
"./units/dns/record-set": "./dist/units/dns/record-set/index.js",
|
23
72
|
"./units/network/l3-endpoint": "./dist/units/network/l3-endpoint/index.js",
|
24
73
|
"./units/network/l4-endpoint": "./dist/units/network/l4-endpoint/index.js",
|
@@ -26,7 +75,10 @@
|
|
26
75
|
"./units/ssh/key-pair": "./dist/units/ssh/key-pair/index.js",
|
27
76
|
"./units/script": "./dist/units/script/index.js",
|
28
77
|
"./units/server-dns": "./dist/units/server-dns/index.js",
|
29
|
-
"./units/server-patch": "./dist/units/server-patch/index.js"
|
78
|
+
"./units/server-patch": "./dist/units/server-patch/index.js",
|
79
|
+
"./units/databases/existing-mariadb": "./dist/units/databases/existing-mariadb/index.js",
|
80
|
+
"./units/databases/existing-postgresql": "./dist/units/databases/existing-postgresql/index.js",
|
81
|
+
"./units/databases/existing-mongodb": "./dist/units/databases/existing-mongodb/index.js"
|
30
82
|
},
|
31
83
|
"publishConfig": {
|
32
84
|
"access": "public"
|
@@ -36,9 +88,9 @@
|
|
36
88
|
"update-images": "../../scripts/update-images.sh ./assets/images.json"
|
37
89
|
},
|
38
90
|
"dependencies": {
|
39
|
-
"@highstate/contract": "^0.9.
|
40
|
-
"@highstate/library": "^0.9.
|
41
|
-
"@highstate/pulumi": "^0.9.
|
91
|
+
"@highstate/contract": "^0.9.19",
|
92
|
+
"@highstate/library": "^0.9.19",
|
93
|
+
"@highstate/pulumi": "^0.9.19",
|
42
94
|
"@noble/hashes": "^1.7.1",
|
43
95
|
"@pulumi/command": "^1.0.2",
|
44
96
|
"micro-key-producer": "^0.7.3",
|
@@ -48,9 +100,10 @@
|
|
48
100
|
"unzipper": "^0.12.3"
|
49
101
|
},
|
50
102
|
"devDependencies": {
|
51
|
-
"@highstate/cli": "^0.9.
|
103
|
+
"@highstate/cli": "^0.9.19",
|
52
104
|
"@types/tar": "^6.1.13",
|
53
|
-
"@types/unzipper": "^0.10.11"
|
105
|
+
"@types/unzipper": "^0.10.11",
|
106
|
+
"type-fest": "^4.41.0"
|
54
107
|
},
|
55
|
-
"gitHead": "
|
108
|
+
"gitHead": "e77d292335556c6e5b6275acda1a3d1609d786a1"
|
56
109
|
}
|
@@ -0,0 +1,110 @@
|
|
1
|
+
import type { common } from "@highstate/library"
|
2
|
+
import type { Except } from "type-fest"
|
3
|
+
import {
|
4
|
+
ComponentResource,
|
5
|
+
type ComponentResourceOptions,
|
6
|
+
type Input,
|
7
|
+
type Output,
|
8
|
+
output,
|
9
|
+
toPromise,
|
10
|
+
} from "@highstate/pulumi"
|
11
|
+
import { DnsRecordSet } from "./dns"
|
12
|
+
import { GatewayRoute, type GatewayRouteSpec } from "./gateway"
|
13
|
+
import { TlsCertificate } from "./tls"
|
14
|
+
|
15
|
+
export type AccessPointRouteArgs = Except<GatewayRouteSpec, "nativeData"> & {
|
16
|
+
/**
|
17
|
+
* The access point to use to expose the route.
|
18
|
+
*/
|
19
|
+
accessPoint: Input<common.AccessPoint>
|
20
|
+
|
21
|
+
/**
|
22
|
+
* The native data to pass to the gateway route implementation.
|
23
|
+
*/
|
24
|
+
gatewayNativeData?: unknown
|
25
|
+
|
26
|
+
/**
|
27
|
+
* The native data to pass to the tls ceertificate implementation.
|
28
|
+
*/
|
29
|
+
tlsCertificateNativeData?: unknown
|
30
|
+
}
|
31
|
+
|
32
|
+
export class AccessPointRoute extends ComponentResource {
|
33
|
+
/**
|
34
|
+
* The created gateway route.
|
35
|
+
*/
|
36
|
+
readonly route: GatewayRoute
|
37
|
+
|
38
|
+
/**
|
39
|
+
* The DNS record set created for the route.
|
40
|
+
*
|
41
|
+
* May be shared between multiple routes with the same FQDN.
|
42
|
+
*/
|
43
|
+
readonly dnsRecordSet?: Output<DnsRecordSet | undefined>
|
44
|
+
|
45
|
+
/**
|
46
|
+
* The TLS certificate created for the route.
|
47
|
+
*
|
48
|
+
* May be shared between multiple routes with the same FQDN.
|
49
|
+
*/
|
50
|
+
readonly tlsCertificate?: Output<TlsCertificate | undefined>
|
51
|
+
|
52
|
+
constructor(name: string, args: AccessPointRouteArgs, opts?: ComponentResourceOptions) {
|
53
|
+
super("highstate:common:AccessPointRoute", name, args, opts)
|
54
|
+
|
55
|
+
// 1. create TLS certificate if the route is HTTPS and the access point has TLS issuers
|
56
|
+
if (args.fqdn && args.type === "http" && !args.insecure) {
|
57
|
+
this.tlsCertificate = output(args.accessPoint).apply(accessPoint => {
|
58
|
+
if (accessPoint.tlsIssuers.length === 0) {
|
59
|
+
return undefined
|
60
|
+
}
|
61
|
+
|
62
|
+
return TlsCertificate.createOnce(
|
63
|
+
name,
|
64
|
+
{
|
65
|
+
issuers: accessPoint.tlsIssuers,
|
66
|
+
dnsNames: args.fqdn ? [args.fqdn] : [],
|
67
|
+
nativeData: args.tlsCertificateNativeData,
|
68
|
+
},
|
69
|
+
{ ...opts, parent: this },
|
70
|
+
)
|
71
|
+
})
|
72
|
+
}
|
73
|
+
|
74
|
+
// 2. create the route and resolve the gateway endpoints
|
75
|
+
this.route = new GatewayRoute(
|
76
|
+
name,
|
77
|
+
{
|
78
|
+
...args,
|
79
|
+
gateway: output(args.accessPoint).gateway,
|
80
|
+
tlsCertificate: this.tlsCertificate,
|
81
|
+
nativeData: args.gatewayNativeData,
|
82
|
+
},
|
83
|
+
{ ...opts, parent: this },
|
84
|
+
)
|
85
|
+
|
86
|
+
// 3. register DNS records if FQDN is provided and the access point has DNS providers
|
87
|
+
if (args.fqdn) {
|
88
|
+
this.dnsRecordSet = output(args.accessPoint).apply(async accessPoint => {
|
89
|
+
if (accessPoint.dnsProviders.length === 0) {
|
90
|
+
return undefined
|
91
|
+
}
|
92
|
+
|
93
|
+
const fqdn = await toPromise(args.fqdn)
|
94
|
+
if (!fqdn) {
|
95
|
+
return undefined
|
96
|
+
}
|
97
|
+
|
98
|
+
return DnsRecordSet.createOnce(
|
99
|
+
fqdn,
|
100
|
+
{
|
101
|
+
providers: output(args.accessPoint).dnsProviders,
|
102
|
+
values: this.route.endpoints,
|
103
|
+
waitAt: "local",
|
104
|
+
},
|
105
|
+
{ ...opts, parent: this },
|
106
|
+
)
|
107
|
+
})
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}
|