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