apiVersion: apps/v1
kind: Deployment
metadata:
  name: ghost
  labels:
    app: ghost
spec:
  replicas: 1
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      app: ghost
  template:
    metadata:
      labels:
        app: ghost
    spec:
      containers:
        - name: ghost
          image: ghost:4.19.1
          ports:
            - containerPort: 2368
          env:
            - name: database__client
              value: "mysql"
            - name: database__connection__host
              valueFrom:
                secretKeyRef:
                  name: ghost-database
                  key: host
            - name: database__connection__user
              valueFrom:
                secretKeyRef:
                  name: ghost-database
                  key: username
            - name: database__connection__password
              valueFrom:
                secretKeyRef:
                  name: ghost-database
                  key: password
            - name: database__connection__database
              valueFrom:
                secretKeyRef:
                  name: ghost-database
                  key: dbname
          livenessProbe:
            tcpSocket:
              port: 2368
            initialDelaySeconds: 30
            periodSeconds: 10
          resources:
            requests:
              memory: "1Gi"
              cpu: "1"
            limits:
              memory: "1Gi"
              cpu: "1"
