|
Last change
on this file since a8fe58e was c0086c0, checked in by Andrej <asumanovski@…>, 2 weeks ago |
|
Add GitHub Actions CI/CD pipeline with DockerHub and Kubernetes deployment
- Build job validates both images on every push and PR
- Push job builds and pushes backend/frontend images to DockerHub on master
- Deploy job applies k8s manifests and rolls out new images to k3s cluster
- Added k8s manifests: namespace, postgres StatefulSet, backend and frontend Deployments
- Added /api/auth/ping health endpoint for k8s readiness/liveness probes
|
-
Property mode
set to
100644
|
|
File size:
1.5 KB
|
| Line | |
|---|
| 1 | apiVersion: v1
|
|---|
| 2 | kind: PersistentVolumeClaim
|
|---|
| 3 | metadata:
|
|---|
| 4 | name: postgres-pvc
|
|---|
| 5 | namespace: trekr
|
|---|
| 6 | spec:
|
|---|
| 7 | accessModes: [ReadWriteOnce]
|
|---|
| 8 | resources:
|
|---|
| 9 | requests:
|
|---|
| 10 | storage: 5Gi
|
|---|
| 11 | ---
|
|---|
| 12 | apiVersion: apps/v1
|
|---|
| 13 | kind: StatefulSet
|
|---|
| 14 | metadata:
|
|---|
| 15 | name: postgres
|
|---|
| 16 | namespace: trekr
|
|---|
| 17 | spec:
|
|---|
| 18 | serviceName: postgres
|
|---|
| 19 | replicas: 1
|
|---|
| 20 | selector:
|
|---|
| 21 | matchLabels:
|
|---|
| 22 | app: postgres
|
|---|
| 23 | template:
|
|---|
| 24 | metadata:
|
|---|
| 25 | labels:
|
|---|
| 26 | app: postgres
|
|---|
| 27 | spec:
|
|---|
| 28 | containers:
|
|---|
| 29 | - name: postgres
|
|---|
| 30 | image: postgres:16-alpine
|
|---|
| 31 | env:
|
|---|
| 32 | - name: POSTGRES_DB
|
|---|
| 33 | value: trekr
|
|---|
| 34 | - name: POSTGRES_USER
|
|---|
| 35 | value: trekr
|
|---|
| 36 | - name: POSTGRES_PASSWORD
|
|---|
| 37 | valueFrom:
|
|---|
| 38 | secretKeyRef:
|
|---|
| 39 | name: trekr-secrets
|
|---|
| 40 | key: db-password
|
|---|
| 41 | ports:
|
|---|
| 42 | - containerPort: 5432
|
|---|
| 43 | volumeMounts:
|
|---|
| 44 | - name: data
|
|---|
| 45 | mountPath: /var/lib/postgresql/data
|
|---|
| 46 | - name: init-sql
|
|---|
| 47 | mountPath: /docker-entrypoint-initdb.d
|
|---|
| 48 | readinessProbe:
|
|---|
| 49 | exec:
|
|---|
| 50 | command: [pg_isready, -U, trekr, -d, trekr]
|
|---|
| 51 | initialDelaySeconds: 5
|
|---|
| 52 | periodSeconds: 5
|
|---|
| 53 | volumes:
|
|---|
| 54 | - name: data
|
|---|
| 55 | persistentVolumeClaim:
|
|---|
| 56 | claimName: postgres-pvc
|
|---|
| 57 | - name: init-sql
|
|---|
| 58 | configMap:
|
|---|
| 59 | name: trekr-db-init
|
|---|
| 60 | ---
|
|---|
| 61 | apiVersion: v1
|
|---|
| 62 | kind: Service
|
|---|
| 63 | metadata:
|
|---|
| 64 | name: postgres
|
|---|
| 65 | namespace: trekr
|
|---|
| 66 | spec:
|
|---|
| 67 | selector:
|
|---|
| 68 | app: postgres
|
|---|
| 69 | ports:
|
|---|
| 70 | - port: 5432
|
|---|
| 71 | targetPort: 5432
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.