apiVersion: apps/v1 kind: Deployment metadata: name: karrot-backend namespace: {{ .namespace }} spec: replicas: 1 strategy: type: Recreate selector: matchLabels: component: backend template: metadata: labels: component: backend spec: securityContext: runAsNonRoot: true runAsUser: 1000 runAsGroup: 1000 fsGroup: 1000 seccompProfile: type: RuntimeDefault initContainers: - name: migrate image: codeberg.org/karrot/karrot-backend:v17.4.1 command: ["/entrypoint.sh", "migrate"] env: - name: MODE value: prod - name: BASE_URL value: https://{{ .domain }} - name: SECRET_KEY valueFrom: secretKeyRef: name: karrot-secrets key: secretKey - name: DATABASE_NAME value: {{ .db.name }} - name: DATABASE_USER value: {{ .db.user }} - name: DATABASE_HOST value: {{ .db.host }} - name: DATABASE_PORT value: "{{ .db.port }}" - name: DATABASE_PASSWORD valueFrom: secretKeyRef: name: karrot-secrets key: dbPassword - name: REDIS_HOST value: {{ .redis.host }} - name: EMAIL_BACKEND value: smtp - name: EMAIL_FROM value: {{ .smtp.from }} - name: SMTP_HOST value: {{ .smtp.host }} - name: SMTP_PORT value: "{{ .smtp.port }}" - name: SMTP_USER value: {{ .smtp.user }} - name: SMTP_PASSWORD valueFrom: secretKeyRef: name: karrot-secrets key: smtp.password securityContext: allowPrivilegeEscalation: false capabilities: drop: [ALL] readOnlyRootFilesystem: false volumeMounts: - name: karrot-uploads mountPath: /app/uploads containers: - name: karrot-backend image: codeberg.org/karrot/karrot-backend:v17.4.1 command: ["/entrypoint.sh", "server"] ports: - name: http containerPort: 8000 protocol: TCP env: - name: MODE value: prod - name: BASE_URL value: https://{{ .domain }} - name: SECRET_KEY valueFrom: secretKeyRef: name: karrot-secrets key: secretKey - name: DATABASE_NAME value: {{ .db.name }} - name: DATABASE_USER value: {{ .db.user }} - name: DATABASE_HOST value: {{ .db.host }} - name: DATABASE_PORT value: "{{ .db.port }}" - name: DATABASE_PASSWORD valueFrom: secretKeyRef: name: karrot-secrets key: dbPassword - name: REDIS_HOST value: {{ .redis.host }} - name: EMAIL_BACKEND value: smtp - name: EMAIL_FROM value: {{ .smtp.from }} - name: SMTP_HOST value: {{ .smtp.host }} - name: SMTP_PORT value: "{{ .smtp.port }}" - name: SMTP_USER value: {{ .smtp.user }} - name: SMTP_PASSWORD valueFrom: secretKeyRef: name: karrot-secrets key: smtp.password - name: LISTEN_HOST value: "0.0.0.0:8000" - name: ALLOWED_HOSTS value: "{{ .domain }}" - name: CSRF_TRUSTED_ORIGINS value: "https://{{ .domain }}" resources: limits: cpu: 1000m ephemeral-storage: 1Gi memory: 1Gi requests: cpu: 50m ephemeral-storage: 50Mi memory: 256Mi volumeMounts: - name: karrot-uploads mountPath: /app/uploads livenessProbe: httpGet: path: /api/ port: 8000 httpHeaders: - name: Host value: "{{ .domain }}" initialDelaySeconds: 60 timeoutSeconds: 5 periodSeconds: 20 failureThreshold: 6 readinessProbe: httpGet: path: /api/ port: 8000 httpHeaders: - name: Host value: "{{ .domain }}" initialDelaySeconds: 30 timeoutSeconds: 3 periodSeconds: 10 failureThreshold: 3 securityContext: allowPrivilegeEscalation: false capabilities: drop: [ALL] readOnlyRootFilesystem: false volumes: - name: karrot-uploads persistentVolumeClaim: claimName: karrot-uploads restartPolicy: Always