remove separate db deployment
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: gitea-db
|
||||
namespace: default
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: gitea-db
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: gitea-db
|
||||
spec:
|
||||
initContainers:
|
||||
- name: init-cleanup
|
||||
image: busybox
|
||||
command: ["rm", "-rf", "/var/lib/postgresql/data/lost+found"]
|
||||
volumeMounts:
|
||||
- name: db
|
||||
mountPath: /var/lib/postgresql/data
|
||||
containers:
|
||||
- name: gitea-db
|
||||
image: postgres:15.10
|
||||
ports:
|
||||
- containerPort: 5432
|
||||
env:
|
||||
- name: POSTGRES_USER
|
||||
value: "gitea"
|
||||
- name: POSTGRES_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: gitea-db-secret
|
||||
key: password
|
||||
- name: POSTGRES_DB
|
||||
value: "gitea"
|
||||
volumeMounts:
|
||||
- name: db
|
||||
mountPath: /var/lib/postgresql/data
|
||||
volumes:
|
||||
- name: db
|
||||
persistentVolumeClaim:
|
||||
claimName: longhorn-gitea-db
|
||||
@@ -7,7 +7,7 @@ metadata:
|
||||
spec:
|
||||
type: NodePort
|
||||
selector:
|
||||
app: gitea
|
||||
app: gitea-app
|
||||
ports:
|
||||
- port: 3000
|
||||
targetPort: 3000
|
||||
@@ -23,26 +23,12 @@ metadata:
|
||||
spec:
|
||||
type: NodePort
|
||||
selector:
|
||||
app: gitea
|
||||
app: gitea-app
|
||||
ports:
|
||||
- port: 22
|
||||
targetPort: 22
|
||||
nodePort: 222
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: gitea-db-service
|
||||
namespace: default
|
||||
spec:
|
||||
selector:
|
||||
app: gitea-db
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 5432
|
||||
targetPort: 5432
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
@@ -51,7 +37,7 @@ metadata:
|
||||
namespace: default
|
||||
spec:
|
||||
selector:
|
||||
app: gitea
|
||||
app: gitea-app
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 3000
|
||||
|
||||
@@ -2,40 +2,47 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: gitea
|
||||
name: gitea-app
|
||||
namespace: default
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: gitea
|
||||
app: gitea-app
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: gitea
|
||||
app: gitea-app
|
||||
spec:
|
||||
initContainers:
|
||||
- name: wait-for-db
|
||||
- name: init-cleanup
|
||||
image: busybox
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
until nc -z -v -w30 gitea-db-service 5432; do
|
||||
echo "Waiting for database to be ready..."
|
||||
sleep 2
|
||||
done
|
||||
command: ["rm", "-rf", "/var/lib/postgresql/data/lost+found"]
|
||||
volumeMounts:
|
||||
- name: db
|
||||
mountPath: /var/lib/postgresql/data
|
||||
- name: gitea-db
|
||||
image: postgres:15.10
|
||||
restartPolicy: Always
|
||||
env:
|
||||
- name: POSTGRES_USER
|
||||
value: "gitea"
|
||||
- name: POSTGRES_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: gitea-db-secret
|
||||
key: password
|
||||
- name: POSTGRES_DB
|
||||
value: "gitea"
|
||||
volumeMounts:
|
||||
- name: db
|
||||
mountPath: /var/lib/postgresql/data
|
||||
containers:
|
||||
- name: gitea
|
||||
image: gitea/gitea:1.23.8
|
||||
ports:
|
||||
- containerPort: 22
|
||||
- containerPort: 3000
|
||||
securityContext:
|
||||
capabilities:
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
fsGroup: 1000
|
||||
env:
|
||||
- name: USER_UID
|
||||
value: "1000"
|
||||
@@ -44,7 +51,7 @@ spec:
|
||||
- name: GITEA__database__DB_TYPE
|
||||
value: "postgres"
|
||||
- name: GITEA__database__HOST
|
||||
value: "gitea-db-service:5432"
|
||||
value: "localhost:5432"
|
||||
- name: GITEA__database__NAME
|
||||
value: "gitea"
|
||||
- name: GITEA__database__USER
|
||||
@@ -54,8 +61,6 @@ spec:
|
||||
secretKeyRef:
|
||||
name: gitea-db-secret
|
||||
key: password
|
||||
- name: TMPDIR
|
||||
value: "/tmp"
|
||||
volumeMounts:
|
||||
- name: gitea-data
|
||||
mountPath: /data
|
||||
@@ -76,4 +81,6 @@ spec:
|
||||
- name: gitea-data
|
||||
persistentVolumeClaim:
|
||||
claimName: longhorn-gitea
|
||||
|
||||
- name: db
|
||||
persistentVolumeClaim:
|
||||
claimName: longhorn-gitea-db
|
||||
|
||||
Reference in New Issue
Block a user