@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.
Files changed (79) hide show
  1. package/dist/highstate.library.msgpack +0 -0
  2. package/dist/index.js +3684 -3126
  3. package/dist/index.js.map +1 -1
  4. package/package.json +5 -4
  5. package/src/common/access-point.ts +105 -0
  6. package/src/{files.ts → common/files.ts} +10 -8
  7. package/src/common/index.ts +3 -0
  8. package/src/{common.ts → common/server.ts} +69 -38
  9. package/src/databases/index.ts +4 -0
  10. package/src/databases/mariadb.ts +37 -0
  11. package/src/databases/mongodb.ts +37 -0
  12. package/src/databases/postgresql.ts +37 -0
  13. package/src/databases/shared.ts +61 -0
  14. package/src/distributions/ubuntu.ts +6 -4
  15. package/src/dns.ts +110 -12
  16. package/src/git.ts +7 -3
  17. package/src/impl-ref.ts +26 -0
  18. package/src/index.ts +14 -15
  19. package/src/k3s.ts +7 -5
  20. package/src/k8s/apps/code-server.ts +48 -0
  21. package/src/k8s/apps/gitea.ts +25 -0
  22. package/src/k8s/apps/grocy.ts +39 -0
  23. package/src/k8s/apps/hubble.ts +30 -0
  24. package/src/{apps → k8s/apps}/index.ts +16 -13
  25. package/src/k8s/apps/kubernetes-dashboard.ts +28 -0
  26. package/src/k8s/apps/mariadb.ts +83 -0
  27. package/src/k8s/apps/maybe.ts +39 -0
  28. package/src/k8s/apps/mongodb.ts +84 -0
  29. package/src/k8s/apps/postgresql.ts +86 -0
  30. package/src/k8s/apps/shared.ts +149 -0
  31. package/src/{apps → k8s/apps}/syncthing.ts +27 -9
  32. package/src/k8s/apps/traefik.ts +40 -0
  33. package/src/k8s/apps/vaultwarden.ts +31 -0
  34. package/src/k8s/apps/workload.ts +214 -0
  35. package/src/k8s/apps/zitadel.ts +26 -0
  36. package/src/k8s/cert-manager.ts +80 -0
  37. package/src/k8s/cilium.ts +64 -0
  38. package/src/k8s/gateway.ts +70 -0
  39. package/src/k8s/index.ts +9 -0
  40. package/src/{obfuscators → k8s/obfuscators}/phantun.ts +10 -6
  41. package/src/{obfuscators → k8s/obfuscators}/shared.ts +11 -5
  42. package/src/k8s/resources.ts +111 -0
  43. package/src/k8s/service.ts +65 -0
  44. package/src/{k8s.ts → k8s/shared.ts} +35 -329
  45. package/src/k8s/workload.ts +77 -0
  46. package/src/network.ts +208 -22
  47. package/src/nixos.ts +23 -8
  48. package/src/proxmox.ts +62 -75
  49. package/src/restic.ts +15 -6
  50. package/src/sops.ts +16 -5
  51. package/src/ssh.ts +107 -9
  52. package/src/talos.ts +6 -4
  53. package/src/third-party/cloudflare.ts +59 -0
  54. package/src/third-party/index.ts +4 -0
  55. package/src/{mullvad.ts → third-party/mullvad.ts} +6 -4
  56. package/src/third-party/timeweb.ts +99 -0
  57. package/src/third-party/yandex.ts +211 -0
  58. package/src/utils.ts +24 -3
  59. package/src/wireguard.ts +171 -48
  60. package/src/apps/code-server.ts +0 -34
  61. package/src/apps/deployment.ts +0 -60
  62. package/src/apps/dns.ts +0 -107
  63. package/src/apps/gitea.ts +0 -18
  64. package/src/apps/grocy.ts +0 -20
  65. package/src/apps/hubble.ts +0 -20
  66. package/src/apps/kubernetes-dashboard.ts +0 -19
  67. package/src/apps/mariadb.ts +0 -81
  68. package/src/apps/maybe.ts +0 -25
  69. package/src/apps/mongodb.ts +0 -81
  70. package/src/apps/network.ts +0 -55
  71. package/src/apps/postgresql.ts +0 -81
  72. package/src/apps/shared.ts +0 -289
  73. package/src/apps/test.ts +0 -19
  74. package/src/apps/traefik.ts +0 -36
  75. package/src/apps/vaultwarden.ts +0 -23
  76. package/src/apps/zitadel.ts +0 -21
  77. package/src/cloudflare.ts +0 -26
  78. package/src/timeweb.ts +0 -75
  79. package/src/{obfuscators → k8s/obfuscators}/index.ts +1 -1
