---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: tobru-ch
  name: ghost
  namespace: tobru-ch
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      component: ghost
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        component: ghost
    spec:
      containers:
      - image: ghost:4.2.0-alpine
        imagePullPolicy: IfNotPresent
        name: ghost
        env:
        - name: url
          value: https://tobru.ch/
        - name: mail__transport
          value: SMTP
        - name: mail__options__service
          value: Mailgun
        - name: mail__options__host
          value: smtp.eu.mailgun.org
        - name: mail__options__auth__user
          value: ghost@www.tobru.ch
        - name: mail__options__auth__pass
          valueFrom:
            secretKeyRef:
              name: mailgun-auth
              key: auth_pass
        - name: mail__from
          value: "'tobru.ch Ghost Blog <ghost@www.tobru.ch>'"
        ports:
        - containerPort: 2368
          name: ghost
          protocol: TCP
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - name: data
          mountPath: /var/lib/ghost/content
          subPath: ghost
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - name: data
        persistentVolumeClaim:
          claimName: data
