Skip to content

Commit

Permalink
Fix port and add health endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
unkhz committed Jul 19, 2024
1 parent aa864e2 commit 7b42ada
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
8 changes: 4 additions & 4 deletions packages/archive/.khz-k3s/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
- name: ruuvipuserrin-archive
image: ghcr.io/unkhz/ruuvipuserrin-archive:latest
ports:
- containerPort: 80
- containerPort: 8080
environment:
- name: PG_HOST
value: 'nope'
Expand All @@ -45,11 +45,11 @@ spec:
readinessProbe:
httpGet:
path: /health
port: 80
port: 8080
livenessProbe:
httpGet:
path: /health
port: 80
port: 8080
initialDelaySeconds: 30
periodSeconds: 300
timeoutSeconds: 15
Expand All @@ -69,7 +69,7 @@ spec:
ports:
- protocol: TCP
port: 80
targetPort: 80
targetPort: 8080
type: ClusterIP
---
apiVersion: networking.k8s.io/v1
Expand Down
2 changes: 1 addition & 1 deletion packages/archive/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ FROM ghcr.io/unkhz/ruuvipuserrin-base-node

WORKDIR /app

EXPOSE 4000
EXPOSE 8080

CMD node packages/archive
9 changes: 9 additions & 0 deletions packages/archive/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ app.use(
createContext,
}),
)
app.use('/health', (req, res) => {
res.set({
'Cache-Control': 'no-cache',
'Content-Type': 'text/plain',
'X-Health-Check': 'OK',
})
res.send('OK')
res.end()
})

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

0 comments on commit 7b42ada

Please sign in to comment.