@@ -1,34 +0,0 @@
1
- import { defineUnit, z } from "@highstate/contract"
2
- import { persistentVolumeClaimEntity, statefulSetEntity } from "../k8s"
3
- import { createArgs, createInputs, createSecrets } from "./shared"
4
-
5
- export const codeServer = defineUnit({
6
- type: "apps.code-server",
7
-
8
- args: createArgs("code-server", ["fqdn"]),
9
-
10
- secrets: {
11
- ...createSecrets(["backupPassword"]),
12
- password: z.string().optional(),
13
- sudoPassword: z.string().optional(),
14
- },
15
-
16
- inputs: createInputs(["accessPoint", "resticRepo", "dnsProviders", "volume"]),
17
-
18
- outputs: {
19
- statefulSet: statefulSetEntity,
20
- volume: persistentVolumeClaimEntity,
21
- },
22
-
23
- meta: {
24
- title: "Code Server",
25
- description: "The Code Server instance deployed on Kubernetes.",
26
- icon: "material-icon-theme:vscode",
27
- category: "Development",
28
- },
29
-
30
- source: {
31
- package: "@highstate/apps",
32
- path: "code-server",
33
- },
34
- })
@@ -1,60 +0,0 @@
1
- import { defineUnit, z } from "@highstate/contract"
2
- import { deploymentEntity, serviceEntity, serviceTypeSchema } from "../k8s"
3
- import { createInputs, createSource } from "./shared"
4
-
5
- export const deployment = defineUnit({
6
- type: "apps.deployment",
7
-
8
- args: {
9
- appName: z.string().optional(),
10
-
11
- fqdn: z.string().optional(),
12
- serviceType: serviceTypeSchema.optional(),
13
-
14
- image: z.string().optional(),
15
- port: z.number().optional(),
16
- replicas: z.number().optional(),
17
-
18
- dataPath: z.string().optional(),
19
-
20
- env: z.record(z.string(), z.any()).optional(),
21
-
22
- mariadbEnvMapping: z.record(z.string(), z.any()).optional(),
23
- postgresqlEnvMapping: z.record(z.string(), z.any()).optional(),
24
- mongodbEnvMapping: z.record(z.string(), z.any()).optional(),
25
-
26
- manifest: z.record(z.string(), z.any()).optional(),
27
- serviceManifest: z.record(z.string(), z.any()).optional(),
28
- httpRouteManifest: z.record(z.string(), z.any()).optional(),
29
- },
30
-
31
- secrets: {
32
- mariadbPassword: z.string().optional(),
33
- postgresqlPassword: z.string().optional(),
34
- mongodbPassword: z.string().optional(),
35
- },
36
-
37
- inputs: createInputs([
38
- "accessPoint",
39
- "mariadb",
40
- "postgresql",
41
- "mongodb",
42
- "resticRepo",
43
- "dnsProviders",
44
- ]),
45
-
46
- outputs: {
47
- deployment: deploymentEntity,
48
- service: serviceEntity,
49
- },
50
-
51
- meta: {
52
- title: "Kubernetes Deployment",
53
- description: "A generic Kubernetes deployment with optional service and gateway routes.",
54
- icon: "devicon:kubernetes",
55
- secondaryIcon: "mdi:cube-outline",
56
- category: "Kubernetes",
57
- },
58
-
59
- source: createSource("deployment"),
60
- })
package/src/apps/dns.ts DELETED
@@ -1,107 +0,0 @@
1
- import { defineUnit, z } from "@highstate/contract"
2
- import { l3EndpointEntity, l4EndpointEntity } from "../network"
3
- import { providerEntity } from "../dns"
4
- import { createSource } from "./shared"
5
-
6
- const endpointFilterSchema = z.enum(["all", "public", "external", "internal"])
7
-
8
- export const recordSet = defineUnit({
9
- type: "apps.dns-record-set",
10
-
11
- args: {
12
- /**
13
- * The name of the DNS record.
14
- *
15
- * If not provided, will use the name of the unit.
16
- */
17
- recordName: z.string().optional(),
18
-
19
- /**
20
- * The type of the DNS record.
21
- *
22
- * If not specified, will use the default type for the provider.
23
- */
24
- type: z.string().optional(),
25
-
26
- /**
27
- * The values of the DNS record.
28
- */
29
- values: z.string().array(),
30
-
31
- /**
32
- * The TTL of the DNS record.
33
- */
34
- ttl: z.number().optional(),
35
-
36
- /**
37
- * The priority of the DNS record.
38
- */
39
- priority: z.number().optional(),
40
-
41
- /**
42
- * Whether the DNS record is proxied.
43
- *
44
- * Available only for public IPs and some DNS providers like Cloudflare.
45
- */
46
- proxied: z.boolean().optional(),
47
-
48
- /**
49
- * The filter to apply to the endpoints.
50
- *
51
- * - `all`: All endpoints.
52
- * - `public`: Only public endpoints accessible from the internet (default).
53
- * - `external`: Only external endpoints (e.g. NodePort, LoadBalancer) accessible from outside the cluster, but not from the internet.
54
- * - `internal`: Only internal endpoints (e.g. ClusterIP) accessible from within the cluster.
55
- */
56
- endpointFilter: endpointFilterSchema.default("public"),
57
- },
58
-
59
- inputs: {
60
- dnsProviders: {
61
- entity: providerEntity,
62
- multiple: true,
63
- },
64
- l3Endpoints: {
65
- entity: l3EndpointEntity,
66
- required: false,
67
- multiple: true,
68
- },
69
- l4Endpoints: {
70
- entity: l4EndpointEntity,
71
- required: false,
72
- multiple: true,
73
- },
74
- },
75
-
76
- outputs: {
77
- /**
78
- * The single L3 endpoint representing created DNS records.
79
- */
80
- l3Endpoint: l3EndpointEntity,
81
-
82
- /**
83
- * Multiple L4 endpoints representing created DNS records for each unique port/protocol combination from the input L4 endpoints.
84
- */
85
- l4Endpoints: {
86
- entity: l4EndpointEntity,
87
- multiple: true,
88
- },
89
- },
90
-
91
- meta: {
92
- title: "DNS Record Set",
93
- description: "A set of DNS records to be created.",
94
- icon: "mdi:server",
95
- defaultNamePrefix: "record",
96
- category: "Network",
97
- },
98
-
99
- source: createSource("dns-record-set"),
100
- })
101
-
102
- export const sharedArgs = {
103
- /**
104
- * The FQDN to register the cluster nodes with.
105
- */
106
- fqdn: z.string().optional(),
107
- }
package/src/apps/gitea.ts DELETED
@@ -1,18 +0,0 @@
1
- import { defineUnit } from "@highstate/contract"
2
- import { createArgs, createInputs, createSource } from "./shared"
3
-
4
- export const gitea = defineUnit({
5
- type: "apps.gitea",
6
-
7
- args: createArgs("gitea"),
8
- inputs: createInputs(["accessPoint", "mariadb"]),
9
-
10
- meta: {
11
- title: "Gitea",
12
- description: "The Gitea Git server deployed on Kubernetes.",
13
- icon: "simple-icons:gitea",
14
- category: "Development",
15
- },
16
-
17
- source: createSource("gitea"),
18
- })
package/src/apps/grocy.ts DELETED
@@ -1,20 +0,0 @@
1
- import { defineUnit } from "@highstate/contract"
2
- import { createArgs, createInputs, createSecrets, createSource } from "./shared"
3
-
4
- export const grocy = defineUnit({
5
- type: "apps.grocy",
6
-
7
- args: createArgs("grocy", ["fqdn"]),
8
- secrets: createSecrets(["backupPassword"]),
9
- inputs: createInputs(["accessPoint", "resticRepo"]),
10
-
11
- meta: {
12
- title: "Grocy",
13
- description:
14
- "Grocy is a web-based self-hosted groceries & household management solution for your home.",
15
- icon: "simple-icons:grocy",
16
- category: "Productivity",
17
- },
18
-
19
- source: createSource("grocy"),
20
- })
@@ -1,20 +0,0 @@
1
- import { defineUnit } from "@highstate/contract"
2
- import { createArgs, createInputs, createSource } from "./shared"
3
-
4
- export const hubble = defineUnit({
5
- type: "apps.hubble",
6
-
7
- args: createArgs("hubble", ["fqdn"]),
8
- inputs: createInputs(["accessPoint"]),
9
-
10
- meta: {
11
- title: "Hubble",
12
- description:
13
- "Exposes Hubble UI to the user. It must be already installed in the cluster as part of the Cilium.",
14
- icon: "mdi:eye",
15
- secondaryIcon: "simple-icons:cilium",
16
- category: "Observability",
17
- },
18
-
19
- source: createSource("hubble"),
20
- })
@@ -1,19 +0,0 @@
1
- import { defineUnit } from "@highstate/contract"
2
- import { createArgs, createInputs, createSource } from "./shared"
3
-
4
- export const kubernetesDashboard = defineUnit({
5
- type: "apps.kubernetes-dashboard",
6
-
7
- args: createArgs("kubernetes-dashboard", ["fqdn"]),
8
- inputs: createInputs(["accessPoint"]),
9
-
10
- meta: {
11
- title: "Kubernetes Dashboard",
12
- description: "The Kubernetes Dashboard deployed on Kubernetes.",
13
- icon: "devicon:kubernetes",
14
- secondaryIcon: "material-symbols:dashboard",
15
- category: "Kubernetes",
16
- },
17
-
18
- source: createSource("kubernetes-dashboard"),
19
- })
@@ -1,81 +0,0 @@
1
- import { defineEntity, defineUnit, z } from "@highstate/contract"
2
- import { serviceEntity } from "../k8s"
3
- import { l4EndpointEntity } from "../network"
4
- import {
5
- createArgs,
6
- createInputs,
7
- createSecrets,
8
- createSource,
9
- databaseSchema,
10
- extraInputDefinitions,
11
- } from "./shared"
12
-
13
- export const mariadbEntity = defineEntity({
14
- type: "apps.mariadb",
15
-
16
- schema: databaseSchema,
17
-
18
- meta: {
19
- color: "#f06292",
20
- },
21
- })
22
-
23
- export const mariadb = defineUnit({
24
- type: "apps.mariadb",
25
-
26
- args: createArgs("mariadb", ["external"]),
27
- secrets: createSecrets(["rootPassword", "backupPassword"]),
28
- inputs: createInputs(["resticRepo"]),
29
-
30
- outputs: {
31
- mariadb: mariadbEntity,
32
- service: serviceEntity,
33
- endpoints: {
34
- entity: l4EndpointEntity,
35
- multiple: true,
36
- },
37
- },
38
-
39
- meta: {
40
- title: "MariaDB",
41
- description: "The MariaDB database deployed on Kubernetes.",
42
- icon: "simple-icons:mariadb",
43
- secondaryIcon: "mdi:database",
44
- category: "Databases",
45
- },
46
-
47
- source: createSource("mariadb/app"),
48
- })
49
-
50
- extraInputDefinitions.mariadb = {
51
- entity: mariadbEntity,
52
- title: "MariaDB",
53
- }
54
-
55
- export const mariadbDatabase = defineUnit({
56
- type: "apps.mariadb.database",
57
-
58
- args: {
59
- database: z.string().optional(),
60
- username: z.string().optional(),
61
- },
62
-
63
- inputs: createInputs(["mariadb"]),
64
-
65
- secrets: {
66
- password: z.string().optional(),
67
- },
68
-
69
- meta: {
70
- title: "MariaDB Database",
71
- description:
72
- "The virtual MariaDB database created on the MariaDB instance. Works only for MariaDB instances deployed on Kubernetes.",
73
- icon: "simple-icons:mariadb",
74
- secondaryIcon: "mdi:database-plus",
75
- category: "Databases",
76
- },
77
-
78
- source: createSource("mariadb/database"),
79
- })
80
-
81
- export type MariaDB = z.infer<typeof mariadbEntity.schema>
package/src/apps/maybe.ts DELETED
@@ -1,25 +0,0 @@
1
- import { defineUnit, z } from "@highstate/contract"
2
- import { createArgs, createInputs, createSecrets, createSource } from "./shared"
3
-
4
- export const maybe = defineUnit({
5
- type: "apps.maybe",
6
-
7
- args: createArgs("maybe", ["fqdn"]),
8
-
9
- secrets: {
10
- ...createSecrets(["backupPassword"]),
11
- postgresqlPassword: z.string().optional(),
12
- secretKey: z.string().optional(),
13
- },
14
-
15
- inputs: createInputs(["accessPoint", "resticRepo", "postgresql"]),
16
-
17
- meta: {
18
- title: "Maybe",
19
- description: "The OS for your personal finances.",
20
- icon: "arcticons:finance-manager",
21
- category: "Finance",
22
- },
23
-
24
- source: createSource("maybe"),
25
- })
@@ -1,81 +0,0 @@
1
- import { defineEntity, defineUnit, z } from "@highstate/contract"
2
- import { serviceEntity } from "../k8s"
3
- import { l4EndpointEntity } from "../network"
4
- import {
5
- createArgs,
6
- createInputs,
7
- createSecrets,
8
- createSource,
9
- databaseSchema,
10
- extraInputDefinitions,
11
- } from "./shared"
12
-
13
- export const mongodbEntity = defineEntity({
14
- type: "apps.mongodb",
15
-
16
- schema: databaseSchema,
17
-
18
- meta: {
19
- color: "#13aa52",
20
- },
21
- })
22
-
23
- export const mongodb = defineUnit({
24
- type: "apps.mongodb",
25
-
26
- args: createArgs("mongodb", ["external"]),
27
- secrets: createSecrets(["rootPassword", "backupPassword"]),
28
- inputs: createInputs(["resticRepo"]),
29
-
30
- outputs: {
31
- mongodb: mongodbEntity,
32
- service: serviceEntity,
33
- endpoints: {
34
- entity: l4EndpointEntity,
35
- multiple: true,
36
- },
37
- },
38
-
39
- meta: {
40
- title: "MongoDB",
41
- description: "The MongoDB instance deployed on Kubernetes.",
42
- icon: "simple-icons:mongodb",
43
- secondaryIcon: "mdi:database",
44
- category: "Databases",
45
- },
46
-
47
- source: createSource("mongodb/app"),
48
- })
49
-
50
- extraInputDefinitions.mongodb = {
51
- entity: mongodbEntity,
52
- title: "MongoDB",
53
- }
54
-
55
- export const mongodbDatabase = defineUnit({
56
- type: "apps.mongodb.database",
57
-
58
- args: {
59
- database: z.string().optional(),
60
- username: z.string().optional(),
61
- },
62
-
63
- secrets: {
64
- password: z.string().optional(),
65
- },
66
-
67
- inputs: createInputs(["mongodb"]),
68
-
69
- meta: {
70
- title: "MongoDB Database",
71
- description:
72
- "The virtual MongoDB database created on the MongoDB instance. Works only for MongoDB instances deployed on Kubernetes.",
73
- icon: "simple-icons:mongodb",
74
- secondaryIcon: "mdi:database-plus",
75
- category: "Databases",
76
- },
77
-
78
- source: createSource("mongodb/database"),
79
- })
80
-
81
- export type MongoDB = z.infer<typeof mongodbEntity.schema>
@@ -1,55 +0,0 @@
1
- import { defineUnit, z } from "@highstate/contract"
2
- import { l3EndpointEntity, l4EndpointEntity } from "../network"
3
- import { createSource } from "./shared"
4
-
5
- export const explicitEndpointFilterSchema = z.enum(["public", "external", "internal"])
6
-
7
- export const endpointFilter = defineUnit({
8
- type: "apps.endpoint-filter",
9
-
10
- args: {
11
- /**
12
- * The filter to apply to the endpoints.
13
- *
14
- * - `public`: Only public endpoints accessible from the internet.
15
- * - `external`: Only external endpoints (e.g. NodePort, LoadBalancer) accessible from outside the cluster, but not from the internet.
16
- * - `internal`: Only internal endpoints (e.g. ClusterIP) accessible from within the cluster.
17
- */
18
- filter: explicitEndpointFilterSchema.default("public"),
19
- },
20
-
21
- inputs: {
22
- l3Endpoints: {
23
- entity: l3EndpointEntity,
24
- multiple: true,
25
- required: false,
26
- },
27
- l4Endpoints: {
28
- entity: l4EndpointEntity,
29
- multiple: true,
30
- required: false,
31
- },
32
- },
33
-
34
- outputs: {
35
- l3Endpoints: {
36
- entity: l3EndpointEntity,
37
- multiple: true,
38
- },
39
- l4Endpoints: {
40
- entity: l4EndpointEntity,
41
- multiple: true,
42
- },
43
- },
44
-
45
- meta: {
46
- title: "Endpoint Filter",
47
- description: "Explicitly filter endpoints by their accessibility.",
48
- icon: "mdi:network-outline",
49
- iconColor: "#FF9800",
50
- secondaryIcon: "mdi:filter-outline",
51
- category: "Network",
52
- },
53
-
54
- source: createSource("endpoint-filter"),
55
- })
@@ -1,81 +0,0 @@
1
- import { defineEntity, defineUnit, z } from "@highstate/contract"
2
- import { serviceEntity } from "../k8s"
3
- import { l4EndpointEntity } from "../network"
4
- import {
5
- createArgs,
6
- createInputs,
7
- createSecrets,
8
- createSource,
9
- databaseSchema,
10
- extraInputDefinitions,
11
- } from "./shared"
12
-
13
- export const postgresqlEntity = defineEntity({
14
- type: "apps.postgresql",
15
-
16
- schema: databaseSchema,
17
-
18
- meta: {
19
- color: "#336791",
20
- },
21
- })
22
-
23
- export const postgresql = defineUnit({
24
- type: "apps.postgresql",
25
-
26
- args: createArgs("postgresql", ["external"]),
27
- secrets: createSecrets(["rootPassword", "backupPassword"]),
28
- inputs: createInputs(["resticRepo", "dnsProviders"]),
29
-
30
- outputs: {
31
- postgresql: postgresqlEntity,
32
- service: serviceEntity,
33
- endpoints: {
34
- entity: l4EndpointEntity,
35
- multiple: true,
36
- },
37
- },
38
-
39
- meta: {
40
- title: "PostgreSQL",
41
- description: "The PostgreSQL database deployed on Kubernetes.",
42
- icon: "simple-icons:postgresql",
43
- secondaryIcon: "mdi:database",
44
- category: "Databases",
45
- },
46
-
47
- source: createSource("postgresql/app"),
48
- })
49
-
50
- extraInputDefinitions.postgresql = {
51
- entity: postgresqlEntity,
52
- title: "PostgreSQL",
53
- }
54
-
55
- export const postgresqlDatabase = defineUnit({
56
- type: "apps.postgresql.database",
57
-
58
- args: {
59
- database: z.string().optional(),
60
- username: z.string().optional(),
61
- },
62
-
63
- secrets: {
64
- password: z.string().optional(),
65
- },
66
-
67
- inputs: createInputs(["postgresql"]),
68
-
69
- meta: {
70
- title: "PostgreSQL Database",
71
- description:
72
- "The virtual PostgreSQL database created on the PostgreSQL instance. Works only for PostgreSQL instances deployed on Kubernetes.",
73
- icon: "simple-icons:postgresql",
74
- secondaryIcon: "mdi:database-plus",
75
- category: "Databases",
76
- },
77
-
78
- source: createSource("postgresql/database"),
79
- })
80
-
81
- export type PostgreSQL = z.infer<typeof postgresqlEntity.schema>