Skip to content

Commit 7b42ada

Browse files
committed
Fix port and add health endpoint
1 parent aa864e2 commit 7b42ada

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

packages/archive/.khz-k3s/deployment.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ spec:
2121
- name: ruuvipuserrin-archive
2222
image: ghcr.io/unkhz/ruuvipuserrin-archive:latest
2323
ports:
24-
- containerPort: 80
24+
- containerPort: 8080
2525
environment:
2626
- name: PG_HOST
2727
value: 'nope'
@@ -45,11 +45,11 @@ spec:
4545
readinessProbe:
4646
httpGet:
4747
path: /health
48-
port: 80
48+
port: 8080
4949
livenessProbe:
5050
httpGet:
5151
path: /health
52-
port: 80
52+
port: 8080
5353
initialDelaySeconds: 30
5454
periodSeconds: 300
5555
timeoutSeconds: 15
@@ -69,7 +69,7 @@ spec:
6969
ports:
7070
- protocol: TCP
7171
port: 80
72-
targetPort: 80
72+
targetPort: 8080
7373
type: ClusterIP
7474
---
7575
apiVersion: networking.k8s.io/v1

packages/archive/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ FROM ghcr.io/unkhz/ruuvipuserrin-base-node
22

33
WORKDIR /app
44

5-
EXPOSE 4000
5+
EXPOSE 8080
66

77
CMD node packages/archive

packages/archive/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ app.use(
1616
createContext,
1717
}),
1818
)
19+
app.use('/health', (req, res) => {
20+
res.set({
21+
'Cache-Control': 'no-cache',
22+
'Content-Type': 'text/plain',
23+
'X-Health-Check': 'OK',
24+
})
25+
res.send('OK')
26+
res.end()
27+
})
1928

2029
const port = env.PORT ?? env.ARCHIVE_API_PORT ?? 8080
2130
app.listen(port, () => {

0 commit comments

Comments
 (0)