Modelled on dynamic-qr: Traefik Gateway with Let's Encrypt, Longhorn PVC, 1 replica with Recreate, Calico network policies, and a rate limit on POST /api/leads. CI runs the tests in a Dockerfile stage before pushing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfmHGGiYUjNcvJoyzdf
96 lines
2.4 KiB
YAML
96 lines
2.4 KiB
YAML
# Leads live in a SQLite file on this volume. ReadWriteOnce + 1 replica + Recreate: SQLite has a
|
|
# single writer, so two pods must never hold the file at once (not even during a rollout).
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: ins-landing-page-data
|
|
namespace: ins-landing-page
|
|
spec:
|
|
storageClassName: longhorn
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: 1Gi
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: ins-landing-page
|
|
namespace: ins-landing-page
|
|
spec:
|
|
selector:
|
|
app: ins-landing-page
|
|
ports:
|
|
- name: http
|
|
port: 3000
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: ins-landing-page
|
|
namespace: ins-landing-page
|
|
spec:
|
|
replicas: 1
|
|
strategy:
|
|
type: Recreate
|
|
selector:
|
|
matchLabels:
|
|
app: ins-landing-page
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: ins-landing-page
|
|
spec:
|
|
imagePullSecrets:
|
|
- name: regcred
|
|
terminationGracePeriodSeconds: 10
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
runAsUser: 1000 # the image's `node` user
|
|
runAsGroup: 1000
|
|
fsGroup: 1000 # so the app can write to the Longhorn volume
|
|
containers:
|
|
- name: ins-landing-page
|
|
# One moving tag per profile (CI); the rollout restarts the pod to pull it.
|
|
image: gitea.containerverse.dev/solvway/ins-landing-page:ins-landing-page-prd-latest
|
|
imagePullPolicy: Always
|
|
env:
|
|
- name: PORT
|
|
value: "3000"
|
|
- name: DB_PATH
|
|
value: /data/leads.db
|
|
ports:
|
|
- name: http
|
|
containerPort: 3000
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /data
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /
|
|
port: http
|
|
periodSeconds: 10
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /
|
|
port: http
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 30
|
|
failureThreshold: 3
|
|
resources:
|
|
requests:
|
|
cpu: 20m
|
|
memory: 48Mi
|
|
limits:
|
|
memory: 192Mi
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
readOnlyRootFilesystem: true
|
|
capabilities:
|
|
drop: ["ALL"]
|
|
volumes:
|
|
- name: data
|
|
persistentVolumeClaim:
|
|
claimName: ins-landing-page-data
|