From 5d5d01ef6e17c7ce9e7d153eaf774d4a576d76dd Mon Sep 17 00:00:00 2001 From: B4D_US3R Date: Wed, 9 Oct 2024 20:59:24 +0500 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=B5=D1=80=D1=81=D0=B8=D1=8F=20=D0=B1?= =?UTF-8?q?=D0=B5=D0=B7=20=D1=80=D0=B5=D0=BF=D0=BB=D0=B8=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deployment.yaml | 89 +++++++++++++++++++++++++++++++++++++++++++++++++ ingress.yaml | 18 ++++++++++ service.yaml | 22 ++++++++++++ 3 files changed, 129 insertions(+) create mode 100644 deployment.yaml create mode 100644 ingress.yaml create mode 100644 service.yaml diff --git a/deployment.yaml b/deployment.yaml new file mode 100644 index 0000000..b217366 --- /dev/null +++ b/deployment.yaml @@ -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 diff --git a/ingress.yaml b/ingress.yaml new file mode 100644 index 0000000..82a74c6 --- /dev/null +++ b/ingress.yaml @@ -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 diff --git a/service.yaml b/service.yaml new file mode 100644 index 0000000..6902d2b --- /dev/null +++ b/service.yaml @@ -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