-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
127 lines (115 loc) · 3.02 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import * as pulumi from "@pulumi/pulumi";
import * as command from "@pulumi/command";
import * as k8s from "@pulumi/kubernetes";
export const config = new pulumi.Config();
import { K8sCluster } from "./cluster";
import { Mailu } from "./mailu";
import { CertManager } from "./certManager";
import { LetsEncrypt } from "./letsencrypt";
import { Deployset } from "./deployset";
import { Secrets } from "./secrets";
import { DNSZone } from "./dns";
import { Dasboard } from "./dashboard";
import { Longhorn } from "./longhorn";
import { SSO } from "./authentik";
export const dns = new DNSZone("turingev-dns", {
rootDomain: config.require("root-domain"),
baseDomain: config.require("base-domain"),
netDomainPrefix: config.require("net-domain-prefix"),
pulicIP: config.require("public-ip"),
});
export const k8sCluster = new K8sCluster("turingev-cluster", {}, {});
export const provider = k8sCluster.provider;
const secrets = new Secrets("turingev-secrets", { provider }, {});
const certManager = new CertManager(
"turingev-certmanager",
{ namespaceName: "cert-manager", helmChartVersion: "1.12.3", provider },
{ provider, parent: k8sCluster },
);
const solvers = [
{
selector: {
dnsZones: [config.require("base-domain")],
},
dns01: {
digitalocean: {
tokenSecretRef: {
name: secrets.digitaloceanCredentials.metadata.name,
key: "access-token",
},
},
},
},
{
selector: {},
http01: {
ingress: {
class: "traefik",
},
},
},
];
const letsencrypt = new LetsEncrypt(
"letsencrypt-issuer",
{
email: config.require("admin-email"),
solvers,
provider,
},
{ dependsOn: certManager, parent: certManager },
);
const longhorn = new Longhorn(
"turingev-longhorn",
{
host: `longhorn.${config.require("base-domain")}`,
issuer: letsencrypt.issuer,
provider,
},
{ parent: k8sCluster },
);
const dashboard = new Dasboard(
"turingev-dashboard",
{
namespaceName: "kubernetes-dashboard",
issuer: letsencrypt.issuer,
host: `dashboard.${config.require("base-domain")}`,
provider,
},
{ parent: k8sCluster },
);
const website = new Deployset("turingev-website", {
port: 9000,
image: "ghcr.io/turingev/turingev-website:latest",
host: config.require("base-domain"),
namespace: "default",
provider: provider,
issuer: letsencrypt.issuer,
env: [
{
name: "EMAIL_FROM",
value: config.requireSecret("notify-email-from"),
},
{
name: "EMAIL_TO",
value: config.require("notify-email-to"),
},
{
name: "EMAIL_SERVER",
value: config.require("notify-email-server"),
},
{
name: "EMAIL_PASSWORD",
value: config.requireSecret("notify-email-password"),
},
],
});
const sso = new SSO("authentik", {
issuer: letsencrypt.issuer,
namespace: "default",
provider: provider,
host: `sso.${config.require("base-domain")}`,
secret: config.requireSecret("authentik-secret"),
db: {
password: config.requireSecret("authentik-db-password"),
},
});