Skip to content

Commit b130df9

Browse files
committed
update infra
1 parent 444db70 commit b130df9

8 files changed

+367
-6
lines changed

dapr.tf

+4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ resource "helm_release" "redis" {
2323
}
2424
}
2525

26+
# -- comment out the two resources below when initially creating the cluster, somehow this fails to plan on the first run
27+
2628
resource "kubernetes_manifest" "dapr_state_config" {
29+
depends_on = [kubernetes_namespace.gits]
2730
manifest = {
2831
"apiVersion" = "dapr.io/v1alpha1"
2932
"kind" = "Component"
@@ -52,6 +55,7 @@ resource "kubernetes_manifest" "dapr_state_config" {
5255

5356

5457
resource "kubernetes_manifest" "dapr_pubsub_config" {
58+
depends_on = [kubernetes_namespace.gits]
5559
manifest = {
5660
"apiVersion" = "dapr.io/v1alpha1"
5761
"kind" = "Component"

gateway.tf

+9-1
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,21 @@ resource "kubernetes_deployment" "gits_graphql_gateway" {
8080
name = "CONTENT_SERVICE_URL"
8181
value = "http://localhost:3500/v1.0/invoke/content-service/method/graphql"
8282
}
83+
env {
84+
name = "USER_SERVICE_URL"
85+
value = "http://localhost:3500/v1.0/invoke/user-service/method/graphql"
86+
}
8387
env {
8488
name = "FLASHCARD_SERVICE_URL"
8589
value = "http://localhost:3500/v1.0/invoke/flashcard-service/method/graphql"
8690
}
8791
env {
8892
name = "REWARD_SERVICE_URL"
89-
value = "http://localhost:5000/v1.0/invoke/reward-service/graphql"
93+
value = "http://localhost:3500/v1.0/invoke/reward-service/method/graphql"
94+
}
95+
env {
96+
name = "QUIZ_SERVICE_URL"
97+
value = "http://localhost:3500/v1.0/invoke/quiz-service/method/graphql"
9098
}
9199
env {
92100
name = "JWKS_URL"

ingress.tf

+40
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,50 @@ resource "kubernetes_ingress_v1" "gits" {
7575
}
7676
}
7777

78+
rule {
79+
host = "minio.it-rex.ch"
80+
81+
http {
82+
83+
84+
path {
85+
backend {
86+
service {
87+
name = "minio"
88+
port {
89+
number = 9000
90+
}
91+
}
92+
}
93+
94+
path = "/"
95+
}
96+
}
97+
}
98+
rule {
99+
host = "minio-dashboard.it-rex.ch"
100+
101+
http {
102+
path {
103+
backend {
104+
service {
105+
name = "minio"
106+
port {
107+
number = 9001
108+
}
109+
}
110+
}
111+
112+
path = "/"
113+
}
114+
}
115+
}
116+
78117
tls {
79118
secret_name = "orange-tls-cert"
80119
hosts = ["orange.informatik.uni-stuttgart.de"]
81120
}
82121

83122
}
84123
}
124+

media_service.tf

+1-5
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ resource "kubernetes_deployment" "gits_media_service" {
7676

7777
env {
7878
name = "MINIO_URL"
79-
value = "minio"
79+
value = "http://minio:9000"
8080
}
8181
env {
8282
name = "MINIO_ACCESS_KEY"
@@ -171,8 +171,4 @@ resource "helm_release" "minio" {
171171
name = "extraEnvVars[0].name"
172172
value = "MINIO_BROWSER_REDIRECT_URL"
173173
}
174-
set {
175-
name = "extraEnvVars[0].value"
176-
value = "https://orange.informatik.uni-stuttgart.de/minio"
177-
}
178174
}

quiz_service.tf

+147
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
resource "kubernetes_deployment" "gits_quiz_service" {
2+
depends_on = [helm_release.quiz_service_db, helm_release.dapr, helm_release.keel, kubernetes_secret.image_pull]
3+
metadata {
4+
name = "gits-quiz-service"
5+
labels = {
6+
app = "gits-quiz-service"
7+
}
8+
namespace = kubernetes_namespace.gits.metadata[0].name
9+
annotations = {
10+
"keel.sh/policy" = "force"
11+
"keel.sh/match-tag" = "true"
12+
"keel.sh/trigger" = "poll"
13+
}
14+
}
15+
16+
spec {
17+
replicas = 1
18+
19+
selector {
20+
match_labels = {
21+
app = "gits-quiz-service"
22+
}
23+
}
24+
25+
template {
26+
metadata {
27+
labels = {
28+
app = "gits-quiz-service"
29+
}
30+
annotations = {
31+
"dapr.io/enabled" = true
32+
"dapr.io/app-id" = "quiz-service"
33+
"dapr.io/app-port" = 9001
34+
"dapr.io/http-port" = 9000
35+
}
36+
}
37+
38+
spec {
39+
40+
image_pull_secrets {
41+
name = kubernetes_secret.image_pull.metadata[0].name
42+
}
43+
44+
45+
container {
46+
image = "ghcr.io/it-rex-platform/quiz_service:latest"
47+
image_pull_policy = "Always"
48+
49+
name = "gits-quiz-service"
50+
51+
resources {
52+
limits = {
53+
cpu = "0.5"
54+
memory = "512Mi"
55+
}
56+
requests = {
57+
cpu = "50m"
58+
memory = "50Mi"
59+
}
60+
}
61+
62+
env {
63+
name = "SPRING_DATASOURCE_URL"
64+
value = "jdbc:postgresql://quiz-service-db-postgresql:5432/quiz-service"
65+
}
66+
67+
env {
68+
name = "SPRING_DATASOURCE_USERNAME"
69+
value = "gits"
70+
}
71+
72+
env {
73+
name = "SPRING_DATASOURCE_PASSWORD"
74+
value = random_password.quiz_service_db_pass.result
75+
}
76+
77+
env {
78+
name = "COURSE_SERVICE_URL"
79+
value = "http://localhost:3500/v1.0/invoke/course-service/method/graphql"
80+
}
81+
82+
env {
83+
name = "CONTENT_SERVICE_URL"
84+
value = "http://localhost:3500/v1.0/invoke/content-service/method/graphql"
85+
}
86+
87+
88+
# liveness_probe {
89+
# http_get {
90+
# path = "/graphql"
91+
# port = 7001
92+
93+
# }
94+
95+
# initial_delay_seconds = 30
96+
# period_seconds = 9
97+
# }
98+
99+
# readiness_probe {
100+
# http_get {
101+
# path = "/graphql"
102+
# port = 7001
103+
104+
# }
105+
106+
# initial_delay_seconds = 30
107+
# period_seconds = 9
108+
# }
109+
}
110+
}
111+
}
112+
}
113+
}
114+
115+
resource "random_password" "quiz_service_db_pass" {
116+
length = 32
117+
special = false
118+
}
119+
120+
resource "helm_release" "quiz_service_db" {
121+
name = "quiz-service-db"
122+
repository = "oci://registry-1.docker.io/bitnamicharts"
123+
chart = "postgresql"
124+
namespace = kubernetes_namespace.gits.metadata[0].name
125+
126+
set {
127+
name = "global.postgresql.auth.database"
128+
value = "quiz-service"
129+
}
130+
131+
set {
132+
name = "postgres.auth.enablePostgresUser"
133+
value = "false"
134+
}
135+
136+
set {
137+
name = "global.postgresql.auth.username"
138+
value = "gits"
139+
}
140+
141+
set {
142+
name = "global.postgresql.auth.password"
143+
value = random_password.quiz_service_db_pass.result
144+
}
145+
}
146+
147+

reward_service.tf

+11
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ resource "kubernetes_deployment" "gits_reward_service" {
7474
value = random_password.reward_service_db_pass.result
7575
}
7676

77+
env {
78+
name = "COURSE_SERVICE_URL"
79+
value = "http://localhost:3500/v1.0/invoke/course-service/method/graphql"
80+
}
81+
82+
env {
83+
name = "CONTENT_SERVICE_URL"
84+
value = "http://localhost:3500/v1.0/invoke/content-service/method/graphql"
85+
}
86+
87+
7788
# liveness_probe {
7889
# http_get {
7990
# path = "/graphql"

0 commit comments

Comments
 (0)