@highstate/library 0.9.18 → 0.9.20
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/highstate.library.msgpack +0 -0
- package/dist/index.js +3684 -3126
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
- package/src/common/access-point.ts +105 -0
- package/src/{files.ts → common/files.ts} +10 -8
- package/src/common/index.ts +3 -0
- package/src/{common.ts → common/server.ts} +69 -38
- package/src/databases/index.ts +4 -0
- package/src/databases/mariadb.ts +37 -0
- package/src/databases/mongodb.ts +37 -0
- package/src/databases/postgresql.ts +37 -0
- package/src/databases/shared.ts +61 -0
- package/src/distributions/ubuntu.ts +6 -4
- package/src/dns.ts +110 -12
- package/src/git.ts +7 -3
- package/src/impl-ref.ts +26 -0
- package/src/index.ts +14 -15
- package/src/k3s.ts +7 -5
- package/src/k8s/apps/code-server.ts +48 -0
- package/src/k8s/apps/gitea.ts +25 -0
- package/src/k8s/apps/grocy.ts +39 -0
- package/src/k8s/apps/hubble.ts +30 -0
- package/src/{apps → k8s/apps}/index.ts +16 -13
- package/src/k8s/apps/kubernetes-dashboard.ts +28 -0
- package/src/k8s/apps/mariadb.ts +83 -0
- package/src/k8s/apps/maybe.ts +39 -0
- package/src/k8s/apps/mongodb.ts +84 -0
- package/src/k8s/apps/postgresql.ts +86 -0
- package/src/k8s/apps/shared.ts +149 -0
- package/src/{apps → k8s/apps}/syncthing.ts +27 -9
- package/src/k8s/apps/traefik.ts +40 -0
- package/src/k8s/apps/vaultwarden.ts +31 -0
- package/src/k8s/apps/workload.ts +214 -0
- package/src/k8s/apps/zitadel.ts +26 -0
- package/src/k8s/cert-manager.ts +80 -0
- package/src/k8s/cilium.ts +64 -0
- package/src/k8s/gateway.ts +70 -0
- package/src/k8s/index.ts +9 -0
- package/src/{obfuscators → k8s/obfuscators}/phantun.ts +10 -6
- package/src/{obfuscators → k8s/obfuscators}/shared.ts +11 -5
- package/src/k8s/resources.ts +111 -0
- package/src/k8s/service.ts +65 -0
- package/src/{k8s.ts → k8s/shared.ts} +35 -329
- package/src/k8s/workload.ts +77 -0
- package/src/network.ts +208 -22
- package/src/nixos.ts +23 -8
- package/src/proxmox.ts +62 -75
- package/src/restic.ts +15 -6
- package/src/sops.ts +16 -5
- package/src/ssh.ts +107 -9
- package/src/talos.ts +6 -4
- package/src/third-party/cloudflare.ts +59 -0
- package/src/third-party/index.ts +4 -0
- package/src/{mullvad.ts → third-party/mullvad.ts} +6 -4
- package/src/third-party/timeweb.ts +99 -0
- package/src/third-party/yandex.ts +211 -0
- package/src/utils.ts +24 -3
- package/src/wireguard.ts +171 -48
- package/src/apps/code-server.ts +0 -34
- package/src/apps/deployment.ts +0 -60
- package/src/apps/dns.ts +0 -107
- package/src/apps/gitea.ts +0 -18
- package/src/apps/grocy.ts +0 -20
- package/src/apps/hubble.ts +0 -20
- package/src/apps/kubernetes-dashboard.ts +0 -19
- package/src/apps/mariadb.ts +0 -81
- package/src/apps/maybe.ts +0 -25
- package/src/apps/mongodb.ts +0 -81
- package/src/apps/network.ts +0 -55
- package/src/apps/postgresql.ts +0 -81
- package/src/apps/shared.ts +0 -289
- package/src/apps/test.ts +0 -19
- package/src/apps/traefik.ts +0 -36
- package/src/apps/vaultwarden.ts +0 -23
- package/src/apps/zitadel.ts +0 -21
- package/src/cloudflare.ts +0 -26
- package/src/timeweb.ts +0 -75
- package/src/{obfuscators → k8s/obfuscators}/index.ts +1 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@highstate/library",
|
3
|
-
"version": "0.9.
|
3
|
+
"version": "0.9.20",
|
4
4
|
"type": "module",
|
5
5
|
"highstate": {
|
6
6
|
"type": "library"
|
@@ -22,11 +22,12 @@
|
|
22
22
|
"build": "highstate build"
|
23
23
|
},
|
24
24
|
"dependencies": {
|
25
|
-
"@highstate/contract": "^0.9.
|
25
|
+
"@highstate/contract": "^0.9.20",
|
26
26
|
"remeda": "^2.21.0"
|
27
27
|
},
|
28
28
|
"devDependencies": {
|
29
|
-
"@highstate/cli": "^0.9.
|
29
|
+
"@highstate/cli": "^0.9.20",
|
30
|
+
"type-fest": "^4.41.0"
|
30
31
|
},
|
31
|
-
"gitHead": "
|
32
|
+
"gitHead": "4bf9183450c2c6f51d6a99d77efc379ff5c7b7ef"
|
32
33
|
}
|
@@ -0,0 +1,105 @@
|
|
1
|
+
import { defineEntity, defineUnit, z } from "@highstate/contract"
|
2
|
+
import * as dns from "../dns"
|
3
|
+
import { implementationReferenceSchema } from "../impl-ref"
|
4
|
+
|
5
|
+
export const gatewayEntity = defineEntity({
|
6
|
+
type: "common.gateway.v1",
|
7
|
+
|
8
|
+
schema: z.object({
|
9
|
+
/**
|
10
|
+
* The reference to the implementation of the gateway.
|
11
|
+
*/
|
12
|
+
implRef: implementationReferenceSchema,
|
13
|
+
}),
|
14
|
+
|
15
|
+
meta: {
|
16
|
+
color: "#F57F17",
|
17
|
+
},
|
18
|
+
})
|
19
|
+
|
20
|
+
export const tlsIssuerEntity = defineEntity({
|
21
|
+
type: "common.tls-issuer.v1",
|
22
|
+
|
23
|
+
schema: z.object({
|
24
|
+
/**
|
25
|
+
* The domain apex for which the TLS issuer will manage certificates.
|
26
|
+
*/
|
27
|
+
domain: z.string(),
|
28
|
+
|
29
|
+
/**
|
30
|
+
* The reference to the implementation of the TLS issuer.
|
31
|
+
*/
|
32
|
+
implRef: implementationReferenceSchema,
|
33
|
+
}),
|
34
|
+
|
35
|
+
meta: {
|
36
|
+
color: "#F57F17",
|
37
|
+
},
|
38
|
+
})
|
39
|
+
|
40
|
+
export const accessPointEntity = defineEntity({
|
41
|
+
type: "common.access-point.v1",
|
42
|
+
|
43
|
+
schema: z.object({
|
44
|
+
/**
|
45
|
+
* The gateway of the access point.
|
46
|
+
*/
|
47
|
+
gateway: gatewayEntity.schema,
|
48
|
+
|
49
|
+
/**
|
50
|
+
* The TLS issuers used to manage TLS certificates for the access point.
|
51
|
+
*/
|
52
|
+
tlsIssuers: tlsIssuerEntity.schema.array(),
|
53
|
+
|
54
|
+
/**
|
55
|
+
* The DNS providers used to manage the DNS records for the access point.
|
56
|
+
*/
|
57
|
+
dnsProviders: dns.providerEntity.schema.array(),
|
58
|
+
}),
|
59
|
+
|
60
|
+
meta: {
|
61
|
+
color: "#F57F17",
|
62
|
+
},
|
63
|
+
})
|
64
|
+
|
65
|
+
/**
|
66
|
+
* The access point unit which can be used to connect to services.
|
67
|
+
*
|
68
|
+
* It can be used to expose services and applications running in Kubernetes clusters or other environments.
|
69
|
+
*/
|
70
|
+
export const accessPoint = defineUnit({
|
71
|
+
type: "common.access-point.v1",
|
72
|
+
|
73
|
+
inputs: {
|
74
|
+
gateway: gatewayEntity,
|
75
|
+
tlsIssuers: {
|
76
|
+
entity: tlsIssuerEntity,
|
77
|
+
required: false,
|
78
|
+
multiple: true,
|
79
|
+
},
|
80
|
+
dnsProviders: {
|
81
|
+
entity: dns.providerEntity,
|
82
|
+
required: false,
|
83
|
+
multiple: true,
|
84
|
+
},
|
85
|
+
},
|
86
|
+
|
87
|
+
outputs: {
|
88
|
+
accessPoint: accessPointEntity,
|
89
|
+
},
|
90
|
+
|
91
|
+
meta: {
|
92
|
+
title: "Access Point",
|
93
|
+
icon: "mdi:access-point",
|
94
|
+
category: "Kubernetes",
|
95
|
+
},
|
96
|
+
|
97
|
+
source: {
|
98
|
+
package: "@highstate/common",
|
99
|
+
path: "units/access-point",
|
100
|
+
},
|
101
|
+
})
|
102
|
+
|
103
|
+
export type Gateway = z.infer<typeof gatewayEntity.schema>
|
104
|
+
export type AccessPoint = z.infer<typeof accessPointEntity.schema>
|
105
|
+
export type TlsIssuer = z.infer<typeof tlsIssuerEntity.schema>
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import {
|
2
|
-
defineEntity,
|
3
|
-
defineUnit,
|
4
|
-
z,
|
5
2
|
fileContentSchema as baseFileContentSchema,
|
6
3
|
fileMetaSchema as baseFileMetaSchema,
|
4
|
+
defineEntity,
|
5
|
+
defineUnit,
|
7
6
|
unitArtifactSchema,
|
7
|
+
z,
|
8
8
|
} from "@highstate/contract"
|
9
|
-
import { l7EndpointEntity } from "
|
9
|
+
import { l7EndpointEntity } from "../network"
|
10
10
|
|
11
11
|
export const checksumAlgorithmSchema = z.enum(["md5", "sha1", "sha256", "sha384", "sha512"])
|
12
12
|
|
@@ -29,7 +29,7 @@ export const fileContentSchema = z.union([
|
|
29
29
|
])
|
30
30
|
|
31
31
|
export const fileEntity = defineEntity({
|
32
|
-
type: "common.file",
|
32
|
+
type: "common.file.v1",
|
33
33
|
|
34
34
|
schema: z.object({
|
35
35
|
meta: baseFileMetaSchema,
|
@@ -74,7 +74,7 @@ export const folderContentSchema = z.union([
|
|
74
74
|
])
|
75
75
|
|
76
76
|
export const folderEntity = defineEntity({
|
77
|
-
type: "common.folder",
|
77
|
+
type: "common.folder.v1",
|
78
78
|
|
79
79
|
schema: z.object({
|
80
80
|
meta: folderMetaSchema,
|
@@ -86,8 +86,11 @@ export const folderEntity = defineEntity({
|
|
86
86
|
},
|
87
87
|
})
|
88
88
|
|
89
|
+
/**
|
90
|
+
* References a file from a remote URL.
|
91
|
+
*/
|
89
92
|
export const remoteFile = defineUnit({
|
90
|
-
type: "common.remote-file",
|
93
|
+
type: "common.remote-file.v1",
|
91
94
|
|
92
95
|
args: {
|
93
96
|
/**
|
@@ -112,7 +115,6 @@ export const remoteFile = defineUnit({
|
|
112
115
|
|
113
116
|
meta: {
|
114
117
|
title: "Remote File",
|
115
|
-
description: "References a file from a remote URL.",
|
116
118
|
icon: "mdi:file-download",
|
117
119
|
category: "Files",
|
118
120
|
},
|
@@ -1,16 +1,23 @@
|
|
1
|
-
import { defineEntity, defineUnit, z } from "@highstate/contract"
|
2
|
-
import
|
3
|
-
import { l3EndpointEntity } from "
|
4
|
-
import * as
|
5
|
-
import { arrayPatchModeSchema } from "
|
6
|
-
|
1
|
+
import { $outputs, $secrets, defineEntity, defineUnit, z } from "@highstate/contract"
|
2
|
+
import * as dns from "../dns"
|
3
|
+
import { l3EndpointEntity } from "../network"
|
4
|
+
import * as ssh from "../ssh"
|
5
|
+
import { arrayPatchModeSchema } from "../utils"
|
6
|
+
|
7
|
+
/**
|
8
|
+
* The server entity represents a server with its hostname, endpoints, and optional SSH configuration.
|
9
|
+
*
|
10
|
+
* The OS of the server is not specified (but in most cases it will one of the Linux distributions).
|
11
|
+
*
|
12
|
+
* In fact, anything that have hostname (which can be any string) and L3 endpoints can be represented by this entity.
|
13
|
+
*/
|
7
14
|
export const serverEntity = defineEntity({
|
8
|
-
type: "common.server",
|
15
|
+
type: "common.server.v1",
|
9
16
|
|
10
17
|
schema: z.object({
|
11
18
|
hostname: z.string(),
|
12
19
|
endpoints: l3EndpointEntity.schema.array(),
|
13
|
-
ssh:
|
20
|
+
ssh: ssh.connectionSchema.optional(),
|
14
21
|
}),
|
15
22
|
|
16
23
|
meta: {
|
@@ -18,16 +25,47 @@ export const serverEntity = defineEntity({
|
|
18
25
|
},
|
19
26
|
})
|
20
27
|
|
21
|
-
|
28
|
+
/**
|
29
|
+
* The common outputs for units which create or modify a server.
|
30
|
+
*/
|
31
|
+
export const serverOutputs = $outputs({
|
32
|
+
/**
|
33
|
+
* The server entity representing the server.
|
34
|
+
*/
|
22
35
|
server: serverEntity,
|
36
|
+
|
37
|
+
/**
|
38
|
+
* The L3 endpoints of the server.
|
39
|
+
*/
|
23
40
|
endpoints: {
|
24
41
|
entity: l3EndpointEntity,
|
25
42
|
multiple: true,
|
26
43
|
},
|
27
|
-
}
|
44
|
+
})
|
45
|
+
|
46
|
+
export const vmSshArgs = ssh.argsSchema.omit({ user: true }).prefault({})
|
47
|
+
|
48
|
+
export const vmSecrets = $secrets({
|
49
|
+
/**
|
50
|
+
* The root password for the virtual machine.
|
51
|
+
*
|
52
|
+
* If not specified, will be generated automatically.
|
53
|
+
*/
|
54
|
+
rootPassword: z.string().optional(),
|
55
|
+
|
56
|
+
/**
|
57
|
+
* The SSH private for the `root` user of the virtual machine in PEM format.
|
58
|
+
*
|
59
|
+
* If not specified or provided via `keyPair`, will be generated automatically.
|
60
|
+
*/
|
61
|
+
sshPrivateKey: ssh.secrets.sshPrivateKey,
|
62
|
+
})
|
28
63
|
|
64
|
+
/**
|
65
|
+
* The existing server created outside of the Highstate.
|
66
|
+
*/
|
29
67
|
export const existingServer = defineUnit({
|
30
|
-
type: "common.existing-server",
|
68
|
+
type: "common.existing-server.v1",
|
31
69
|
|
32
70
|
args: {
|
33
71
|
/**
|
@@ -38,37 +76,28 @@ export const existingServer = defineUnit({
|
|
38
76
|
endpoint: z.string().optional(),
|
39
77
|
|
40
78
|
/**
|
41
|
-
* The SSH
|
79
|
+
* The SSH confuguration for the server.
|
42
80
|
*/
|
43
|
-
|
44
|
-
|
45
|
-
/**
|
46
|
-
* The SSH port to use for connecting to the server.
|
47
|
-
*/
|
48
|
-
sshPort: z.number().default(22),
|
81
|
+
ssh: ssh.argsSchema.prefault({}),
|
49
82
|
},
|
50
83
|
|
51
84
|
secrets: {
|
52
|
-
|
53
|
-
sshPrivateKey: z.string().optional(),
|
85
|
+
...ssh.secrets,
|
54
86
|
},
|
55
87
|
|
56
88
|
inputs: {
|
57
|
-
sshKeyPair: {
|
58
|
-
entity: keyPairEntity,
|
59
|
-
required: false,
|
60
|
-
},
|
61
89
|
endpoint: {
|
62
90
|
entity: l3EndpointEntity,
|
63
91
|
required: false,
|
64
92
|
},
|
93
|
+
|
94
|
+
...ssh.inputs,
|
65
95
|
},
|
66
96
|
|
67
97
|
outputs: serverOutputs,
|
68
98
|
|
69
99
|
meta: {
|
70
100
|
title: "Existing Server",
|
71
|
-
description: "An existing server that can be used in the configuration.",
|
72
101
|
icon: "mdi:server",
|
73
102
|
defaultNamePrefix: "server",
|
74
103
|
category: "Infrastructure",
|
@@ -80,8 +109,11 @@ export const existingServer = defineUnit({
|
|
80
109
|
},
|
81
110
|
})
|
82
111
|
|
112
|
+
/**
|
113
|
+
* Patches some properties of the server and outputs the updated server.
|
114
|
+
*/
|
83
115
|
export const serverPatch = defineUnit({
|
84
|
-
type: "common.server-patch",
|
116
|
+
type: "common.server-patch.v1",
|
85
117
|
|
86
118
|
args: {
|
87
119
|
/**
|
@@ -112,16 +144,11 @@ export const serverPatch = defineUnit({
|
|
112
144
|
},
|
113
145
|
|
114
146
|
outputs: {
|
115
|
-
|
116
|
-
endpoints: {
|
117
|
-
entity: l3EndpointEntity,
|
118
|
-
multiple: true,
|
119
|
-
},
|
147
|
+
...serverOutputs,
|
120
148
|
},
|
121
149
|
|
122
150
|
meta: {
|
123
151
|
title: "Server Patch",
|
124
|
-
description: "Patches some properties of the server.",
|
125
152
|
icon: "mdi:server",
|
126
153
|
secondaryIcon: "fluent:patch-20-filled",
|
127
154
|
category: "Infrastructure",
|
@@ -133,8 +160,13 @@ export const serverPatch = defineUnit({
|
|
133
160
|
},
|
134
161
|
})
|
135
162
|
|
163
|
+
/**
|
164
|
+
* Creates a DNS record for the server and updates the endpoints.
|
165
|
+
*
|
166
|
+
* The DNS record will be created with the provided FQDN and the endpoints will be updated with the DNS record.
|
167
|
+
*/
|
136
168
|
export const serverDns = defineUnit({
|
137
|
-
type: "common.server-dns",
|
169
|
+
type: "common.server-dns.v1",
|
138
170
|
|
139
171
|
args: dns.createArgs(),
|
140
172
|
|
@@ -153,7 +185,6 @@ export const serverDns = defineUnit({
|
|
153
185
|
|
154
186
|
meta: {
|
155
187
|
title: "Server DNS",
|
156
|
-
description: "Creates DNS records for the server and updates endpoints.",
|
157
188
|
icon: "mdi:server",
|
158
189
|
secondaryIcon: "mdi:dns",
|
159
190
|
category: "Infrastructure",
|
@@ -165,8 +196,11 @@ export const serverDns = defineUnit({
|
|
165
196
|
},
|
166
197
|
})
|
167
198
|
|
199
|
+
/**
|
200
|
+
* Runs a shell script on the server.
|
201
|
+
*/
|
168
202
|
export const script = defineUnit({
|
169
|
-
type: "common.script",
|
203
|
+
type: "common.script.v1",
|
170
204
|
|
171
205
|
args: {
|
172
206
|
script: z.string().meta({ language: "shell" }),
|
@@ -184,7 +218,6 @@ export const script = defineUnit({
|
|
184
218
|
|
185
219
|
meta: {
|
186
220
|
title: "Shell Script",
|
187
|
-
description: "Run a shell script on the server.",
|
188
221
|
icon: "mdi:bash",
|
189
222
|
category: "Infrastructure",
|
190
223
|
},
|
@@ -196,5 +229,3 @@ export const script = defineUnit({
|
|
196
229
|
})
|
197
230
|
|
198
231
|
export type Server = z.infer<typeof serverEntity.schema>
|
199
|
-
|
200
|
-
export * from "./files"
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { defineEntity, defineUnit, type z } from "@highstate/contract"
|
2
|
+
import { sharedArgs, sharedInputs, sharedSchema, sharedSecrets } from "./shared"
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Represents the MariaDB database or virtual database behind it.
|
6
|
+
*/
|
7
|
+
export const mariadbEntity = defineEntity({
|
8
|
+
type: "databases.mariadb.v1",
|
9
|
+
|
10
|
+
schema: sharedSchema,
|
11
|
+
|
12
|
+
meta: {
|
13
|
+
color: "#f06292",
|
14
|
+
},
|
15
|
+
})
|
16
|
+
|
17
|
+
/**
|
18
|
+
* The existing MariaDB database or virtual database behind it.
|
19
|
+
*/
|
20
|
+
export const existingMariadb = defineUnit({
|
21
|
+
type: "databases.mariadb.existing.v1",
|
22
|
+
|
23
|
+
args: sharedArgs,
|
24
|
+
secrets: sharedSecrets,
|
25
|
+
inputs: sharedInputs,
|
26
|
+
|
27
|
+
outputs: {
|
28
|
+
mariadb: mariadbEntity,
|
29
|
+
},
|
30
|
+
|
31
|
+
source: {
|
32
|
+
package: "@highstate/common",
|
33
|
+
path: "databases/existing-mariadb",
|
34
|
+
},
|
35
|
+
})
|
36
|
+
|
37
|
+
export type MariaDB = z.infer<typeof mariadbEntity.schema>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { defineEntity, defineUnit, type z } from "@highstate/contract"
|
2
|
+
import { sharedArgs, sharedInputs, sharedSchema, sharedSecrets } from "./shared"
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Represents the MongoDB database or virtual database behind it.
|
6
|
+
*/
|
7
|
+
export const mongodbEntity = defineEntity({
|
8
|
+
type: "databases.mongodb.v1",
|
9
|
+
|
10
|
+
schema: sharedSchema,
|
11
|
+
|
12
|
+
meta: {
|
13
|
+
color: "#13aa52",
|
14
|
+
},
|
15
|
+
})
|
16
|
+
|
17
|
+
/**
|
18
|
+
* The existing MongoDB database or virtual database behind it.
|
19
|
+
*/
|
20
|
+
export const existingMongodb = defineUnit({
|
21
|
+
type: "databases.mongodb.existing.v1",
|
22
|
+
|
23
|
+
args: sharedArgs,
|
24
|
+
secrets: sharedSecrets,
|
25
|
+
inputs: sharedInputs,
|
26
|
+
|
27
|
+
outputs: {
|
28
|
+
mongodb: mongodbEntity,
|
29
|
+
},
|
30
|
+
|
31
|
+
source: {
|
32
|
+
package: "@highstate/common",
|
33
|
+
path: "databases/existing-mongodb",
|
34
|
+
},
|
35
|
+
})
|
36
|
+
|
37
|
+
export type MongoDB = z.infer<typeof mongodbEntity.schema>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { defineEntity, defineUnit, type z } from "@highstate/contract"
|
2
|
+
import { sharedArgs, sharedInputs, sharedSchema, sharedSecrets } from "./shared"
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Represents the PostgreSQL database or virtual database behind it.
|
6
|
+
*/
|
7
|
+
export const postgresqlEntity = defineEntity({
|
8
|
+
type: "databases.postgresql.v1",
|
9
|
+
|
10
|
+
schema: sharedSchema,
|
11
|
+
|
12
|
+
meta: {
|
13
|
+
color: "#336791",
|
14
|
+
},
|
15
|
+
})
|
16
|
+
|
17
|
+
/**
|
18
|
+
* The existing PostgreSQL database or virtual database behind it.
|
19
|
+
*/
|
20
|
+
export const existingPostgresql = defineUnit({
|
21
|
+
type: "databases.postgresql.existing.v1",
|
22
|
+
|
23
|
+
args: sharedArgs,
|
24
|
+
secrets: sharedSecrets,
|
25
|
+
inputs: sharedInputs,
|
26
|
+
|
27
|
+
outputs: {
|
28
|
+
postgresql: postgresqlEntity,
|
29
|
+
},
|
30
|
+
|
31
|
+
source: {
|
32
|
+
package: "@highstate/common",
|
33
|
+
path: "databases/existing-postgresql",
|
34
|
+
},
|
35
|
+
})
|
36
|
+
|
37
|
+
export type PostgreSQL = z.infer<typeof postgresqlEntity.schema>
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import { $args, $inputs, $secrets, z } from "@highstate/contract"
|
2
|
+
import { l4EndpointEntity } from "../network"
|
3
|
+
|
4
|
+
export const sharedSchema = z.object({
|
5
|
+
/**
|
6
|
+
* The endpoints to connect to the database.
|
7
|
+
*/
|
8
|
+
endpoints: l4EndpointEntity.schema.array(),
|
9
|
+
|
10
|
+
/**
|
11
|
+
* The username to connect to the database with.
|
12
|
+
*/
|
13
|
+
username: z.string(),
|
14
|
+
|
15
|
+
/**
|
16
|
+
* The password to connect to the database with.
|
17
|
+
*/
|
18
|
+
password: z.string().optional(),
|
19
|
+
|
20
|
+
/**
|
21
|
+
* The name of the database to connect to.
|
22
|
+
*/
|
23
|
+
database: z.string().optional(),
|
24
|
+
})
|
25
|
+
|
26
|
+
export const sharedArgs = $args({
|
27
|
+
/**
|
28
|
+
* The endpoints to connect to the database in form of `host:port`.
|
29
|
+
*/
|
30
|
+
endpoints: z.string().array().min(1),
|
31
|
+
|
32
|
+
/**
|
33
|
+
* The username to connect to the database with.
|
34
|
+
*
|
35
|
+
* If not provided, defaults to `root`.
|
36
|
+
*/
|
37
|
+
username: z.string().default("root"),
|
38
|
+
|
39
|
+
/**
|
40
|
+
* The name of the database to connect to.
|
41
|
+
*/
|
42
|
+
database: z.string().optional(),
|
43
|
+
})
|
44
|
+
|
45
|
+
export const sharedSecrets = $secrets({
|
46
|
+
/**
|
47
|
+
* The password to connect to the database with.
|
48
|
+
*/
|
49
|
+
password: z.string().optional(),
|
50
|
+
})
|
51
|
+
|
52
|
+
export const sharedInputs = $inputs({
|
53
|
+
/**
|
54
|
+
* The endpoints to connect to the database.
|
55
|
+
*/
|
56
|
+
endpoints: {
|
57
|
+
entity: l4EndpointEntity,
|
58
|
+
multiple: true,
|
59
|
+
required: false,
|
60
|
+
},
|
61
|
+
})
|
@@ -1,11 +1,14 @@
|
|
1
1
|
import { defineUnit, z } from "@highstate/contract"
|
2
|
-
import { fileEntity } from "../files"
|
2
|
+
import { fileEntity } from "../common/files"
|
3
3
|
|
4
|
-
export const ubuntuVersionSchema = z.enum(["22.04", "24.04", "
|
4
|
+
export const ubuntuVersionSchema = z.enum(["22.04", "24.04", "25.04", "25.10"])
|
5
5
|
export const ubuntuArchitectureSchema = z.enum(["amd64", "arm64"])
|
6
6
|
|
7
|
+
/**
|
8
|
+
* Ubuntu distribution with image and cloud-config.
|
9
|
+
*/
|
7
10
|
export const ubuntu = defineUnit({
|
8
|
-
type: "distributions.ubuntu",
|
11
|
+
type: "distributions.ubuntu.v1",
|
9
12
|
|
10
13
|
args: {
|
11
14
|
version: ubuntuVersionSchema.default("24.04"),
|
@@ -19,7 +22,6 @@ export const ubuntu = defineUnit({
|
|
19
22
|
|
20
23
|
meta: {
|
21
24
|
title: "Ubuntu",
|
22
|
-
description: "Ubuntu distribution with image and cloud-config.",
|
23
25
|
icon: "mdi:ubuntu",
|
24
26
|
iconColor: "#E95420",
|
25
27
|
category: "Distributions",
|