Files
SFusion/k8s/06-backend-deployment.yaml
2026-05-09 13:28:12 +03:00

85 lines
2.3 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: sfusion-backend
namespace: sfusion
labels:
app.kubernetes.io/name: sfusion-backend
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app.kubernetes.io/name: sfusion-backend
template:
metadata:
labels:
app.kubernetes.io/name: sfusion-backend
spec:
initContainers:
- name: wait-for-postgres
image: busybox:1.36
command:
- /bin/sh
- -c
- |
set -e
until nc -z postgres-0.postgres 5432; do
echo "waiting for postgres"; sleep 2
done
containers:
- name: backend
# Build and push your image, then update this reference.
image: sfusion/backend:latest
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 8080
env:
- name: DATABASE_HOST
value: postgres-0.postgres.sfusion.svc.cluster.local
- name: DATABASE_PORT
value: "5432"
- name: AUTO_MIGRATE
value: "true"
- name: PORT
value: "8080"
- name: HOSTNAME
value: "0.0.0.0"
- name: DATABASE_USERNAME
valueFrom:
secretKeyRef:
name: sfusion-postgres
key: POSTGRES_USER
- name: DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: sfusion-postgres
key: POSTGRES_PASSWORD
- name: DATABASE_NAME
valueFrom:
secretKeyRef:
name: sfusion-postgres
key: POSTGRES_DB
readinessProbe:
httpGet:
path: /api/health
port: http
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 3
livenessProbe:
httpGet:
path: /api/health
port: http
initialDelaySeconds: 30
periodSeconds: 20
resources:
requests:
cpu: 250m
memory: 512Mi
limits:
cpu: "2"
memory: 2Gi