---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: webtrees
  name: webtrees
  namespace: webtrees
spec:
  replicas: 1
  selector:
    matchLabels:
      app: webtrees
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: webtrees
    spec:
      containers:
      - image: ghcr.io/nathanvaughn/webtrees:2.0.16
        name: webtrees
        ports:
        - containerPort: 80
          name: http
        env:
        - name: PRETTY_URLS
          value: "1"
        - name: LANG
          value: "en-US"
        - name: DB_TYPE
          value: "en-US"
        - name: DB_HOST
          value: "webtrees-db-mariadb-primary.webtrees.svc.cluster.local"
        - name: DB_PORT
          value: "3306"
        - name: DB_USER
          value: "webtrees"
        - name: DB_PASS
          valueFrom:
            secretKeyRef:
              key: mariadb-password
              name: db-secret
        - name: DB_NAME
          value: "webtrees"
        - name: DB_PREFIX
          value: "wt_"
        - name: WT_USER
          value: "patrik"
        - name: WT_NAME
          value: "Patrik Cyvoct"
        - name: WT_PASS
          valueFrom:
            secretKeyRef:
              key: password
              name: webtrees-secret
        - name: WT_EMAIL
          value: "${SECRET_EMAIL}"
        volumeMounts:
        - mountPath: "/var/www/webtrees/data/"
          name: webtrees-data
      volumes:
      - name: webtrees-data
        persistentVolumeClaim:
          claimName: webtrees-data
