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