apiVersion: apps/v1
kind: Deployment
metadata:
  name: wikijs
  namespace: wikijs
  labels:
    app: wikijs
spec:
  replicas: 1
  selector:
    matchLabels:
      app: wikijs
  template:
    metadata:
      labels:
        app: wikijs
    spec:
      containers:
        - name: wikijs
          image: ghcr.io/requarks/wiki:2
          ports:
            - containerPort: 3000
          env:
            - name: DB_TYPE
              value: postgres
            - name: DB_HOST
              value: wikijs-db
            - name: DB_PORT
              value: "5432"
            - name: DB_NAME
              value: wikijs
            - name: DB_USER
              valueFrom:
                secretKeyRef:
                  name: wikijs-db-secret
                  key: username
            - name: DB_PASS
              valueFrom:
                secretKeyRef:
                  name: wikijs-db-secret
                  key: password
          readinessProbe:
            httpGet:
              path: /healthz
              port: 3000
            initialDelaySeconds: 10
            periodSeconds: 10
          livenessProbe:
            httpGet:
              path: /healthz
              port: 3000
            initialDelaySeconds: 30
            periodSeconds: 30
          resources:
            requests:
              cpu: 200m
              memory: 256Mi
            limits:
              cpu: 500m
              memory: 512Mi
---
apiVersion: v1
kind: Service
metadata:
  name: wikijs
  namespace: wikijs
  labels:
    app: wikijs
spec:
  selector:
    app: wikijs
  ports:
    - port: 3000
      targetPort: 3000
  type: ClusterIP
