Skip to content

Commit 41d92bb

Browse files
Add API preview endpoint
1 parent 084b8d7 commit 41d92bb

File tree

4 files changed

+131
-2
lines changed

4 files changed

+131
-2
lines changed

helm/templates/api-ingress.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: Ingress
3+
metadata:
4+
name: {{ $.Release.Name }}-api
5+
annotations:
6+
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
7+
nginx.ingress.kubernetes.io/proxy-body-size: 100m
8+
nginx.ingress.kubernetes.io/use-regex: "true"
9+
nginx.ingress.kubernetes.io/rewrite-target: /$2
10+
spec:
11+
ingressClassName: {{ $.Values.api.ingressClassName }}
12+
rules:
13+
- host: {{ $.Values.api.host }}
14+
http:
15+
paths:
16+
- path: /api(/|$)(.*)
17+
pathType: ImplementationSpecific
18+
backend:
19+
service:
20+
name: {{ $.Release.Name }}-api
21+
port:
22+
name: http
23+
tls:
24+
- secretName: cert-webis-de
25+
hosts:
26+
- {{ $.Values.api.host }}

helm/templates/api-service.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ $.Release.Name }}-api
5+
labels:
6+
app: {{ $.Release.Name }}-api
7+
spec:
8+
selector:
9+
app: {{ $.Release.Name }}-api
10+
ports:
11+
- name: http
12+
port: 4000
13+
targetPort: http
14+
protocol: TCP

helm/templates/api.yaml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ $.Release.Name }}-api
5+
labels:
6+
app: {{ $.Release.Name }}-api
7+
annotations:
8+
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
9+
spec:
10+
replicas: {{ .Values.api.replicas }}
11+
revisionHistoryLimit: 2
12+
selector:
13+
matchLabels:
14+
app: {{ $.Release.Name }}-api
15+
template:
16+
metadata:
17+
labels:
18+
app: {{ $.Release.Name }}-api
19+
spec:
20+
restartPolicy: Always
21+
containers:
22+
- name: {{ $.Release.Name }}-api
23+
image: "{{ .Values.image }}:{{ .Chart.AppVersion }}"
24+
resources:
25+
requests:
26+
memory: "256Mi"
27+
cpu: "100m"
28+
limits:
29+
memory: "512Mi"
30+
cpu: "500m"
31+
command:
32+
- /venv/bin/uvicorn
33+
- archive_query_log.api:app
34+
- --host
35+
- 0.0.0.0
36+
- --port
37+
- "5000"
38+
- --root-path
39+
- /api/
40+
ports:
41+
- name: http
42+
containerPort: 5000
43+
env:
44+
- name: ELASTICSEARCH_HOST
45+
value: {{ $.Values.elasticsearch.host | quote }}
46+
- name: ELASTICSEARCH_PORT
47+
value: {{ $.Values.elasticsearch.port | quote }}
48+
- name: ELASTICSEARCH_API_KEY
49+
valueFrom:
50+
secretKeyRef:
51+
name: {{ $.Release.Name }}-secret
52+
key: elasticsearchApiKey
53+
- name: S3_ENDPOINT_URL
54+
value: {{ $.Values.s3.endpointUrl | quote }}
55+
- name: S3_BUCKET_NAME
56+
value: {{ $.Values.s3.bucketName | quote }}
57+
- name: S3_ACCESS_KEY
58+
valueFrom:
59+
secretKeyRef:
60+
name: {{ $.Release.Name }}-secret
61+
key: s3AccessKey
62+
- name: S3_SECRET_KEY
63+
valueFrom:
64+
secretKeyRef:
65+
name: {{ $.Release.Name }}-secret
66+
key: s3SecretKey
67+
- name: WARC_CACHE_PATH_SERPS
68+
value: {{ $.Values.warcCache.pathSerps | quote }}
69+
- name: ENVIRONMENT
70+
value: "production"
71+
livenessProbe:
72+
httpGet:
73+
path: /health
74+
port: http
75+
initialDelaySeconds: 10
76+
periodSeconds: 30
77+
timeoutSeconds: 5
78+
failureThreshold: 3
79+
readinessProbe:
80+
httpGet:
81+
path: /health
82+
port: http
83+
initialDelaySeconds: 5
84+
periodSeconds: 10
85+
timeoutSeconds: 3
86+
failureThreshold: 3

helm/values.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,15 @@ browser:
8787
host: aql.webis.de
8888
secondaryHost: aql.web.webis.de
8989
replicas: 1
90-
forceSslRedirect: true
9190
image: ghcr.io/webis-de/archive-query-log/browser
9291
backend:
9392
ingressClassName: nginx-external
9493
host: aql.webis.de
9594
secondaryHost: aql.web.webis.de
9695
replicas: 1
97-
forceSslRedirect: true
9896
image: ghcr.io/webis-de/archive-query-log
97+
98+
api:
99+
ingressClassName: nginx-external
100+
host: aql-api-preview.web.webis.de
101+
replicas: 1

0 commit comments

Comments
 (0)