apiVersion: v1
kind: Service
metadata:
  name: feed
  namespace: atproto
spec:
  selector:
    app: feed
  ports:
    - port: 3000
      targetPort: 3000
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: feed-data
  namespace: atproto
spec:
  accessModes: ["ReadWriteOnce"]
  resources:
    requests:
      storage: 2Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: feed
  namespace: atproto
spec:
  replicas: 1
  selector:
    matchLabels:
      app: feed
  template:
    metadata:
      labels:
        app: feed
    spec:
      containers:
        - name: feed
          image: registry/feed
          ports:
            - containerPort: 3000
          env:
            - name: FEEDGEN_PORT
              value: "3000"
            - name: FEEDGEN_LISTENHOST
              value: "0.0.0.0"
            - name: FEEDGEN_SQLITE_LOCATION
              value: "/data/db.sqlite"
            - name: FEEDGEN_HOSTNAME
              value: "feed.syu.is"
            - name: FEEDGEN_PUBLISHER_DID
              value: "did:plc:6qyecktefllvenje24fcxnie"
            - name: FEEDGEN_SERVICE_DID
              value: "did:web:feed.syu.is"
            - name: FEEDGEN_JETSTREAM_URL
              value: "ws://jetstream:6008/subscribe"
          volumeMounts:
            - name: data
              mountPath: /data
          livenessProbe:
            httpGet:
              path: /
              port: 3000
            initialDelaySeconds: 10
            periodSeconds: 10
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: feed-data
