apiVersion: v1
kind: Service
metadata:
  name: plc
  namespace: atproto
spec:
  selector:
    app: plc
  ports:
    - port: 3000
      targetPort: 3000
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: plc
  namespace: atproto
spec:
  replicas: 1
  selector:
    matchLabels:
      app: plc
  template:
    metadata:
      labels:
        app: plc
    spec:
      containers:
        - name: plc
          image: registry/plc
          ports:
            - containerPort: 3000
          env:
            - name: DATABASE_URL
              value: "postgres://postgres:postgres@database/plc"
            - name: DB_CREDS_JSON
              value: '{"username":"postgres","password":"postgres","host":"database","port":"5432","database":"plc"}'
            - name: ENABLE_MIGRATIONS
              value: "true"
            - name: DB_MIGRATE_CREDS_JSON
              value: '{"username":"postgres","password":"postgres","host":"database","port":"5432","database":"plc"}'
          livenessProbe:
            httpGet:
              path: /_health
              port: 3000
            initialDelaySeconds: 10
            periodSeconds: 10
          readinessProbe:
            httpGet:
              path: /_health
              port: 3000
            initialDelaySeconds: 5
            periodSeconds: 5
