feat: Initial commit

This commit is contained in:
Tanguy Herbron 2025-02-24 23:29:54 +01:00
commit 188f627413
11 changed files with 231 additions and 0 deletions

0
README.md Normal file
View File

View File

@ -0,0 +1,10 @@
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
name: paperless-db-backup
namespace: paperless
spec:
schedule: "0 0 0 * * *"
backupOwnerReference: self
cluster:
name: paperless-db

53
manifests/database.yaml Normal file
View File

@ -0,0 +1,53 @@
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: paperless-db
namespace: paperless
spec:
imageName: ghcr.io/cloudnative-pg/postgresql:17.2
instances: 3
storage:
size: 1Gi
storageClass: local-path
bootstrap:
initdb:
database: paperless
owner: paperless
secret:
name: paperless-db
postgresql:
pg_hba:
- host all all all md5
backup:
barmanObjectStore:
destinationPath: "s3://halis/cloudnativepg"
endpointURL: https://s3.halia.dev
s3Credentials:
accessKeyId:
name: s3-secret
key: AWS_ACCESS_KEY_ID
secretAccessKey:
name: s3-secret
key: AWS_SECRET_ACCESS_KEY
region:
name: s3-secret
key: AWS_REGION
wal:
compression: gzip
maxParallel: 8
resources:
requests:
cpu: 100m
memory: 100Mi
limits:
cpu: 500m
memory: 500Mi
monitoring:
enablePodMonitor: true

56
manifests/deployment.yaml Normal file
View File

@ -0,0 +1,56 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: paperless
namespace: paperless
spec:
replicas: 1
selector:
matchLabels:
app: paperless
template:
metadata:
labels:
app: paperless
spec:
containers:
- name: paperless
image: paperlessngx/paperless-ngx:2.14.7
ports:
- containerPort: 8000
env:
- name: PAPERLESS_URL
value: "https://paper.halis.io"
- name: PAPERLESS_DBENGINE
value: "postgresql"
- name: PAPERLESS_DBHOST
value: "paperless-db-rw.paperless.svc.cluster.local"
- name: PAPERLESS_DBUSER
valueFrom:
secretKeyRef:
name: paperless-db
key: username
- name: PAPERLESS_DBPASS
valueFrom:
secretKeyRef:
name: paperless-db
key: password
- name: PAPERLESS_REDIS
value: "redis://redis-svc.paperless.svc.cluster.local:6379"
- name: PAPERLESS_DATA_DIR
value: "/volume/data"
- name: PAPERLESS_MEDIA_ROOT
value: "/volume/media"
- name: PAPERLESS_CONSUMPTION_DIR
value: "/volume/consume"
volumeMounts:
- mountPath: "/volume"
name: paperless-data
- name: redis
image: redis:7.4.2
ports:
- containerPort: 6379
volumes:
- name: paperless-data
persistentVolumeClaim:
claimName: paperless-pvc

29
manifests/ingress.yaml Normal file
View File

@ -0,0 +1,29 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: paperless-ingress
namespace: paperless
annotations:
cert-manager.io/cluster-issuer: letsencrypt-production
kubernetes.io/ingress.class: nginx-external
acme.cert-manager.io/http01-edit-in-place: "true"
nginx.ingress.kubernetes.io/proxy-body-size: "0"
nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
spec:
tls:
- hosts:
- paper.halis.io
secretName: paper-halis-io-tls
ingressClassName: nginx-external
rules:
- host: paper.halis.io
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: paperless-svc
port:
number: 80

View File

@ -0,0 +1,12 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- namespace.yaml
- secrets.yaml
- database.yaml
- database-backup.yaml
- service.yaml
- ingress.yaml
- pvc.yaml
- deployment.yaml

4
manifests/namespace.yaml Normal file
View File

@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: paperless

15
manifests/pvc.yaml Normal file
View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: paperless-pvc
namespace: paperless
labels:
recurring-job.longhorn.io/source: enabled
recurring-job-group.longhorn.io/standard-pvc: enabled
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: redundant-storage-class

View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: redis-svc
namespace: paperless
labels:
app.kubernetes.io/name: paperless
spec:
ports:
- name: http
port: 6379
protocol: TCP
targetPort: 6379
selector:
app: paperless

22
manifests/secrets.yaml Normal file
View File

@ -0,0 +1,22 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: paperless-secrets
namespace: argocd
spec:
project: default
source:
repoURL: https://git.halis.io/athens-school/k3s-secrets
targetRevision: prod-migration
path: paperless
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=false
- ApplyOutOfSyncOnly=true
- PruneLast=true
destination:
server: https://kubernetes.default.svc
namespace: paperless

15
manifests/service.yaml Normal file
View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: paperless-svc
namespace: paperless
labels:
app.kubernetes.io/name: paperless
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: 8000
selector:
app: paperless