feat(db): Migrate to CloudNativePG

This commit is contained in:
Tanguy Herbron 2024-01-14 00:09:47 +01:00
parent 1830d126a5
commit 39b680f3cf
5 changed files with 42 additions and 25 deletions

View File

@ -7,6 +7,7 @@ data:
APP_NAME: Halia hosted git solution
RUN_MODE: prod
GITEA__server__DISABLE_SSH: "true"
GITEA__server__ROOT_URL: "https://git.beta.halia.dev"
GITEA__security__INSTALL_LOCK: "true"
GITEA__service__DISABLE_REGISTRATION: "true"
GITEA__metrics__ENABLED: "true"

View File

@ -1,26 +1,27 @@
kind: "postgresql"
apiVersion: "acid.zalan.do/v1"
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: "gitea"
namespace: "gitea"
labels:
team: acid
name: gitea-db
namespace: gitea
spec:
teamId: "acid"
instances: 1
storage:
size: 1Gi
storageClass: flat-storage-class
bootstrap:
initdb:
database: gitea
owner: gitea
secret:
name: gitea-db
postgresql:
version: "15"
numberOfInstances: 1
volume:
size: "1Gi"
storageClass: "flat-storage-class"
users:
gitea: []
databases:
gitea: gitea
allowedSourceRanges:
# IP ranges to access your cluster go here
pg_hba:
- host all all all md5
resources:
requests:
cpu: 100m

View File

@ -29,7 +29,7 @@ spec:
- name: GITEA__database__DB_TYPE
value: "postgres"
- name: GITEA__database__HOST
value: "gitea.gitea.svc.cluster.local:5432"
value: "gitea-db-rw.gitea.svc.cluster.local:5432"
- name: GITEA__database__NAME
value: "gitea"
- name: GITEA__database__SSL_MODE
@ -37,12 +37,12 @@ spec:
- name: GITEA__database__USER
valueFrom:
secretKeyRef:
name: gitea.gitea.credentials.postgresql.acid.zalan.do
name: gitea-db
key: username
- name: GITEA__database__PASSWD
valueFrom:
secretKeyRef:
name: gitea.gitea.credentials.postgresql.acid.zalan.do
name: gitea-db
key: password
- name: GITEA__server__LFS_JWT_SECRET
valueFrom:
@ -76,10 +76,12 @@ spec:
- mountPath: "/admin-creator.sh"
name: gitea-admin-creator
subPath: admin-creator.sh
- mountPath: "/data"
name: gitea-data
volumes:
- name: gitea-pv
hostPath:
path: "/mnt/gitea"
- name: gitea-data
persistentVolumeClaim:
claimName: gitea-pvc
- name: gitea-config-volume
configMap:
name: gitea-config

View File

@ -9,4 +9,5 @@ resources:
- ingress.yaml
- configmap.yaml
- admin-creator.yaml
- pvc.yaml
- deployment.yaml

12
manifests/pvc.yaml Normal file
View File

@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: gitea-pvc
namespace: gitea
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: flat-storage-class