---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: healthchecks
  namespace: healthchecks
  labels:
    app: healthchecks
  annotations:
    reloader.stakater.com/auto: "true"
spec:
  replicas: 1
  selector:
    matchLabels:
      app: healthchecks
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: healthchecks
    spec:
      initContainers:
        - name: truncate-local-settings-py
          image: busybox:1.35.0
          imagePullPolicy: IfNotPresent
          command:
            - sh
            - -c
            - '[ -f /config/local_settings.py ] && rm -f /config/local_settings.py || exit 0'
          volumeMounts:
            - mountPath: /config
              name: healthchecks-data
      containers:
        - name: healthchecks
          image: lscr.io/linuxserver/healthchecks:v1.25.0-ls109
          imagePullPolicy: IfNotPresent
          env:
            - name: TZ
              value: Europe/Zurich
            - name: PGID
              value: "2000"
            - name: PUID
              value: "2000"
            - name: SITE_NAME
              value: Healthchecks
            - name: SITE_ROOT
              value: https://healthchecks.local.${BASE_DOMAIN}
            - name: DEBUG
              value: "False"
            - name: REGISTRATION_OPEN
              value: "False"
            - name: REGENERATE_SETTINGS
              value: "True"
            - name: REMOTE_USER_HEADER
              value: HTTP_X_FORWARDED_EMAIL
            - name: SITE_LOGO_URL
              value: https://healthchecks.io/static/img/logo-full.svg
            - name: DOCKER_MODS
              value: linuxserver/mods:universal-cron
          envFrom:
            - secretRef:
                name: healthchecks-prunes
            - secretRef:
                name: healthchecks-superuser
            - secretRef:
                name: healthchecks-mail-settings
          ports:
            - name: http
              containerPort: 8000
          startupProbe:
            exec:
              command:
                - bash
                - -c
                - /scripts/startup
            initialDelaySeconds: 30
            failureThreshold: 90
            timeoutSeconds: 5
            periodSeconds: 3
          livenessProbe:
            httpGet:
              path: /api/v1/status/
              port: http
            initialDelaySeconds: 30
            failureThreshold: 5
            periodSeconds: 30
          volumeMounts:
            - name: healthchecks-data
              mountPath: /config
            - name: prunes
              mountPath: /etc/periodic/weekly/prunes
              subPath: prunes
            - name: startup
              mountPath: /scripts/startup
              subPath: startup
          resources:
            requests:
              memory: 256Mi
              cpu: 100m
            limits:
              memory: 256Mi
              cpu: 100m
      restartPolicy: Always
      automountServiceAccountToken: false
      volumes:
        - name: healthchecks-data
          persistentVolumeClaim:
            claimName: healthchecks-data
        - name: healthchecks-prunes
          secret:
            secretName: healthchecks-prunes
        - name: prunes
          configMap:
            name: prunes
            defaultMode: 0755
        - name: startup
          configMap:
            name: startup
            defaultMode: 0755
