Версия без реплик

This commit is contained in:
B4D_US3R 2024-10-09 20:59:24 +05:00
parent 47c1438bcf
commit 5d5d01ef6e
3 changed files with 129 additions and 0 deletions

89
deployment.yaml Normal file
View file

@ -0,0 +1,89 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: forgejo-deployment
labels:
app: forgejo
spec:
replicas: 1
selector:
matchLabels:
app: forgejo-web
template:
metadata:
labels:
app: forgejo-web
spec:
containers:
- name: forgejo-web
image: codeberg.org/forgejo/forgejo:8
env:
- name: USER_UID
value: "1000"
- name: USER_GID
value: "1000"
- name: FORGEJO__database__DB_TYPE
value: postgres
- name: FORGEJO__database__HOST
value: forgejo-db-service:5432
- name: FORGEJO__database__NAME
value: forgejo
- name: FORGEJO__database__USER
value: forgejo
- name: FORGEJO__database__PASSWD
valueFrom:
secretKeyRef:
name: postgresdb-password
key: POSTGRES_PASSWORD
ports:
- containerPort: 3000
- containerPort: 22
volumeMounts:
- name: forgejo-data
mountPath: /data
volumes:
- name: forgejo-data
hostPath:
path: /opt/forgejo/forgejo
type: Directory
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: forgejo-deployment-db
labels:
app: forgejo-db
spec:
replicas: 1
selector:
matchLabels:
app: forgejo-db
template:
metadata:
labels:
app: forgejo-db
spec:
containers:
- name: forgejo-db
image: postgres:16-alpine
env:
- name: POSTGRES_USER
value: "forgejo"
- name: POSTGRES_DB
value: "forgejo"
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgresdb-password
key: POSTGRES_PASSWORD
ports:
- containerPort: 5432
volumeMounts:
- name: forgejo-db-data
mountPath: /var/lib/postgresql/data
volumes:
- name: forgejo-db-data
hostPath:
path: /opt/forgejo/postgres
type: Directory

18
ingress.yaml Normal file
View file

@ -0,0 +1,18 @@
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: forgejo-ingress
spec:
ingressClassName: nginx
rules:
- host: testing.lan
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: forgejo-service
port:
number: 3000

22
service.yaml Normal file
View file

@ -0,0 +1,22 @@
---
apiVersion: v1
kind: Service
metadata:
name: forgejo-service
spec:
selector:
app: forgejo-web
ports:
- port: 3000
targetPort: 3000
---
apiVersion: v1
kind: Service
metadata:
name: forgejo-db-service
spec:
selector:
app: forgejo-db
ports:
- port: 5432
targetPort: 5432