Browse Source

Gitea funcionando

main
Celestino Rey 1 year ago
parent
commit
1fce6ae9ff
14 changed files with 162 additions and 138 deletions
  1. +1
    -0
      Gitea/010-deployment.yaml
  2. +2
    -0
      Gitea/030-network.yaml
  3. +57
    -0
      Gitea/Makefile
  4. +1
    -1
      Gitea/creaTodo.sh
  5. +52
    -0
      Gitea/db-deployment.yaml
  6. +17
    -0
      Gitea/db-service.yaml
  7. +1
    -0
      Gitea/entraPsql.sh
  8. +11
    -0
      Gitea/env-prod-db-configmap.yaml
  9. +5
    -5
      Gitea/kustomization.yaml
  10. +0
    -73
      Gitea/mysql-deployment-gitea.yaml
  11. +1
    -1
      Gitea/paraTodo.sh
  12. +0
    -57
      Gitea/php-myadmin-gitea-deployment.yaml
  13. +13
    -0
      Gitea/postgres-data-persistentvolumeclaim.yaml
  14. +1
    -1
      Gitea/pv-local-pg-gitea.yaml

+ 1
- 0
Gitea/010-deployment.yaml View File

@ -42,3 +42,4 @@ spec:
- name: git-data
persistentVolumeClaim:
claimName: git-pvc

+ 2
- 0
Gitea/030-network.yaml View File

@ -10,8 +10,10 @@ metadata:
spec:
selector:
app: gitea
type: NodePort
ports:
- name: gitea-http
nodePort: 30780
port: 3000
- name: gitea-ssh
port: 22

+ 57
- 0
Gitea/Makefile View File

@ -0,0 +1,57 @@
export ARQUITECTURA := $(shell lscpu |grep itectur | tr -d ' '| cut -f2 -d':')
#export REGISTRY=localhost:5000
export REGISTRY=registry.reymota.es
export IMG_VERSION = 0.27
export IMG_NGINX_VERSION = 2.3
# limpia todo
all: imagen clean install
imagen:
cd ../; make
install:
-kubectl create -f namespace.yaml
-kubectl create -f reg-secret.yaml
-kubectl create -f env-prod-configmap.yaml
-kubectl create -f env-prod-db-configmap.yaml
-kubectl create -f pv-local-jugaralpadel.yaml
-kubectl create -f jugaralpadel-prod-persistentvolumeclaim.yaml
-kubectl create -f static-volume-persistentvolumeclaim.yaml
-kubectl create -f postgres-data-persistentvolumeclaim.yaml
-kubectl create -f db-deployment.yaml
-kubectl create -f db-service.yaml
-envsubst < jugaralpadel-deployment.yaml |kubectl create -f -
-envsubst < nginx-deployment.yaml |kubectl create -f -
-kubectl create -f nginx-service.yaml
clean:
-envsubst < nginx-deployment.yaml |kubectl delete -f -
-kubectl delete -f nginx-service.yaml
-envsubst < jugaralpadel-deployment.yaml |kubectl delete -f -
-kubectl delete -f db-deployment.yaml
-kubectl delete -f db-service.yaml
-kubectl delete -f env-prod-configmap.yaml
-kubectl delete -f env-prod-db-configmap.yaml
-kubectl delete -f postgres-data-persistentvolumeclaim.yaml
-kubectl delete -f static-volume-persistentvolumeclaim.yaml
-kubectl delete -f jugaralpadel-prod-persistentvolumeclaim.yaml
-kubectl delete -f pv-local-jugaralpadel.yaml
-kubectl delete -f reg-secret.yaml
-kubectl delete -f namespace.yaml
nginx:
cd ../nginx; make
verimg:
docker run -it ${REGISTRY}/jugaralpadel-${ARQUITECTURA}:${IMG_VERSION} bash
backup:
kubectl --kubeconfig /home/creylopez/.kube/config -n jugaralpadel exec -ti deployment.apps/db -- /usr/lib/postgresql/15/bin/pg_dump --username=creylopez --dbname=jugaralpadel > jugaralpadel-$(IMG_VERSION).sql

+ 1
- 1
Gitea/creaTodo.sh View File

@ -1,2 +1,2 @@
kubectl create -f pv-local-mysql-gitea.yaml
kubectl create -f pv-local-pg-gitea.yaml
kubectl create -k ./

+ 52
- 0
Gitea/db-deployment.yaml View File

