backend files

This commit is contained in:
2026-02-06 17:25:41 +00:00
parent bac6808b70
commit be51e634d8
4 changed files with 117 additions and 0 deletions

View File

@@ -0,0 +1,85 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: backend
labels:
app: backend
component: api
spec:
replicas: 2
selector:
matchLabels:
app: backend
template:
metadata:
labels:
app: backend
component: api
spec:
initContainers:
# Wait for MySQL to be ready
- name: wait-for-mysql
image: busybox:1.36
command:
- sh
- -c
- |
until nc -z mysql 3306; do
echo "Waiting for MySQL..."
sleep 2
done
echo "MySQL is ready!"
containers:
- name: backend
image: gitea.example.com/inventory/backend:latest # Overridden by Kustomize
ports:
- containerPort: 3000
name: http
env:
- name: PORT
value: "3000"
- name: DB_HOST
valueFrom:
configMapKeyRef:
name: backend-config
key: db-host
- name: DB_PORT
value: "3306"
- name: DB_USER
valueFrom:
secretKeyRef:
name: mysql-secret
key: user
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-secret
key: password
- name: DB_NAME
valueFrom:
configMapKeyRef:
name: backend-config
key: db-name
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "256Mi"
cpu: "200m"
livenessProbe:
httpGet:
path: /health
port: 3000
initialDelaySeconds: 15
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /ready
port: 3000
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 2