apiVersion: v1
kind: Pod
metadata:
  name: paperless
  labels:
    app: paperless
spec:
  restartPolicy: Always
  containers:
  - name: paperless
    image: ghcr.io/paperless-ngx/paperless-ngx:latest
    ports:
    - hostPort: 8000
      containerPort: 8000
    env:
    - name: PAPERLESS_REDIS
      value: redis://127.0.0.1:6379
    - name: PAPERLESS_DBHOST
      value: 127.0.0.1
    - name: PAPERLESS_DBPORT
      value: '5432'
    - name: PAPERLESS_DBNAME
      value: paperless
    - name: PAPERLESS_DBUSER
      value: paperless
    - name: PAPERLESS_DBPASS
      value: Y9o7RiXgSYrllYaOZkLsxA
    - name: PAPERLESS_ADMIN_USER
      value: admin
    - name: PAPERLESS_ADMIN_PASSWORD
      value: Y9o7RiXgSYrllYaOZkLsxA
    - name: PAPERLESS_SECRET_KEY
      value: DfsEG1-q1lKbFPRHuuA0yA
    volumeMounts:
    - name: vol-0
      mountPath: /usr/src/paperless/data
    - name: vol-1
      mountPath: /usr/src/paperless/media
    - name: vol-2
      mountPath: /usr/src/paperless/export
    - name: vol-3
      mountPath: /usr/src/paperless/consume
    securityContext:
      runAsUser: 1000
      runAsGroup: 1000
  - name: redis
    image: docker.io/redis:7-alpine
    ports:
    - hostPort: 6379
      containerPort: 6379
    volumeMounts:
    - name: vol-4
      mountPath: /data
    command:
    - redis-server
    - --appendonly
    - 'yes'
  - name: postgres
    image: docker.io/postgres:16
    ports:
    - hostPort: 5432
      containerPort: 5432
    env:
    - name: POSTGRES_USER
      value: paperless
    - name: POSTGRES_PASSWORD
      value: Y9o7RiXgSYrllYaOZkLsxA
    - name: POSTGRES_DB
      value: paperless
    volumeMounts:
    - name: vol-5
      mountPath: /var/lib/postgresql/data
  volumes:
  - name: vol-0
    hostPath:
      path: ~/paperless/data
      type: DirectoryOrCreate
  - name: vol-1
    hostPath:
      path: ~/paperless/media
      type: DirectoryOrCreate
  - name: vol-2
    hostPath:
      path: ~/paperless/export
      type: DirectoryOrCreate
  - name: vol-3
    hostPath:
      path: ~/paperless/consume
      type: DirectoryOrCreate
  - name: vol-4
    hostPath:
      path: ~/paperless/redis
      type: DirectoryOrCreate
  - name: vol-5
    hostPath:
      path: ~/paperless/db
      type: DirectoryOrCreate