@ -0,0 +1,52 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.34.0 (cbf2835db)
labels:
io.kompose.service: db
name: db
namespace: gitea-repo
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: db
strategy:
type: Recreate
template:
metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.34.0 (cbf2835db)
labels:
io.kompose.service: db
spec:
containers:
- env:
- name: POSTGRES_DB
valueFrom:
configMapKeyRef:
key: POSTGRES_DB
name: env-prod-db
- name: POSTGRES_PASSWORD
valueFrom:
configMapKeyRef:
key: POSTGRES_PASSWORD
name: env-prod-db
- name: POSTGRES_USER
valueFrom:
configMapKeyRef:
key: POSTGRES_USER
name: env-prod-db
image: postgres:15
name: db
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: postgres-data
restartPolicy: Always
volumes:
- name: postgres-data
persistentVolumeClaim:
claimName: postgres-data

+ 17
- 0
Gitea/db-service.yaml View File

@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.34.0 (cbf2835db)
labels:
io.kompose.service: db
name: db
namespace: gitea-repo
spec:
ports:
- name: "5432"
port: 5432
targetPort: 5432
selector:
io.kompose.service: db

+ 1
- 0
Gitea/entraPsql.sh View File

@ -0,0 +1 @@
kubectl -n gitea-repo exec -ti deployment.apps/db -- psql --username=creylopez --dbname=gitea

+ 11
- 0
Gitea/env-prod-db-configmap.yaml View File

@ -0,0 +1,11 @@
apiVersion: v1
data:
POSTGRES_DB: gitea
POSTGRES_PASSWORD: Dsa-0213
POSTGRES_USER: creylopez
kind: ConfigMap
metadata:
labels:
io.kompose.service: db-env-prod-db
name: env-prod-db
namespace: gitea-repo

+ 5
- 5
Gitea/kustomization.yaml View File

@ -1,5 +1,5 @@
secretGenerator:
- name: mysqlgitea-pass
- name: sqlgitea-pass
namespace: gitea-repo
literals:
- password=Dsa-0213
@ -7,10 +7,10 @@ secretGenerator:
- db_passwd=Dsa-0213
resources:
- reg-secret.yaml
- mysql-deployment-gitea.yaml
- php-myadmin-gitea-deployment.yaml
- env-prod-db-configmap.yaml
- postgres-data-persistentvolumeclaim.yaml
- db-deployment.yaml
- db-service.yaml
- 010-deployment.yaml
- 020-volumes.yaml
- 030-network.yaml
- nginx-deployment.yaml
- nginx-service.yaml

+ 0
- 73
Gitea/mysql-deployment-gitea.yaml View File

@ -1,73 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: gitea-mysql
namespace: gitea-repo
labels:
app: gitea
spec:
type: NodePort
ports:
- name: mysql
port: 3306
nodePort: 30782
targetPort: mysql
selector:
app: gitea
tier: mysql
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-gitea-pv-claim
namespace: gitea-repo
labels:
app: gitea
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: gitea-mysql
namespace: gitea-repo
labels:
app: gitea
spec:
selector:
matchLabels:
app: gitea
tier: mysql
strategy:
type: Recreate
template:
metadata:
labels:
app: gitea
tier: mysql
spec:
containers:
- image: mariadb:latest
name: mysql
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysqlgitea-pass
key: password
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
imagePullSecrets:
- name: reg-cred-secret
volumes:
- name: mysql-persistent-storage
persistentVolumeClaim:
claimName: mysql-gitea-pv-claim

+ 1
- 1
Gitea/paraTodo.sh View File

@ -1,2 +1,2 @@
kubectl delete -k ./
kubectl delete -f pv-local-mysql-gitea.yaml
kubectl delete -f pv-local-pg-gitea.yaml

+ 0
- 57
Gitea/php-myadmin-gitea-deployment.yaml View File

@ -1,57 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: phpmyadmin-gitea
namespace: gitea-repo
labels:
app: gitea
spec:
selector:
app: gitea
tier: phpmyadmin
type: NodePort
ports:
- name: phpadmin
port: 80
nodePort: 30781
targetPort: phpmyadm
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: phpmyadmin-gitea
namespace: gitea-repo
labels:
app: gitea
spec:
selector:
matchLabels:
app: gitea
tier: phpmyadmin
strategy:
type: Recreate
template:
metadata:
labels:
app: gitea
tier: phpmyadmin
spec:
containers:
- name: phpmyadmin
image: phpmyadmin
ports:
- containerPort: 80
name: phpmyadm
env:
- name: PMA_HOST
value: gitea-mysql
- name: PMA_PORT
value: "3306"
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysqlgitea-pass
key: password
imagePullSecrets:
- name: reg-cred-secret

+ 13
- 0
Gitea/postgres-data-persistentvolumeclaim.yaml View File

@ -0,0 +1,13 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
io.kompose.service: postgres-data
name: postgres-data
namespace: gitea-repo
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi

Gitea/pv-local-mysql-gitea.yaml → Gitea/pv-local-pg-gitea.yaml View File

@ -8,4 +8,4 @@ spec:
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/Externo/gitea/gitea-db"
path: "/mnt/Externo/gitea/pg"

Loading…
Cancel
Save