@highstate/library 0.7.1 → 0.7.3
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 +5 -0
- package/dist/index.js +2111 -0
- package/dist/index.js.map +1 -0
- package/package.json +9 -11
- package/src/apps/code-server.ts +51 -0
- package/src/apps/deployment.ts +82 -0
- package/src/apps/gitea.ts +31 -0
- package/src/apps/grocy.ts +33 -0
- package/src/apps/index.ts +13 -0
- package/src/apps/kubernetes-dashboard.ts +28 -0
- package/src/apps/mariadb.ts +95 -0
- package/src/apps/maybe.ts +39 -0
- package/src/apps/mongodb.ts +96 -0
- package/src/apps/postgresql.ts +95 -0
- package/src/apps/syncthing.ts +50 -0
- package/src/apps/traefik.ts +32 -0
- package/src/apps/vaultwarden.ts +33 -0
- package/src/apps/zitadel.ts +31 -0
- package/src/cloudflare.ts +25 -0
- package/src/common.ts +70 -0
- package/src/dns.ts +45 -0
- package/src/index.ts +13 -0
- package/src/k3s.ts +28 -0
- package/src/k8s.ts +353 -0
- package/src/mullvad.ts +46 -0
- package/src/proxmox.ts +188 -0
- package/src/restic.ts +51 -0
- package/src/ssh.ts +60 -0
- package/src/talos.ts +116 -0
- package/src/wireguard.ts +588 -0
- package/src/xt-wgobfs.ts +49 -0
- package/dist/index.d.ts +0 -2937
- package/dist/index.mjs +0 -1725
@@ -0,0 +1,96 @@
|
|
1
|
+
import { defineEntity, defineUnit, Type, type Static } from "@highstate/contract"
|
2
|
+
import { clusterEntity, serviceEntity, serviceTypeSchema } from "../k8s"
|
3
|
+
import { repoEntity } from "../restic"
|
4
|
+
import { providerEntity } from "../dns"
|
5
|
+
|
6
|
+
export const mongodbEntity = defineEntity({
|
7
|
+
type: "apps.mongodb",
|
8
|
+
|
9
|
+
schema: Type.Object({
|
10
|
+
service: Type.Optional(serviceEntity.schema),
|
11
|
+
|
12
|
+
host: Type.String(),
|
13
|
+
port: Type.Number(),
|
14
|
+
rootPassword: Type.String(),
|
15
|
+
}),
|
16
|
+
|
17
|
+
meta: {
|
18
|
+
color: "#13aa52",
|
19
|
+
},
|
20
|
+
})
|
21
|
+
|
22
|
+
export const mongodb = defineUnit({
|
23
|
+
type: "apps.mongodb",
|
24
|
+
|
25
|
+
args: {
|
26
|
+
fqdn: Type.Optional(Type.String()),
|
27
|
+
appName: Type.Optional(Type.String()),
|
28
|
+
serviceType: Type.Optional(serviceTypeSchema),
|
29
|
+
},
|
30
|
+
|
31
|
+
secrets: {
|
32
|
+
rootPassword: Type.Optional(Type.String()),
|
33
|
+
},
|
34
|
+
|
35
|
+
inputs: {
|
36
|
+
k8sCluster: clusterEntity,
|
37
|
+
resticRepo: {
|
38
|
+
entity: repoEntity,
|
39
|
+
required: false,
|
40
|
+
},
|
41
|
+
dnsProvider: {
|
42
|
+
entity: providerEntity,
|
43
|
+
required: false,
|
44
|
+
},
|
45
|
+
},
|
46
|
+
|
47
|
+
outputs: {
|
48
|
+
mongodb: mongodbEntity,
|
49
|
+
service: serviceEntity,
|
50
|
+
},
|
51
|
+
|
52
|
+
meta: {
|
53
|
+
displayName: "MongoDB",
|
54
|
+
description: "The MongoDB instance deployed on Kubernetes.",
|
55
|
+
primaryIcon: "simple-icons:mongodb",
|
56
|
+
secondaryIcon: "mdi:database",
|
57
|
+
},
|
58
|
+
|
59
|
+
source: {
|
60
|
+
package: "@highstate/apps",
|
61
|
+
path: "mongodb/app",
|
62
|
+
},
|
63
|
+
})
|
64
|
+
|
65
|
+
export const mongodbDatabase = defineUnit({
|
66
|
+
type: "apps.mongodb.database",
|
67
|
+
|
68
|
+
args: {
|
69
|
+
database: Type.Optional(Type.String()),
|
70
|
+
username: Type.Optional(Type.String()),
|
71
|
+
},
|
72
|
+
|
73
|
+
secrets: {
|
74
|
+
password: Type.Optional(Type.String()),
|
75
|
+
},
|
76
|
+
|
77
|
+
inputs: {
|
78
|
+
k8sCluster: clusterEntity,
|
79
|
+
mongodb: mongodbEntity,
|
80
|
+
},
|
81
|
+
|
82
|
+
meta: {
|
83
|
+
displayName: "MongoDB Database",
|
84
|
+
description:
|
85
|
+
"The virtual MongoDB database created on the MongoDB instance. Works only for MongoDB instances deployed on Kubernetes.",
|
86
|
+
primaryIcon: "simple-icons:mongodb",
|
87
|
+
secondaryIcon: "mdi:database-plus",
|
88
|
+
},
|
89
|
+
|
90
|
+
source: {
|
91
|
+
package: "@highstate/apps",
|
92
|
+
path: "mongodb/database",
|
93
|
+
},
|
94
|
+
})
|
95
|
+
|
96
|
+
export type MongoDB = Static<typeof mongodbEntity.schema>
|
@@ -0,0 +1,95 @@
|
|
1
|
+
import { defineEntity, defineUnit, Type, type Static } from "@highstate/contract"
|
2
|
+
import { clusterEntity, serviceEntity } from "../k8s"
|
3
|
+
import { repoEntity } from "../restic"
|
4
|
+
import { providerEntity } from "../dns"
|
5
|
+
|
6
|
+
export const postgresqlEntity = defineEntity({
|
7
|
+
type: "apps.postgresql",
|
8
|
+
|
9
|
+
schema: Type.Object({
|
10
|
+
service: Type.Optional(serviceEntity.schema),
|
11
|
+
|
12
|
+
host: Type.String(),
|
13
|
+
port: Type.Number(),
|
14
|
+
rootPassword: Type.String(),
|
15
|
+
}),
|
16
|
+
|
17
|
+
meta: {
|
18
|
+
color: "#336791",
|
19
|
+
},
|
20
|
+
})
|
21
|
+
|
22
|
+
export const postgresql = defineUnit({
|
23
|
+
type: "apps.postgresql",
|
24
|
+
|
25
|
+
args: {
|
26
|
+
fqdn: Type.Optional(Type.String()),
|
27
|
+
appName: Type.Optional(Type.String()),
|
28
|
+
},
|
29
|
+
|
30
|
+
secrets: {
|
31
|
+
rootPassword: Type.Optional(Type.String()),
|
32
|
+
},
|
33
|
+
|
34
|
+
inputs: {
|
35
|
+
k8sCluster: clusterEntity,
|
36
|
+
resticRepo: {
|
37
|
+
entity: repoEntity,
|
38
|
+
required: false,
|
39
|
+
},
|
40
|
+
dnsProvider: {
|
41
|
+
entity: providerEntity,
|
42
|
+
required: false,
|
43
|
+
},
|
44
|
+
},
|
45
|
+
|
46
|
+
outputs: {
|
47
|
+
postgresql: postgresqlEntity,
|
48
|
+
service: serviceEntity,
|
49
|
+
},
|
50
|
+
|
51
|
+
meta: {
|
52
|
+
displayName: "PostgreSQL",
|
53
|
+
description: "The PostgreSQL database deployed on Kubernetes.",
|
54
|
+
primaryIcon: "simple-icons:postgresql",
|
55
|
+
secondaryIcon: "mdi:database",
|
56
|
+
},
|
57
|
+
|
58
|
+
source: {
|
59
|
+
package: "@highstate/apps",
|
60
|
+
path: "postgresql/app",
|
61
|
+
},
|
62
|
+
})
|
63
|
+
|
64
|
+
export const postgresqlDatabase = defineUnit({
|
65
|
+
type: "apps.postgresql.database",
|
66
|
+
|
67
|
+
args: {
|
68
|
+
database: Type.Optional(Type.String()),
|
69
|
+
username: Type.Optional(Type.String()),
|
70
|
+
},
|
71
|
+
|
72
|
+
secrets: {
|
73
|
+
password: Type.Optional(Type.String()),
|
74
|
+
},
|
75
|
+
|
76
|
+
inputs: {
|
77
|
+
k8sCluster: clusterEntity,
|
78
|
+
postgresql: postgresqlEntity,
|
79
|
+
},
|
80
|
+
|
81
|
+
meta: {
|
82
|
+
displayName: "PostgreSQL Database",
|
83
|
+
description:
|
84
|
+
"The virtual PostgreSQL database created on the PostgreSQL instance. Works only for PostgreSQL instances deployed on Kubernetes.",
|
85
|
+
primaryIcon: "simple-icons:postgresql",
|
86
|
+
secondaryIcon: "mdi:database-plus",
|
87
|
+
},
|
88
|
+
|
89
|
+
source: {
|
90
|
+
package: "@highstate/apps",
|
91
|
+
path: "postgresql/database",
|
92
|
+
},
|
93
|
+
})
|
94
|
+
|
95
|
+
export type PostgreSQL = Static<typeof postgresqlEntity.schema>
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import { defineUnit, Type } from "@highstate/contract"
|
2
|
+
import {
|
3
|
+
accessPointEntity,
|
4
|
+
clusterEntity,
|
5
|
+
persistentVolumeClaimEntity,
|
6
|
+
serviceEntity,
|
7
|
+
} from "../k8s"
|
8
|
+
import { repoEntity } from "../restic"
|
9
|
+
|
10
|
+
export const backupModeSchema = Type.Union([Type.Literal("metadata"), Type.Literal("full")])
|
11
|
+
|
12
|
+
export const syncthing = defineUnit({
|
13
|
+
type: "apps.syncthing",
|
14
|
+
|
15
|
+
args: {
|
16
|
+
fqdn: Type.String(),
|
17
|
+
deviceFqdn: Type.Optional(Type.String()),
|
18
|
+
appName: Type.Optional(Type.String()),
|
19
|
+
backupMode: Type.Optional({ ...backupModeSchema, default: "metadata" }),
|
20
|
+
},
|
21
|
+
|
22
|
+
inputs: {
|
23
|
+
accessPoint: accessPointEntity,
|
24
|
+
k8sCluster: clusterEntity,
|
25
|
+
resticRepo: {
|
26
|
+
entity: repoEntity,
|
27
|
+
required: false,
|
28
|
+
},
|
29
|
+
volume: {
|
30
|
+
entity: persistentVolumeClaimEntity,
|
31
|
+
required: false,
|
32
|
+
},
|
33
|
+
},
|
34
|
+
|
35
|
+
outputs: {
|
36
|
+
service: serviceEntity,
|
37
|
+
volume: persistentVolumeClaimEntity,
|
38
|
+
},
|
39
|
+
|
40
|
+
meta: {
|
41
|
+
displayName: "Syncthing",
|
42
|
+
description: "The Syncthing instance deployed on Kubernetes.",
|
43
|
+
primaryIcon: "simple-icons:syncthing",
|
44
|
+
},
|
45
|
+
|
46
|
+
source: {
|
47
|
+
package: "@highstate/apps",
|
48
|
+
path: "syncthing",
|
49
|
+
},
|
50
|
+
})
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { defineUnit, Type } from "@highstate/contract"
|
2
|
+
import { clusterEntity, gatewayEntity, serviceEntity, serviceTypeSchema } from "../k8s"
|
3
|
+
|
4
|
+
export const traefikGateway = defineUnit({
|
5
|
+
type: "apps.traefik-gateway",
|
6
|
+
|
7
|
+
args: {
|
8
|
+
appName: Type.Optional(Type.String()),
|
9
|
+
className: Type.Optional(Type.String()),
|
10
|
+
serviceType: Type.Optional(serviceTypeSchema),
|
11
|
+
},
|
12
|
+
|
13
|
+
inputs: {
|
14
|
+
k8sCluster: clusterEntity,
|
15
|
+
},
|
16
|
+
|
17
|
+
outputs: {
|
18
|
+
gateway: gatewayEntity,
|
19
|
+
service: serviceEntity,
|
20
|
+
},
|
21
|
+
|
22
|
+
meta: {
|
23
|
+
displayName: "Traefik Gateway",
|
24
|
+
description: "A Traefik gateway for routing traffic to services.",
|
25
|
+
primaryIcon: "simple-icons:traefikproxy",
|
26
|
+
},
|
27
|
+
|
28
|
+
source: {
|
29
|
+
package: "@highstate/apps",
|
30
|
+
path: "traefik",
|
31
|
+
},
|
32
|
+
})
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import { defineUnit, Type } from "@highstate/contract"
|
2
|
+
import { accessPointEntity, clusterEntity } from "../k8s"
|
3
|
+
import { mariadbEntity } from "./mariadb"
|
4
|
+
|
5
|
+
export const vaultwarden = defineUnit({
|
6
|
+
type: "apps.vaultwarden",
|
7
|
+
|
8
|
+
args: {
|
9
|
+
fqdn: Type.String(),
|
10
|
+
appName: Type.Optional(Type.String()),
|
11
|
+
},
|
12
|
+
|
13
|
+
inputs: {
|
14
|
+
mariadb: mariadbEntity,
|
15
|
+
accessPoint: accessPointEntity,
|
16
|
+
k8sCluster: clusterEntity,
|
17
|
+
},
|
18
|
+
|
19
|
+
secrets: {
|
20
|
+
mariadbPassword: Type.Optional(Type.String()),
|
21
|
+
},
|
22
|
+
|
23
|
+
meta: {
|
24
|
+
displayName: "Vaultwarden",
|
25
|
+
description: "The Vaultwarden password manager deployed on Kubernetes.",
|
26
|
+
primaryIcon: "simple-icons:vaultwarden",
|
27
|
+
},
|
28
|
+
|
29
|
+
source: {
|
30
|
+
package: "@highstate/apps",
|
31
|
+
path: "vaultwarden",
|
32
|
+
},
|
33
|
+
})
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { defineUnit, Type } from "@highstate/contract"
|
2
|
+
import { accessPointEntity, clusterEntity } from "../k8s"
|
3
|
+
import { postgresqlEntity } from "./postgresql"
|
4
|
+
|
5
|
+
export const zitadel = defineUnit({
|
6
|
+
type: "apps.zitadel",
|
7
|
+
|
8
|
+
args: {
|
9
|
+
domain: Type.String(),
|
10
|
+
},
|
11
|
+
|
12
|
+
inputs: {
|
13
|
+
postgresql: {
|
14
|
+
entity: postgresqlEntity,
|
15
|
+
displayName: "PostgreSQL",
|
16
|
+
},
|
17
|
+
accessPoint: accessPointEntity,
|
18
|
+
k8sCluster: clusterEntity,
|
19
|
+
},
|
20
|
+
|
21
|
+
meta: {
|
22
|
+
displayName: "Zitadel",
|
23
|
+
description: "The Zitadel IAM deployed on Kubernetes.",
|
24
|
+
primaryIcon: "hugeicons:access",
|
25
|
+
},
|
26
|
+
|
27
|
+
source: {
|
28
|
+
package: "@highstate/apps",
|
29
|
+
path: "zitadel",
|
30
|
+
},
|
31
|
+
})
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { defineUnit, Type } from "@highstate/contract"
|
2
|
+
import { providerEntity } from "./dns"
|
3
|
+
|
4
|
+
export const connection = defineUnit({
|
5
|
+
type: "cloudflare.connection",
|
6
|
+
|
7
|
+
secrets: {
|
8
|
+
apiToken: Type.String(),
|
9
|
+
},
|
10
|
+
|
11
|
+
outputs: {
|
12
|
+
dnsProvider: providerEntity,
|
13
|
+
},
|
14
|
+
|
15
|
+
meta: {
|
16
|
+
displayName: "Cloudflare Connection",
|
17
|
+
description: "Creates a new Cloudflare connection for one zone.",
|
18
|
+
primaryIcon: "simple-icons:cloudflare",
|
19
|
+
},
|
20
|
+
|
21
|
+
source: {
|
22
|
+
package: "@highstate/cloudflare",
|
23
|
+
path: "connection",
|
24
|
+
},
|
25
|
+
})
|
package/src/common.ts
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
import { defineEntity, defineUnit, Type, type Static } from "@highstate/contract"
|
2
|
+
import { credentialsSchema, keyPairEntity } from "./ssh"
|
3
|
+
|
4
|
+
export const serverEntity = defineEntity({
|
5
|
+
type: "common.server",
|
6
|
+
|
7
|
+
schema: Type.Object({
|
8
|
+
endpoint: Type.String(),
|
9
|
+
hostname: Type.String(),
|
10
|
+
sshCredentials: Type.Optional(credentialsSchema),
|
11
|
+
}),
|
12
|
+
|
13
|
+
meta: {
|
14
|
+
color: "#009688",
|
15
|
+
},
|
16
|
+
})
|
17
|
+
|
18
|
+
export const endpointEntity = defineEntity({
|
19
|
+
type: "common.endpoint",
|
20
|
+
|
21
|
+
schema: Type.Object({
|
22
|
+
endpoint: Type.String(),
|
23
|
+
}),
|
24
|
+
|
25
|
+
meta: {
|
26
|
+
color: "#FFC107",
|
27
|
+
description: "The L3-L4 endpoint for some network service.",
|
28
|
+
},
|
29
|
+
})
|
30
|
+
|
31
|
+
export const existingServer = defineUnit({
|
32
|
+
type: "common.existing-server",
|
33
|
+
|
34
|
+
args: {
|
35
|
+
endpoint: Type.String(),
|
36
|
+
sshUser: Type.Optional(Type.String({ default: "root" })),
|
37
|
+
sshPort: Type.Optional(Type.Number({ default: 22 })),
|
38
|
+
},
|
39
|
+
|
40
|
+
secrets: {
|
41
|
+
sshPassword: Type.Optional(Type.String()),
|
42
|
+
sshPrivateKey: Type.Optional(Type.String()),
|
43
|
+
},
|
44
|
+
|
45
|
+
inputs: {
|
46
|
+
sshKeyPair: {
|
47
|
+
entity: keyPairEntity,
|
48
|
+
required: false,
|
49
|
+
},
|
50
|
+
},
|
51
|
+
|
52
|
+
outputs: {
|
53
|
+
server: serverEntity,
|
54
|
+
},
|
55
|
+
|
56
|
+
meta: {
|
57
|
+
displayName: "Existing Server",
|
58
|
+
description: "An existing server that can be used in the configuration.",
|
59
|
+
primaryIcon: "mdi:server",
|
60
|
+
defaultNamePrefix: "server",
|
61
|
+
},
|
62
|
+
|
63
|
+
source: {
|
64
|
+
package: "@highstate/common",
|
65
|
+
path: "existing-server",
|
66
|
+
},
|
67
|
+
})
|
68
|
+
|
69
|
+
export type Server = Static<typeof serverEntity.schema>
|
70
|
+
export type Endpoint = Static<typeof endpointEntity.schema>
|
package/src/dns.ts
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
import { defineEntity, defineUnit, Type, type Static } from "@highstate/contract"
|
2
|
+
|
3
|
+
export const providerEntity = defineEntity({
|
4
|
+
type: "dns.provider",
|
5
|
+
|
6
|
+
schema: Type.Object({
|
7
|
+
name: Type.String(),
|
8
|
+
type: Type.String(),
|
9
|
+
data: Type.Record(Type.String(), Type.Unknown()),
|
10
|
+
domain: Type.String(),
|
11
|
+
}),
|
12
|
+
|
13
|
+
meta: {
|
14
|
+
color: "#FF5722",
|
15
|
+
},
|
16
|
+
})
|
17
|
+
|
18
|
+
export const record = defineUnit({
|
19
|
+
type: "common.dns-record",
|
20
|
+
|
21
|
+
args: {
|
22
|
+
name: Type.String(),
|
23
|
+
type: Type.String(),
|
24
|
+
value: Type.String(),
|
25
|
+
ttl: Type.Optional(Type.Number()),
|
26
|
+
},
|
27
|
+
|
28
|
+
inputs: {
|
29
|
+
dnsProvider: providerEntity,
|
30
|
+
},
|
31
|
+
|
32
|
+
meta: {
|
33
|
+
displayName: "DNS Record",
|
34
|
+
description: "A DNS record to create.",
|
35
|
+
primaryIcon: "mdi:server",
|
36
|
+
defaultNamePrefix: "record",
|
37
|
+
},
|
38
|
+
|
39
|
+
source: {
|
40
|
+
package: "@highstate/common",
|
41
|
+
path: "dns/record",
|
42
|
+
},
|
43
|
+
})
|
44
|
+
|
45
|
+
export type Provider = Static<typeof providerEntity.schema>
|
package/src/index.ts
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
export * as common from "./common"
|
2
|
+
export * as proxmox from "./proxmox"
|
3
|
+
export * as ssh from "./ssh"
|
4
|
+
export * as k8s from "./k8s"
|
5
|
+
export * as talos from "./talos"
|
6
|
+
export * as wireguard from "./wireguard"
|
7
|
+
export * as apps from "./apps"
|
8
|
+
export * as cloudflare from "./cloudflare"
|
9
|
+
export * as k3s from "./k3s"
|
10
|
+
// export * as xtWgobfs from "./xt-wgobfs"
|
11
|
+
export * as restic from "./restic"
|
12
|
+
export * as mullvad from "./mullvad"
|
13
|
+
export * as dns from "./dns"
|
package/src/k3s.ts
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
import { defineUnit } from "@highstate/contract"
|
2
|
+
import { serverEntity } from "./common"
|
3
|
+
import { clusterEntity } from "./k8s"
|
4
|
+
|
5
|
+
export const cluster = defineUnit({
|
6
|
+
type: "k3s.cluster",
|
7
|
+
|
8
|
+
inputs: {
|
9
|
+
server: serverEntity,
|
10
|
+
},
|
11
|
+
|
12
|
+
outputs: {
|
13
|
+
k8sCluster: clusterEntity,
|
14
|
+
},
|
15
|
+
|
16
|
+
meta: {
|
17
|
+
displayName: "K3s Cluster",
|
18
|
+
description: "The K3s cluster created on top of the server.",
|
19
|
+
category: "k3s",
|
20
|
+
primaryIcon: "devicon:k3s",
|
21
|
+
secondaryIcon: "devicon:kubernetes",
|
22
|
+
},
|
23
|
+
|
24
|
+
source: {
|
25
|
+
package: "@highstate/k3s",
|
26
|
+
path: "cluster",
|
27
|
+
},
|
28
|
+
})
|