fix: production API URL, k8s single replica, health probes
- Change API_URL default from localhost:4000 to empty string (relative URLs) - Set VITE_API_URL="" explicitly in Dockerfile frontend build stage - Reduce k8s replicas to 1 (SQLite + ReadWriteOnce PVC) - Add liveness and readiness probes targeting /health endpoint Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,7 @@ RUN npm ci
|
|||||||
COPY frontend/ ./
|
COPY frontend/ ./
|
||||||
|
|
||||||
# Build frontend for production
|
# Build frontend for production
|
||||||
|
ENV VITE_API_URL=""
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Production stage
|
# Production stage
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// API Configuration
|
// API Configuration
|
||||||
const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:4000';
|
const API_URL = import.meta.env.VITE_API_URL || '';
|
||||||
|
|
||||||
export default API_URL;
|
export default API_URL;
|
||||||
|
|||||||
18
k8s.yaml
18
k8s.yaml
@@ -22,7 +22,7 @@ spec:
|
|||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: awards
|
app: awards
|
||||||
replicas: 2
|
replicas: 1
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -77,6 +77,22 @@ spec:
|
|||||||
limits:
|
limits:
|
||||||
memory: "512Mi"
|
memory: "512Mi"
|
||||||
cpu: "500m"
|
cpu: "500m"
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /health
|
||||||
|
port: 4000
|
||||||
|
initialDelaySeconds: 10
|
||||||
|
periodSeconds: 30
|
||||||
|
timeoutSeconds: 3
|
||||||
|
failureThreshold: 3
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /health
|
||||||
|
port: 4000
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 3
|
||||||
|
failureThreshold: 3
|
||||||
volumes:
|
volumes:
|
||||||
- name: data
|
- name: data
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
|
|||||||
Reference in New Issue
Block a user