@highstate/library 0.9.8 → 0.9.10
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/index.js +117 -25
- 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 +7 -5
- package/src/apps/maybe.ts +2 -1
- package/src/apps/mongodb.ts +7 -5
- package/src/apps/postgresql.ts +7 -5
- package/src/apps/shared.ts +73 -0
- package/src/apps/syncthing.ts +10 -4
- package/src/apps/traefik.ts +5 -0
- package/src/mullvad.ts +2 -0
- package/src/restic.ts +33 -7
- package/dist/highstate.manifest.json +0 -5
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,13 +2451,15 @@ 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,
|
2393
|
-
service: serviceEntity
|
2458
|
+
service: serviceEntity,
|
2459
|
+
endpoints: {
|
2460
|
+
entity: l4EndpointEntity,
|
2461
|
+
multiple: true
|
2462
|
+
}
|
2394
2463
|
},
|
2395
2464
|
meta: {
|
2396
2465
|
displayName: "MariaDB",
|
@@ -2437,13 +2506,15 @@ var postgresqlEntity = defineEntity11({
|
|
2437
2506
|
var postgresql = defineUnit10({
|
2438
2507
|
type: "apps.postgresql",
|
2439
2508
|
args: createArgs2("postgresql", ["external"]),
|
2440
|
-
secrets:
|
2441
|
-
rootPassword: Type13.Optional(Type13.String())
|
2442
|
-
},
|
2509
|
+
secrets: createSecrets(["rootPassword", "backupPassword"]),
|
2443
2510
|
inputs: createInputs(["resticRepo", "dnsProviders"]),
|
2444
2511
|
outputs: {
|
2445
2512
|
postgresql: postgresqlEntity,
|
2446
|
-
service: serviceEntity
|
2513
|
+
service: serviceEntity,
|
2514
|
+
endpoints: {
|
2515
|
+
entity: l4EndpointEntity,
|
2516
|
+
multiple: true
|
2517
|
+
}
|
2447
2518
|
},
|
2448
2519
|
meta: {
|
2449
2520
|
displayName: "PostgreSQL",
|
@@ -2508,13 +2579,15 @@ var mongodbEntity = defineEntity12({
|
|
2508
2579
|
var mongodb = defineUnit12({
|
2509
2580
|
type: "apps.mongodb",
|
2510
2581
|
args: createArgs2("mongodb", ["external"]),
|
2511
|
-
secrets:
|
2512
|
-
rootPassword: Type15.Optional(Type15.String())
|
2513
|
-
},
|
2582
|
+
secrets: createSecrets(["rootPassword", "backupPassword"]),
|
2514
2583
|
inputs: createInputs(["resticRepo"]),
|
2515
2584
|
outputs: {
|
2516
2585
|
mongodb: mongodbEntity,
|
2517
|
-
service: serviceEntity
|
2586
|
+
service: serviceEntity,
|
2587
|
+
endpoints: {
|
2588
|
+
entity: l4EndpointEntity,
|
2589
|
+
multiple: true
|
2590
|
+
}
|
2518
2591
|
},
|
2519
2592
|
meta: {
|
2520
2593
|
displayName: "MongoDB",
|
@@ -2704,7 +2777,11 @@ var traefikGateway = defineUnit15({
|
|
2704
2777
|
inputs: createInputs(),
|
2705
2778
|
outputs: {
|
2706
2779
|
gateway: gatewayEntity,
|
2707
|
-
service: serviceEntity
|
2780
|
+
service: serviceEntity,
|
2781
|
+
endpoints: {
|
2782
|
+
entity: l4EndpointEntity,
|
2783
|
+
multiple: true
|
2784
|
+
}
|
2708
2785
|
},
|
2709
2786
|
meta: {
|
2710
2787
|
displayName: "Traefik Gateway",
|
@@ -2739,6 +2816,7 @@ import { defineUnit as defineUnit17 } from "@highstate/contract";
|
|
2739
2816
|
var grocy = defineUnit17({
|
2740
2817
|
type: "apps.grocy",
|
2741
2818
|
args: createArgs2("grocy", ["fqdn"]),
|
2819
|
+
secrets: createSecrets(["backupPassword"]),
|
2742
2820
|
inputs: createInputs(["accessPoint", "resticRepo"]),
|
2743
2821
|
meta: {
|
2744
2822
|
displayName: "Grocy",
|
@@ -2755,6 +2833,7 @@ var maybe = defineUnit18({
|
|
2755
2833
|
type: "apps.maybe",
|
2756
2834
|
args: createArgs2("maybe", ["fqdn"]),
|
2757
2835
|
secrets: {
|
2836
|
+
...createSecrets(["backupPassword"]),
|
2758
2837
|
postgresqlPassword: Type19.Optional(Type19.String()),
|
2759
2838
|
secretKey: Type19.Optional(Type19.String())
|
2760
2839
|
},
|
@@ -2821,7 +2900,7 @@ var backupModeSchema = Type21.StringEnum(["state", "full"]);
|
|
2821
2900
|
var syncthing = defineUnit20({
|
2822
2901
|
type: "apps.syncthing",
|
2823
2902
|
args: {
|
2824
|
-
...createArgs2("syncthing", ["fqdn"]),
|
2903
|
+
...createArgs2("syncthing", ["fqdn", "external"]),
|
2825
2904
|
/**
|
2826
2905
|
* The FQDN of the Syncthing instance used to sync with other devices.
|
2827
2906
|
*
|
@@ -2840,10 +2919,15 @@ var syncthing = defineUnit20({
|
|
2840
2919
|
*/
|
2841
2920
|
backupMode: Type21.Default(backupModeSchema, "state")
|
2842
2921
|
},
|
2843
|
-
|
2922
|
+
secrets: createSecrets(["backupPassword"]),
|
2923
|
+
inputs: createInputs(["accessPoint", "resticRepo", "volume"]),
|
2844
2924
|
outputs: {
|
2925
|
+
volume: persistentVolumeClaimEntity,
|
2845
2926
|
service: serviceEntity,
|
2846
|
-
|
2927
|
+
endpoints: {
|
2928
|
+
entity: l4EndpointEntity,
|
2929
|
+
multiple: true
|
2930
|
+
}
|
2847
2931
|
},
|
2848
2932
|
meta: {
|
2849
2933
|
displayName: "Syncthing",
|
@@ -2860,6 +2944,7 @@ var codeServer = defineUnit21({
|
|
2860
2944
|
type: "apps.code-server",
|
2861
2945
|
args: createArgs2("code-server", ["fqdn"]),
|
2862
2946
|
secrets: {
|
2947
|
+
...createSecrets(["backupPassword"]),
|
2863
2948
|
password: Type22.Optional(Type22.String()),
|
2864
2949
|
sudoPassword: Type22.Optional(Type22.String())
|
2865
2950
|
},
|
@@ -2982,10 +3067,17 @@ var peer2 = defineUnit24({
|
|
2982
3067
|
* The network to use for the WireGuard peer.
|
2983
3068
|
*
|
2984
3069
|
* If not provided, the peer will use default network configuration.
|
3070
|
+
*
|
3071
|
+
* @schema
|
2985
3072
|
*/
|
2986
3073
|
network: {
|
2987
|
-
|
2988
|
-
|
3074
|
+
...{
|
3075
|
+
entity: networkEntity,
|
3076
|
+
required: false
|
3077
|
+
},
|
3078
|
+
description: `The network to use for the WireGuard peer.
|
3079
|
+
|
3080
|
+
If not provided, the peer will use default network configuration.`
|
2989
3081
|
}
|
2990
3082
|
},
|
2991
3083
|
outputs: {
|