feat(ops): add Makefile, Dockerfile, and K8s manifests
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: tutortool-backup
|
||||
spec:
|
||||
schedule: "0 3 * * *"
|
||||
jobTemplate:
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: backup
|
||||
image: alpine:latest
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
apk add --no-cache sqlite
|
||||
sqlite3 /data/attendance.db "VACUUM INTO '/data/backup-$(date +%F).sqlite'"
|
||||
find /data -name "backup-*.sqlite" -mtime +7 -delete
|
||||
volumeMounts:
|
||||
- name: db-storage
|
||||
mountPath: /data
|
||||
restartPolicy: OnFailure
|
||||
volumes:
|
||||
- name: db-storage
|
||||
persistentVolumeClaim:
|
||||
claimName: tutortool-pvc
|
||||
@@ -0,0 +1,59 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: tutortool
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: tutortool
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: tutortool
|
||||
spec:
|
||||
containers:
|
||||
- name: app
|
||||
image: tutor-registry:latest
|
||||
ports:
|
||||
- containerPort: 3000
|
||||
env:
|
||||
- name: DATABASE_URL
|
||||
value: "sqlite:/data/attendance.db"
|
||||
- name: STATIC_DIR
|
||||
value: "/app/frontend/build"
|
||||
volumeMounts:
|
||||
- name: db-storage
|
||||
mountPath: /data
|
||||
volumes:
|
||||
- name: db-storage
|
||||
persistentVolumeClaim:
|
||||
claimName: tutortool-pvc
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: tutortool
|
||||
spec:
|
||||
selector:
|
||||
app: tutortool
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 3000
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: tutortool-ingress
|
||||
spec:
|
||||
rules:
|
||||
- host: tutor.puchstein.dev
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: tutortool
|
||||
port:
|
||||
number: 80
|
||||
@@ -0,0 +1,10 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: tutortool-pvc
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
Reference in New Issue
Block a user