Skip to content

Commit

Permalink
feat(ci): add healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
George-Spanos committed Aug 6, 2024
1 parent 56ed3d9 commit 90b6698
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Log in to registry
uses: docker/login-action@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ RUN pnpm build

FROM build AS run

LABEL org.opencontainers.image.source https://github.com/moby-it/gaming-grids-creator
LABEL org.opencontainers.image.source=https://github.com/moby-it/gaming-grids-creator
EXPOSE 3000
CMD ["node", ".output/server/index.mjs"]
6 changes: 3 additions & 3 deletions k8s/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: gaming-grids
---
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
name: gaming-grids-admin
namespace: gaming-grids
Expand All @@ -24,10 +24,10 @@ spec:
containers:
- image: ghcr.io/moby-it/gaming-grids-creator
imagePullPolicy: Always
name: gaming-grids-app
name: gaming-grids-creator-app
livenessProbe:
httpGet:
path: /
path: /api/health
port: 3000
initialDelaySeconds: 15
periodSeconds: 20
Expand Down
4 changes: 2 additions & 2 deletions k8s/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ spec:
ingressClassName: nginx
tls:
- hosts:
- admin-league.mobyplaygrounds.com
- league-admin.mobyplaygrounds.com
secretName: admin-league-mobyplaygrounds-tls
rules:
- host: admin-league.mobyplaygrounds.com
- host: league-admin.mobyplaygrounds.com
http:
paths:
- path: /
Expand Down
3 changes: 3 additions & 0 deletions server/api/health.get.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default defineEventHandler((event) => {
return "Server healthy";
});
2 changes: 1 addition & 1 deletion server/middleware/00-auth.global.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { verifyToken } from "../utils/utils";
const publicAPIEndpoints = ["/api/refresh", "/api/login"];
const publicAPIEndpoints = ["/api/refresh", "/api/login", "/api/health"];
export default defineEventHandler(async (event) => {
// protect api endpoints with auth
const accessToken = getCookie(event, "access-token");
Expand Down

0 comments on commit 90b6698

Please sign in to comment.