From 4062ba34b96a826a4cdc13e2cc9a42bd51dffe2f Mon Sep 17 00:00:00 2001 From: Celestino Rey Date: Fri, 13 Sep 2024 08:41:58 +0200 Subject: [PATCH] Cambio de nombre de ficheros --- ReyMotaAppsDj/Dockerfile | 2 +- ReyMotaAppsDj/K8S/Makefile | 12 +++--- ReyMotaAppsDj/K8S/db-deployment.yaml | 2 +- ReyMotaAppsDj/K8S/db-service.yaml | 2 +- ReyMotaAppsDj/K8S/entra.sh | 2 +- ReyMotaAppsDj/K8S/entraPsql.sh | 2 +- ReyMotaAppsDj/K8S/env-prod-configmap.yaml | 6 +-- ReyMotaAppsDj/K8S/env-prod-db-configmap.yaml | 4 +- ReyMotaAppsDj/K8S/namespace.yaml | 2 +- ReyMotaAppsDj/K8S/nginx-deployment.yaml | 14 +++---- ReyMotaAppsDj/K8S/nginx-service.yaml | 2 +- .../postgres-data-persistentvolumeclaim.yaml | 2 +- ...al-finanzas.yaml => pv-local-reymota.yaml} | 32 +++++++-------- ReyMotaAppsDj/K8S/reg-secret.yaml | 2 +- ...eployment.yaml => reymota-deployment.yaml} | 40 +++++++++---------- ...> reymota-prod-persistentvolumeclaim.yaml} | 12 +++--- .../static-volume-persistentvolumeclaim.yaml | 2 +- ReyMotaAppsDj/README.md | 2 +- ReyMotaAppsDj/nginx/Makefile | 4 +- ReyMotaAppsDj/nginx/nginx.conf | 10 ++--- 20 files changed, 78 insertions(+), 78 deletions(-) rename ReyMotaAppsDj/K8S/{pv-local-finanzas.yaml => pv-local-reymota.yaml} (56%) rename ReyMotaAppsDj/K8S/{finanzas-deployment.yaml => reymota-deployment.yaml} (79%) rename ReyMotaAppsDj/K8S/{finanzas-prod-persistentvolumeclaim.yaml => reymota-prod-persistentvolumeclaim.yaml} (68%) diff --git a/ReyMotaAppsDj/Dockerfile b/ReyMotaAppsDj/Dockerfile index 4656433..ff3a425 100644 --- a/ReyMotaAppsDj/Dockerfile +++ b/ReyMotaAppsDj/Dockerfile @@ -67,7 +67,7 @@ COPY . $APP_HOME # change to the app user #USER app -WORKDIR $APP_HOME/vehiculos +WORKDIR $APP_HOME/reymota # run entrypoint.sh ENTRYPOINT ["/app/entrypoint.sh"] diff --git a/ReyMotaAppsDj/K8S/Makefile b/ReyMotaAppsDj/K8S/Makefile index 39e4805..b64dd1a 100644 --- a/ReyMotaAppsDj/K8S/Makefile +++ b/ReyMotaAppsDj/K8S/Makefile @@ -16,22 +16,22 @@ install: -kubectl create -f env-prod-configmap.yaml -kubectl create -f env-prod-db-configmap.yaml - -kubectl create -f pv-local-finanzas.yaml - -kubectl create -f finanzas-prod-persistentvolumeclaim.yaml + -kubectl create -f pv-local-reymota.yaml + -kubectl create -f reymota-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 < finanzas-deployment.yaml |kubectl create -f - + -envsubst < reymota-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 < finanzas-deployment.yaml |kubectl delete -f - + -envsubst < reymota-deployment.yaml |kubectl delete -f - -kubectl delete -f db-deployment.yaml -kubectl delete -f db-service.yaml @@ -41,8 +41,8 @@ clean: -kubectl delete -f postgres-data-persistentvolumeclaim.yaml -kubectl delete -f static-volume-persistentvolumeclaim.yaml - -kubectl delete -f finanzas-prod-persistentvolumeclaim.yaml - -kubectl delete -f pv-local-finanzas.yaml + -kubectl delete -f reymota-prod-persistentvolumeclaim.yaml + -kubectl delete -f pv-local-reymota.yaml -kubectl delete -f reg-secret.yaml -kubectl delete -f namespace.yaml diff --git a/ReyMotaAppsDj/K8S/db-deployment.yaml b/ReyMotaAppsDj/K8S/db-deployment.yaml index 11617bc..e80c2bd 100644 --- a/ReyMotaAppsDj/K8S/db-deployment.yaml +++ b/ReyMotaAppsDj/K8S/db-deployment.yaml @@ -7,7 +7,7 @@ metadata: labels: io.kompose.service: db name: db - namespace: finanzas + namespace: reymota spec: replicas: 1 selector: diff --git a/ReyMotaAppsDj/K8S/db-service.yaml b/ReyMotaAppsDj/K8S/db-service.yaml index f94ba51..98e237d 100644 --- a/ReyMotaAppsDj/K8S/db-service.yaml +++ b/ReyMotaAppsDj/K8S/db-service.yaml @@ -7,7 +7,7 @@ metadata: labels: io.kompose.service: db name: db - namespace: finanzas + namespace: reymota spec: ports: - name: "5432" diff --git a/ReyMotaAppsDj/K8S/entra.sh b/ReyMotaAppsDj/K8S/entra.sh index 6a4806e..57091db 100644 --- a/ReyMotaAppsDj/K8S/entra.sh +++ b/ReyMotaAppsDj/K8S/entra.sh @@ -1 +1 @@ -kubectl -n finanzas exec -ti deployment.apps/finanzas -- /bin/bash +kubectl -n reymota exec -ti deployment.apps/reymota -- /bin/bash diff --git a/ReyMotaAppsDj/K8S/entraPsql.sh b/ReyMotaAppsDj/K8S/entraPsql.sh index 60221be..077b82f 100644 --- a/ReyMotaAppsDj/K8S/entraPsql.sh +++ b/ReyMotaAppsDj/K8S/entraPsql.sh @@ -1 +1 @@ -kubectl -n finanzas exec -ti deployment.apps/db -- psql --username=creylopez --dbname=finanzas +kubectl -n reymota exec -ti deployment.apps/db -- psql --username=creylopez --dbname=reymota diff --git a/ReyMotaAppsDj/K8S/env-prod-configmap.yaml b/ReyMotaAppsDj/K8S/env-prod-configmap.yaml index 9bd8cc4..3166f80 100644 --- a/ReyMotaAppsDj/K8S/env-prod-configmap.yaml +++ b/ReyMotaAppsDj/K8S/env-prod-configmap.yaml @@ -1,10 +1,10 @@ apiVersion: v1 data: DEBUG: "False" - DJANGO_ALLOWED_HOSTS: "finanzas.reymota.es k8s-server localhost 127.0.0.1 [::1]" - CSRF_TRUSTED_ORIGINS: "https://finanzas.reymota.es" + DJANGO_ALLOWED_HOSTS: "reymota.es k8s-server localhost 127.0.0.1 [::1]" + CSRF_TRUSTED_ORIGINS: "https://reymota.es" SECRET_KEY: change_me - SQL_DATABASE: finanzas + SQL_DATABASE: reymota SQL_ENGINE: django.db.backends.postgresql SQL_HOST: db SQL_PASSWORD: Dsa-0213 diff --git a/ReyMotaAppsDj/K8S/env-prod-db-configmap.yaml b/ReyMotaAppsDj/K8S/env-prod-db-configmap.yaml index fab0e3f..d871dce 100644 --- a/ReyMotaAppsDj/K8S/env-prod-db-configmap.yaml +++ b/ReyMotaAppsDj/K8S/env-prod-db-configmap.yaml @@ -1,6 +1,6 @@ apiVersion: v1 data: - POSTGRES_DB: finanzas + POSTGRES_DB: reymota POSTGRES_PASSWORD: Dsa-0213 POSTGRES_USER: creylopez kind: ConfigMap @@ -8,4 +8,4 @@ metadata: labels: io.kompose.service: db-env-prod-db name: env-prod-db - namespace: finanzas + namespace: reymota diff --git a/ReyMotaAppsDj/K8S/namespace.yaml b/ReyMotaAppsDj/K8S/namespace.yaml index aa8c1d2..775e161 100644 --- a/ReyMotaAppsDj/K8S/namespace.yaml +++ b/ReyMotaAppsDj/K8S/namespace.yaml @@ -4,4 +4,4 @@ apiVersion: v1 kind: Namespace metadata: - name: finanzas + name: reymota diff --git a/ReyMotaAppsDj/K8S/nginx-deployment.yaml b/ReyMotaAppsDj/K8S/nginx-deployment.yaml index 29818ce..358e2c6 100644 --- a/ReyMotaAppsDj/K8S/nginx-deployment.yaml +++ b/ReyMotaAppsDj/K8S/nginx-deployment.yaml @@ -7,7 +7,7 @@ metadata: labels: io.kompose.service: nginx name: nginx - namespace: finanzas + namespace: reymota spec: replicas: 1 selector: @@ -24,16 +24,16 @@ spec: io.kompose.service: nginx spec: containers: - - image: $REGISTRY/nginx-finanzas-$ARQUITECTURA:$IMG_NGINX_VERSION + - image: $REGISTRY/nginx-reymota-$ARQUITECTURA:$IMG_NGINX_VERSION name: nginx ports: - containerPort: 80 protocol: TCP volumeMounts: - - mountPath: /app/finanzas/staticfiles + - mountPath: /app/reymota/staticfiles name: static-volume - - mountPath: /app/finanzas/mediafiles - name: finanzas-media + - mountPath: /app/reymota/mediafiles + name: reymota-media imagePullSecrets: - name: myregistrykey restartPolicy: Always @@ -41,6 +41,6 @@ spec: - name: static-volume persistentVolumeClaim: claimName: static-volume - - name: finanzas-media + - name: reymota-media persistentVolumeClaim: - claimName: finanzas-media + claimName: reymota-media diff --git a/ReyMotaAppsDj/K8S/nginx-service.yaml b/ReyMotaAppsDj/K8S/nginx-service.yaml index 506b64f..8cfea42 100644 --- a/ReyMotaAppsDj/K8S/nginx-service.yaml +++ b/ReyMotaAppsDj/K8S/nginx-service.yaml @@ -7,7 +7,7 @@ metadata: labels: io.kompose.service: nginx name: nginx - namespace: finanzas + namespace: reymota spec: type: NodePort ports: diff --git a/ReyMotaAppsDj/K8S/postgres-data-persistentvolumeclaim.yaml b/ReyMotaAppsDj/K8S/postgres-data-persistentvolumeclaim.yaml index 1dfa473..6c51a1d 100644 --- a/ReyMotaAppsDj/K8S/postgres-data-persistentvolumeclaim.yaml +++ b/ReyMotaAppsDj/K8S/postgres-data-persistentvolumeclaim.yaml @@ -4,7 +4,7 @@ metadata: labels: io.kompose.service: postgres-data name: postgres-data - namespace: finanzas + namespace: reymota spec: accessModes: - ReadWriteOnce diff --git a/ReyMotaAppsDj/K8S/pv-local-finanzas.yaml b/ReyMotaAppsDj/K8S/pv-local-reymota.yaml similarity index 56% rename from ReyMotaAppsDj/K8S/pv-local-finanzas.yaml rename to ReyMotaAppsDj/K8S/pv-local-reymota.yaml index 75e7250..de513b7 100644 --- a/ReyMotaAppsDj/K8S/pv-local-finanzas.yaml +++ b/ReyMotaAppsDj/K8S/pv-local-reymota.yaml @@ -1,59 +1,59 @@ apiVersion: v1 kind: PersistentVolume metadata: - name: finanzas-media-folder - namespace: finanzas + name: reymota-media-folder + namespace: reymota labels: - app: finanzas + app: reymota spec: capacity: storage: 100Mi accessModes: - ReadWriteOnce hostPath: - path: "/mnt/Externo/finanzas/media" + path: "/mnt/Externo/reymota/media" --- apiVersion: v1 kind: PersistentVolume metadata: - name: finanzas-migrations-folder - namespace: finanzas + name: reymota-migrations-folder + namespace: reymota labels: - app: finanzas + app: reymota spec: capacity: storage: 50Mi accessModes: - ReadWriteOnce hostPath: - path: "/mnt/Externo/finanzas/migrations" + path: "/mnt/Externo/reymota/migrations" --- apiVersion: v1 kind: PersistentVolume metadata: - name: finanzas-static-folder - namespace: finanzas + name: reymota-static-folder + namespace: reymota labels: - app: finanzas + app: reymota spec: capacity: storage: 70Mi accessModes: - ReadWriteOnce hostPath: - path: "/mnt/Externo/finanzas/static" + path: "/mnt/Externo/reymota/static" --- apiVersion: v1 kind: PersistentVolume metadata: - name: finanzas-pg-folder - namespace: finanzas + name: reymota-pg-folder + namespace: reymota labels: - app: finanzas + app: reymota spec: capacity: storage: 200Mi accessModes: - ReadWriteOnce hostPath: - path: "/mnt/Externo/finanzas/pg" + path: "/mnt/Externo/reymota/pg" diff --git a/ReyMotaAppsDj/K8S/reg-secret.yaml b/ReyMotaAppsDj/K8S/reg-secret.yaml index bb31be8..87d0614 100644 --- a/ReyMotaAppsDj/K8S/reg-secret.yaml +++ b/ReyMotaAppsDj/K8S/reg-secret.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Secret metadata: name: myregistrykey - namespace: finanzas + namespace: reymota data: .dockerconfigjson: ewoJImF1dGhzIjogewoJCSJyZWdpc3RyeS5yZXltb3RhLmVzIjogewoJCQkiYXV0aCI6ICJZM0psZVd4dmNHVjZPbEpsZVMweE1UYzIiCgkJfQoJfQp9 type: kubernetes.io/dockerconfigjson diff --git a/ReyMotaAppsDj/K8S/finanzas-deployment.yaml b/ReyMotaAppsDj/K8S/reymota-deployment.yaml similarity index 79% rename from ReyMotaAppsDj/K8S/finanzas-deployment.yaml rename to ReyMotaAppsDj/K8S/reymota-deployment.yaml index 28ce892..99db711 100644 --- a/ReyMotaAppsDj/K8S/finanzas-deployment.yaml +++ b/ReyMotaAppsDj/K8S/reymota-deployment.yaml @@ -1,43 +1,43 @@ apiVersion: v1 kind: Service metadata: - name: finanzas - namespace: finanzas + name: reymota + namespace: reymota spec: ports: - name: "8000" port: 8000 targetPort: 8000 selector: - app: finanzas + app: reymota --- apiVersion: apps/v1 kind: Deployment metadata: - name: finanzas - namespace: finanzas + name: reymota + namespace: reymota labels: - app: finanzas + app: reymota spec: replicas: 1 selector: matchLabels: - app: finanzas + app: reymota strategy: type: Recreate template: metadata: labels: - app: finanzas + app: reymota spec: containers: - args: - gunicorn - - finanzas.wsgi:application + - reymota.wsgi:application - --bind - 0.0.0.0:8000 - name: finanzas - image: $REGISTRY/finanzas-$ARQUITECTURA:$IMG_VERSION + name: reymota + image: $REGISTRY/reymota-$ARQUITECTURA:$IMG_VERSION env: - name: VERSION value: "$IMG_VERSION" @@ -102,22 +102,22 @@ spec: - containerPort: 8000 protocol: TCP volumeMounts: - - mountPath: /app/finanzas/mediafiles - name: finanzas-media - - mountPath: /app/finanzas/repostajes/migrations - name: finanzas-migrations - - mountPath: /app/finanzas/staticfiles + - mountPath: /app/reymota/mediafiles + name: reymota-media + - mountPath: /app/reymota/repostajes/migrations + name: reymota-migrations + - mountPath: /app/reymota/staticfiles name: static-volume imagePullSecrets: - name: myregistrykey restartPolicy: Always volumes: - - name: finanzas-media + - name: reymota-media persistentVolumeClaim: - claimName: finanzas-media - - name: finanzas-migrations + claimName: reymota-media + - name: reymota-migrations persistentVolumeClaim: - claimName: finanzas-migrations + claimName: reymota-migrations - name: static-volume persistentVolumeClaim: claimName: static-volume diff --git a/ReyMotaAppsDj/K8S/finanzas-prod-persistentvolumeclaim.yaml b/ReyMotaAppsDj/K8S/reymota-prod-persistentvolumeclaim.yaml similarity index 68% rename from ReyMotaAppsDj/K8S/finanzas-prod-persistentvolumeclaim.yaml rename to ReyMotaAppsDj/K8S/reymota-prod-persistentvolumeclaim.yaml index ad2c059..ab0f958 100644 --- a/ReyMotaAppsDj/K8S/finanzas-prod-persistentvolumeclaim.yaml +++ b/ReyMotaAppsDj/K8S/reymota-prod-persistentvolumeclaim.yaml @@ -3,9 +3,9 @@ kind: PersistentVolumeClaim metadata: creationTimestamp: null labels: - io.kompose.service: finanzas-media - name: finanzas-media - namespace: finanzas + io.kompose.service: reymota-media + name: reymota-media + namespace: reymota spec: accessModes: - ReadWriteOnce @@ -19,9 +19,9 @@ kind: PersistentVolumeClaim metadata: creationTimestamp: null labels: - io.kompose.service: finanzas-migrations - name: finanzas-migrations - namespace: finanzas + io.kompose.service: reymota-migrations + name: reymota-migrations + namespace: reymota spec: accessModes: - ReadWriteOnce diff --git a/ReyMotaAppsDj/K8S/static-volume-persistentvolumeclaim.yaml b/ReyMotaAppsDj/K8S/static-volume-persistentvolumeclaim.yaml index e2b1a37..5eb01e2 100644 --- a/ReyMotaAppsDj/K8S/static-volume-persistentvolumeclaim.yaml +++ b/ReyMotaAppsDj/K8S/static-volume-persistentvolumeclaim.yaml @@ -4,7 +4,7 @@ metadata: labels: io.kompose.service: static-volume name: static-volume - namespace: finanzas + namespace: reymota spec: accessModes: - ReadWriteOnce diff --git a/ReyMotaAppsDj/README.md b/ReyMotaAppsDj/README.md index 921e2f5..f958b8a 100644 --- a/ReyMotaAppsDj/README.md +++ b/ReyMotaAppsDj/README.md @@ -17,7 +17,7 @@ Con la shell entraPsql.sh: \l para listar las BD -\c vehiculos para usar nuestra db +\c reymota para usar nuestra db \dt para ver las tablas # De dónde cogí ideas diff --git a/ReyMotaAppsDj/nginx/Makefile b/ReyMotaAppsDj/nginx/Makefile index 41d9314..fb1a26d 100644 --- a/ReyMotaAppsDj/nginx/Makefile +++ b/ReyMotaAppsDj/nginx/Makefile @@ -2,7 +2,7 @@ install: echo "Creando imagen con version '${IMG_NGINX_VERSION}' para la arquitectura '${ARQUITECTURA}' en el registry '${REGISTRY}'" - docker build --no-cache -t ${REGISTRY}/nginx-vehiculos-${ARQUITECTURA}:${IMG_NGINX_VERSION} . - docker push ${REGISTRY}/nginx-vehiculos-${ARQUITECTURA}:${IMG_NGINX_VERSION} + docker build --no-cache -t ${REGISTRY}/nginx-reymota-${ARQUITECTURA}:${IMG_NGINX_VERSION} . + docker push ${REGISTRY}/nginx-reymota-${ARQUITECTURA}:${IMG_NGINX_VERSION} diff --git a/ReyMotaAppsDj/nginx/nginx.conf b/ReyMotaAppsDj/nginx/nginx.conf index 2b05005..5316ea0 100644 --- a/ReyMotaAppsDj/nginx/nginx.conf +++ b/ReyMotaAppsDj/nginx/nginx.conf @@ -1,5 +1,5 @@ -upstream vehiculos { - server vehiculos:8000; +upstream reymota { + server reymota:8000; } server { @@ -7,7 +7,7 @@ server { listen 80; location / { - proxy_pass http://vehiculos; + proxy_pass http://reymota; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; @@ -15,11 +15,11 @@ server { } location /static/ { - alias /app/vehiculos/staticfiles/; + alias /app/reymota/staticfiles/; } location /media/ { - alias /app/vehiculos/mediafiles/; + alias /app/reymota/mediafiles/; } }