@highstate/library 0.9.7 → 0.9.9
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.manifest.json +1 -1
- package/dist/index.js +95 -19
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/apps/code-server.ts +2 -1
- package/src/apps/grocy.ts +2 -1
- package/src/apps/mariadb.ts +2 -5
- package/src/apps/maybe.ts +2 -1
- package/src/apps/mongodb.ts +2 -5
- package/src/apps/postgresql.ts +2 -5
- package/src/apps/shared.ts +73 -0
- package/src/apps/syncthing.ts +2 -1
- package/src/apps/traefik.ts +5 -0
- package/src/mullvad.ts +2 -0
- package/src/restic.ts +33 -7
package/dist/index.js
CHANGED
@@ -2231,12 +2231,11 @@ import { defineEntity as defineEntity9, defineUnit as defineUnit8, Type as Type1
|
|
2231
2231
|
var repoEntity = defineEntity9({
|
2232
2232
|
type: "restic.repo",
|
2233
2233
|
schema: Type10.Object({
|
2234
|
-
|
2235
|
-
remoteEndpoints: Type10.Array(Type10.String()),
|
2234
|
+
remoteEndpoints: Type10.Array(Type10.Union([l3EndpointEntity.schema, l4EndpointEntity.schema])),
|
2236
2235
|
type: Type10.Literal("rclone"),
|
2237
2236
|
rcloneConfig: Type10.String(),
|
2238
2237
|
remoteName: Type10.String(),
|
2239
|
-
|
2238
|
+
pathPattern: Type10.String()
|
2240
2239
|
}),
|
2241
2240
|
meta: {
|
2242
2241
|
color: "#e56901"
|
@@ -2245,12 +2244,47 @@ var repoEntity = defineEntity9({
|
|
2245
2244
|
var repo = defineUnit8({
|
2246
2245
|
type: "restic.repo",
|
2247
2246
|
args: {
|
2248
|
-
|
2249
|
-
|
2247
|
+
remoteEndpoints: Type10.Default(Type10.Array(Type10.String()), []),
|
2248
|
+
/**
|
2249
|
+
* The pattern for the path where backups will be stored for the specific application.
|
2250
|
+
*
|
2251
|
+
* Available variables:
|
2252
|
+
*
|
2253
|
+
* - `$clusterName`: The name of the Kubernetes cluster where the application is deployed.
|
2254
|
+
* - `$appName`: The name of the application for which the backups are being created. Corresponds to the `appName` argument of the unit.
|
2255
|
+
* - `$unitName`: The name of the unit, which deploys the application, provided by the user.
|
2256
|
+
*
|
2257
|
+
* By default, the path pattern is `backups/$clusterName/$appName`.
|
2258
|
+
*
|
2259
|
+
* @schema
|
2260
|
+
*/
|
2261
|
+
pathPattern: {
|
2262
|
+
...Type10.Default(Type10.String(), "backups/$clusterName/$appName"),
|
2263
|
+
description: `The pattern for the path where backups will be stored for the specific application.
|
2264
|
+
|
2265
|
+
Available variables:
|
2266
|
+
|
2267
|
+
- \`$clusterName\`: The name of the Kubernetes cluster where the application is deployed.
|
2268
|
+
- \`$appName\`: The name of the application for which the backups are being created. Corresponds to the \`appName\` argument of the unit.
|
2269
|
+
- \`$unitName\`: The name of the unit, which deploys the application, provided by the user.
|
2270
|
+
|
2271
|
+
By default, the path pattern is \`backups/$clusterName/$appName\`.`
|
2272
|
+
}
|
2250
2273
|
},
|
2251
2274
|
secrets: {
|
2252
|
-
|
2253
|
-
|
2275
|
+
rcloneConfig: Type10.String({ language: "ini" })
|
2276
|
+
},
|
2277
|
+
inputs: {
|
2278
|
+
remoteL3Endpoints: {
|
2279
|
+
entity: l3EndpointEntity,
|
2280
|
+
multiple: true,
|
2281
|
+
required: false
|
2282
|
+
},
|
2283
|
+
remoteL4Endpoints: {
|
2284
|
+
entity: l4EndpointEntity,
|
2285
|
+
multiple: true,
|
2286
|
+
required: false
|
2287
|
+
}
|
2254
2288
|
},
|
2255
2289
|
outputs: {
|
2256
2290
|
repo: repoEntity
|
@@ -2282,6 +2316,16 @@ var extraArgsDefinitions = {
|
|
2282
2316
|
required: false
|
2283
2317
|
}
|
2284
2318
|
};
|
2319
|
+
var extraSecretsDefinitions = {
|
2320
|
+
rootPassword: {
|
2321
|
+
schema: Type11.String(),
|
2322
|
+
required: false
|
2323
|
+
},
|
2324
|
+
backupPassword: {
|
2325
|
+
schema: Type11.String(),
|
2326
|
+
required: false
|
2327
|
+
}
|
2328
|
+
};
|
2285
2329
|
var eagerExtraInputDefinitions = {
|
2286
2330
|
accessPoint: {
|
2287
2331
|
entity: accessPointEntity
|
@@ -2332,6 +2376,29 @@ function createArgs2(defaultAppName, extraArgs) {
|
|
2332
2376
|
...dynamicArgs
|
2333
2377
|
};
|
2334
2378
|
}
|
2379
|
+
function createSecrets(extraSecrets) {
|
2380
|
+
const dynamicSecrets = {};
|
2381
|
+
if (Array.isArray(extraSecrets)) {
|
2382
|
+
for (const name of extraSecrets) {
|
2383
|
+
dynamicSecrets[name] = extraSecretsDefinitions[name];
|
2384
|
+
}
|
2385
|
+
} else {
|
2386
|
+
const { required, optional } = extraSecrets ?? {};
|
2387
|
+
for (const name of required ?? []) {
|
2388
|
+
dynamicSecrets[name] = {
|
2389
|
+
...extraSecretsDefinitions[name],
|
2390
|
+
required: true
|
2391
|
+
};
|
2392
|
+
}
|
2393
|
+
for (const name of optional ?? []) {
|
2394
|
+
dynamicSecrets[name] = {
|
2395
|
+
...extraSecretsDefinitions[name],
|
2396
|
+
required: false
|
2397
|
+
};
|
2398
|
+
}
|
2399
|
+
}
|
2400
|
+
return dynamicSecrets;
|
2401
|
+
}
|
2335
2402
|
function createInputs(inputs2) {
|
2336
2403
|
const base = {
|
2337
2404
|
k8sCluster: clusterEntity2
|
@@ -2384,9 +2451,7 @@ var mariadbEntity = defineEntity10({
|
|
2384
2451
|
var mariadb = defineUnit9({
|
2385
2452
|
type: "apps.mariadb",
|
2386
2453
|
args: createArgs2("mariadb", ["external"]),
|
2387
|
-
secrets:
|
2388
|
-
rootPassword: Type12.Optional(Type12.String())
|
2389
|
-
},
|
2454
|
+
secrets: createSecrets(["rootPassword", "backupPassword"]),
|
2390
2455
|
inputs: createInputs(["resticRepo"]),
|
2391
2456
|
outputs: {
|
2392
2457
|
mariadb: mariadbEntity,
|
@@ -2437,9 +2502,7 @@ var postgresqlEntity = defineEntity11({
|
|
2437
2502
|
var postgresql = defineUnit10({
|
2438
2503
|
type: "apps.postgresql",
|
2439
2504
|
args: createArgs2("postgresql", ["external"]),
|
2440
|
-
secrets:
|
2441
|
-
rootPassword: Type13.Optional(Type13.String())
|
2442
|
-
},
|
2505
|
+
secrets: createSecrets(["rootPassword", "backupPassword"]),
|
2443
2506
|
inputs: createInputs(["resticRepo", "dnsProviders"]),
|
2444
2507
|
outputs: {
|
2445
2508
|
postgresql: postgresqlEntity,
|
@@ -2508,9 +2571,7 @@ var mongodbEntity = defineEntity12({
|
|
2508
2571
|
var mongodb = defineUnit12({
|
2509
2572
|
type: "apps.mongodb",
|
2510
2573
|
args: createArgs2("mongodb", ["external"]),
|
2511
|
-
secrets:
|
2512
|
-
rootPassword: Type15.Optional(Type15.String())
|
2513
|
-
},
|
2574
|
+
secrets: createSecrets(["rootPassword", "backupPassword"]),
|
2514
2575
|
inputs: createInputs(["resticRepo"]),
|
2515
2576
|
outputs: {
|
2516
2577
|
mongodb: mongodbEntity,
|
@@ -2704,7 +2765,11 @@ var traefikGateway = defineUnit15({
|
|
2704
2765
|
inputs: createInputs(),
|
2705
2766
|
outputs: {
|
2706
2767
|
gateway: gatewayEntity,
|
2707
|
-
service: serviceEntity
|
2768
|
+
service: serviceEntity,
|
2769
|
+
endpoints: {
|
2770
|
+
entity: l4EndpointEntity,
|
2771
|
+
multiple: true
|
2772
|
+
}
|
2708
2773
|
},
|
2709
2774
|
meta: {
|
2710
2775
|
displayName: "Traefik Gateway",
|
@@ -2739,6 +2804,7 @@ import { defineUnit as defineUnit17 } from "@highstate/contract";
|
|
2739
2804
|
var grocy = defineUnit17({
|
2740
2805
|
type: "apps.grocy",
|
2741
2806
|
args: createArgs2("grocy", ["fqdn"]),
|
2807
|
+
secrets: createSecrets(["backupPassword"]),
|
2742
2808
|
inputs: createInputs(["accessPoint", "resticRepo"]),
|
2743
2809
|
meta: {
|
2744
2810
|
displayName: "Grocy",
|
@@ -2755,6 +2821,7 @@ var maybe = defineUnit18({
|
|
2755
2821
|
type: "apps.maybe",
|
2756
2822
|
args: createArgs2("maybe", ["fqdn"]),
|
2757
2823
|
secrets: {
|
2824
|
+
...createSecrets(["backupPassword"]),
|
2758
2825
|
postgresqlPassword: Type19.Optional(Type19.String()),
|
2759
2826
|
secretKey: Type19.Optional(Type19.String())
|
2760
2827
|
},
|
@@ -2840,6 +2907,7 @@ var syncthing = defineUnit20({
|
|
2840
2907
|
*/
|
2841
2908
|
backupMode: Type21.Default(backupModeSchema, "state")
|
2842
2909
|
},
|
2910
|
+
secrets: createSecrets(["backupPassword"]),
|
2843
2911
|
inputs: createInputs(["accessPoint", "resticRepo", "dnsProviders", "volume"]),
|
2844
2912
|
outputs: {
|
2845
2913
|
service: serviceEntity,
|
@@ -2860,6 +2928,7 @@ var codeServer = defineUnit21({
|
|
2860
2928
|
type: "apps.code-server",
|
2861
2929
|
args: createArgs2("code-server", ["fqdn"]),
|
2862
2930
|
secrets: {
|
2931
|
+
...createSecrets(["backupPassword"]),
|
2863
2932
|
password: Type22.Optional(Type22.String()),
|
2864
2933
|
sudoPassword: Type22.Optional(Type22.String())
|
2865
2934
|
},
|
@@ -2982,10 +3051,17 @@ var peer2 = defineUnit24({
|
|
2982
3051
|
* The network to use for the WireGuard peer.
|
2983
3052
|
*
|
2984
3053
|
* If not provided, the peer will use default network configuration.
|
3054
|
+
*
|
3055
|
+
* @schema
|
2985
3056
|
*/
|
2986
3057
|
network: {
|
2987
|
-
|
2988
|
-
|
3058
|
+
...{
|
3059
|
+
entity: networkEntity,
|
3060
|
+
required: false
|
3061
|
+
},
|
3062
|
+
description: `The network to use for the WireGuard peer.
|
3063
|
+
|
3064
|
+
If not provided, the peer will use default network configuration.`
|
2989
3065
|
}
|
2990
3066
|
},
|
2991
3067
|
outputs: {
|