146 lines
3.2 KiB
YAML
146 lines
3.2 KiB
YAML
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: backend-secret
|
|
namespace: xpeditis
|
|
type: Opaque
|
|
data:
|
|
# Base64 encoded JWT secret
|
|
JWT_SECRET: eHBlZGl0aXMtcHJvZC1zZWNyZXQta2V5LWNoYW5nZS1pbi1wcm9kdWN0aW9u
|
|
|
|
---
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: backend-config
|
|
namespace: xpeditis
|
|
data:
|
|
SPRING_PROFILES_ACTIVE: "prod"
|
|
SPRING_DATASOURCE_URL: "jdbc:postgresql://postgres-service:5432/xpeditis_prod"
|
|
CORS_ALLOWED_ORIGINS: "https://xpeditis.fr,https://www.xpeditis.fr"
|
|
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: backend
|
|
namespace: xpeditis
|
|
labels:
|
|
app: backend
|
|
spec:
|
|
replicas: 2
|
|
selector:
|
|
matchLabels:
|
|
app: backend
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: backend
|
|
spec:
|
|
containers:
|
|
- name: backend
|
|
image: ghcr.io/your-username/xpeditis/backend:latest
|
|
ports:
|
|
- containerPort: 8080
|
|
env:
|
|
- name: SPRING_PROFILES_ACTIVE
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: backend-config
|
|
key: SPRING_PROFILES_ACTIVE
|
|
- name: SPRING_DATASOURCE_URL
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: backend-config
|
|
key: SPRING_DATASOURCE_URL
|
|
- name: SPRING_DATASOURCE_USERNAME
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: postgres-secret
|
|
key: POSTGRES_USER
|
|
- name: SPRING_DATASOURCE_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: postgres-secret
|
|
key: POSTGRES_PASSWORD
|
|
- name: JWT_SECRET
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: backend-secret
|
|
key: JWT_SECRET
|
|
- name: CORS_ALLOWED_ORIGINS
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: backend-config
|
|
key: CORS_ALLOWED_ORIGINS
|
|
resources:
|
|
requests:
|
|
memory: "512Mi"
|
|
cpu: "250m"
|
|
limits:
|
|
memory: "1Gi"
|
|
cpu: "500m"
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /api/actuator/health
|
|
port: 8080
|
|
initialDelaySeconds: 60
|
|
periodSeconds: 30
|
|
timeoutSeconds: 10
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /api/actuator/health/readiness
|
|
port: 8080
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
volumeMounts:
|
|
- name: logs-volume
|
|
mountPath: /app/logs
|
|
volumes:
|
|
- name: logs-volume
|
|
emptyDir: {}
|
|
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: backend-service
|
|
namespace: xpeditis
|
|
labels:
|
|
app: backend
|
|
spec:
|
|
selector:
|
|
app: backend
|
|
ports:
|
|
- port: 8080
|
|
targetPort: 8080
|
|
type: ClusterIP
|
|
|
|
---
|
|
apiVersion: autoscaling/v2
|
|
kind: HorizontalPodAutoscaler
|
|
metadata:
|
|
name: backend-hpa
|
|
namespace: xpeditis
|
|
spec:
|
|
scaleTargetRef:
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
name: backend
|
|
minReplicas: 2
|
|
maxReplicas: 10
|
|
metrics:
|
|
- type: Resource
|
|
resource:
|
|
name: cpu
|
|
target:
|
|
type: Utilization
|
|
averageUtilization: 70
|
|
- type: Resource
|
|
resource:
|
|
name: memory
|
|
target:
|
|
type: Utilization
|
|
averageUtilization: 80
|