apiVersion: apps/v1
kind: Deployment
metadata:
  name: rybbit-backend
  labels:
    app.kubernetes.io/controller: backend
    app.kubernetes.io/instance: rybbit
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: rybbit
    helm.sh/chart: rybbit-5.0.1
  namespace: rybbit
spec:
  revisionHistoryLimit: 3
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app.kubernetes.io/controller: backend
      app.kubernetes.io/name: rybbit
      app.kubernetes.io/instance: rybbit
  template:
    metadata:
      annotations:
        checksum/configMaps: ba4b6ef840b78e95c76ebd6d10e0cc8536bd139037769a25c40c76f1eceb029d
      labels:
        app.kubernetes.io/controller: backend
        app.kubernetes.io/instance: rybbit
        app.kubernetes.io/name: rybbit
    spec:
      enableServiceLinks: false
      serviceAccountName: rybbit
      automountServiceAccountToken: false
      hostIPC: false
      hostNetwork: false
      hostPID: false
      dnsPolicy: ClusterFirst
      containers:
        - env:
            - name: NODE_ENV
              value: production
            - name: CLICKHOUSE_HOST
              value: http://rybbit-clickhouse.rybbit:8123
            - name: CLICKHOUSE_DB
              value: analytics
            - name: CLICKHOUSE_USER
              valueFrom:
                secretKeyRef:
                  key: clickhouse-user
                  name: rybbit-clickhouse-config
            - name: CLICKHOUSE_PASSWORD
              valueFrom:
                secretKeyRef:
                  key: clickhouse-password
                  name: rybbit-clickhouse-config
            - name: POSTGRES_HOST
              valueFrom:
                secretKeyRef:
                  key: host
                  name: rybbit-postgresql-18-cluster-app
            - name: POSTGRES_PORT
              valueFrom:
                secretKeyRef:
                  key: port
                  name: rybbit-postgresql-18-cluster-app
            - name: POSTGRES_DB
              valueFrom:
                secretKeyRef:
                  key: dbname
                  name: rybbit-postgresql-18-cluster-app
            - name: POSTGRES_USER
              valueFrom:
                secretKeyRef:
                  key: user
                  name: rybbit-postgresql-18-cluster-app
            - name: POSTGRES_PASSWORD
              valueFrom:
                secretKeyRef:
                  key: password
                  name: rybbit-postgresql-18-cluster-app
            - name: BETTER_AUTH_SECRET
              valueFrom:
                secretKeyRef:
                  key: better-auth-secret
                  name: rybbit-config
            - name: BASE_URL
              value: https://rybbit.alexlebens.dev
            - name: DISABLE_SIGNUP
              value: "false"
            - name: DISABLE_TELEMETRY
              value: "true"
            - name: MAPBOX_TOKEN
              valueFrom:
                secretKeyRef:
                  key: mapbox-token
                  name: rybbit-config
          image: ghcr.io/rybbit-io/rybbit-backend:v2.6.1@sha256:d354b1abf15841fa107260546c524cc6254980fbcf0c3f9780fec669a4dc6297
          livenessProbe:
            failureThreshold: 5
            httpGet:
              path: /api/health
              port: 3001
            initialDelaySeconds: 10
            periodSeconds: 30
            successThreshold: 1
            timeoutSeconds: 5
          name: main
          resources:
            requests:
              cpu: 10m
              memory: 200Mi
