apiVersion: apps/v1
kind: Deployment
metadata:
  name: ntfy
  labels:
    app.kubernetes.io/controller: main
    app.kubernetes.io/instance: ntfy
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: ntfy
    helm.sh/chart: ntfy-4.6.2
  namespace: ntfy
spec:
  revisionHistoryLimit: 3
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app.kubernetes.io/controller: main
      app.kubernetes.io/name: ntfy
      app.kubernetes.io/instance: ntfy
  template:
    metadata:
      labels:
        app.kubernetes.io/controller: main
        app.kubernetes.io/instance: ntfy
        app.kubernetes.io/name: ntfy
    spec:
      enableServiceLinks: false
      serviceAccountName: default
      automountServiceAccountToken: true
      hostIPC: false
      hostNetwork: false
      hostPID: false
      dnsPolicy: ClusterFirst
      containers:
        - args:
            - serve
          env:
            - name: TZ
              value: US/Central
            - name: NTFY_BASE_URL
              value: https://ntfy.alexlebens.net
            - name: NTFY_LISTEN_HTTP
              value: :80
            - name: NTFY_CACHE_FILE
              value: /var/cache/ntfy/cache.db
            - name: NTFY_CACHE_DURATION
              value: 36h
            - name: NTFY_CACHE_STARTUP_QUERIES
              value: |
                pragma journal_mode = WAL;
                pragma synchronous = normal;
                pragma temp_store = memory;
                pragma busy_timeout = 15000;
                vacuum;
            - name: NTFY_BEHIND_PROXY
              value: "true"
            - name: NTFY_ATTACHMENT_CACHE_DIR
              value: /var/cache/ntfy/attachments
            - name: NTFY_ATTACHMENT_TOTAL_SIZE_LIMIT
              value: 4G
            - name: NTFY_ATTACHMENT_FILE_SIZE_LIMIT
              value: 15M
            - name: NTFY_ATTACHMENT_EXPIRY_DURATION
              value: 36h
            - name: NTFY_ENABLE_SIGNUP
              value: "false"
            - name: NTFY_ENABLE_LOGIN
              value: "true"
            - name: NTFY_ENABLE_RESERVATIONS
              value: "false"
            - name: NTFY_AUTH_FILE
              value: /var/cache/ntfy/user.db
            - name: NTFY_AUTH_DEFAULT_ACCESS
              value: deny-all
            - name: NTFY_METRICS_LISTEN_HTTP
              value: :9090
            - name: NTFY_LOG_LEVEL
              value: info
          image: binwiederhier/ntfy:v2.15.0
          imagePullPolicy: IfNotPresent
          name: main
          resources:
            requests:
              cpu: 10m
              memory: 128Mi
          volumeMounts:
            - mountPath: /var/cache/ntfy
              name: cache
      volumes:
        - name: cache
          persistentVolumeClaim:
            claimName: ntfy
