apiVersion: apps/v1
kind: Deployment
metadata:
  name: attic
spec:
  selector:
    matchLabels:
      app: attic
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: attic
    spec:
      containers:
        - name: attic
          image: ghcr.io/zhaofengli/attic:latest
          args:
           - -f
           - /config.toml
          ports:
            - name: http
              containerPort: 8080
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /
              port: http
          readinessProbe:
            httpGet:
              path: /
              port: http
          env:
            - name: ATTIC_SERVER_TOKEN_HS256_SECRET_BASE64
              value: "[encoded data, 4332 characters]"
              # valueFrom:
              #   secretKeyRef:
              #     name: server
              #     key: token
            - name: ATTIC_SERVER_DATABASE_URL
              value: "postgresql://app:mZP1BnmnpDU33B7UZvomYKOSS1laRJ4bvUR7jNDZ1AJqPdNxH2rLXykghczg7Bgy@attic-db-rw:5432/app"
              # valueFrom:
                # secretKeyRef:
                  # name: database
                  # key: url
          volumeMounts:
          - name: data
            mountPath: /attic
          - name: attic-config
            mountPath: /config.toml
            subPath: config.toml
      volumes:
        - name: server
          secret:
            secretName: server
        - name: attic-config
          configMap:
            defaultMode: 420
            name: attic-config
        - name: data
          persistentVolumeClaim:
            claimName: attic
