diff --git a/JugarAlPadel/K8S/Makefile.local b/JugarAlPadel/K8S/Makefile.local index ecb44d6..0ba9fb4 100644 --- a/JugarAlPadel/K8S/Makefile.local +++ b/JugarAlPadel/K8S/Makefile.local @@ -2,7 +2,7 @@ export ARQUITECTURA := $(shell lscpu |grep itectur | tr -d ' '| cut -f2 -d':') export REGISTRY=localhost:30500 #export REGISTRY=registry.reymota.es -export IMG_VERSION = 0.50 +export IMG_VERSION = 0.52 export IMG_NGINX_VERSION = 2.4 # limpia todo @@ -52,3 +52,7 @@ nginx: 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 > /tmp/jugaralpadel-$(IMG_VERSION).sql + diff --git a/JugarAlPadel/gestion_reservas/eventos/views.py b/JugarAlPadel/gestion_reservas/eventos/views.py index 8c353e7..46fed45 100644 --- a/JugarAlPadel/gestion_reservas/eventos/views.py +++ b/JugarAlPadel/gestion_reservas/eventos/views.py @@ -8,7 +8,8 @@ from django.template.loader import render_to_string from .models import Evento, Reserva, ListaEspera from .forms import ListaEsperaForm, EventoForm -import random +# import random + @login_required def reservar_evento(request, evento_id): @@ -48,7 +49,6 @@ def reservar_evento(request, evento_id): # n es un numero aleatorio entre 2 y el total de plazas # si es así, y ya hay añadir a dos participantes. - messages.success(request, f'Reserva realizada para el evento {evento.nombre}.') diff --git a/ReyMotaAppsDj/K8S/Makefile.local b/ReyMotaAppsDj/K8S/Makefile.local new file mode 100644 index 0000000..e48254c --- /dev/null +++ b/ReyMotaAppsDj/K8S/Makefile.local @@ -0,0 +1,54 @@ +export ARQUITECTURA := $(shell lscpu |grep itectur | tr -d ' '| cut -f2 -d':') +export REGISTRY=localhost:30500 +#export REGISTRY=registry.reymota.es + +export IMG_VERSION = 0.18 +export IMG_NGINX_VERSION = 1.0 + +# 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-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 < 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 < reymota-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 reymota-prod-persistentvolumeclaim.yaml + -kubectl delete -f pv-local-reymota.yaml + -kubectl delete -f reg-secret.yaml + -kubectl delete -f namespace.yaml + +nginx: + cd ../nginx; make + +verimg: + docker run -it ${REGISTRY}/reymota-${ARQUITECTURA}:${IMG_VERSION} bash diff --git a/ReyMotaAppsDj/K8S/env-prod-configmap.yaml b/ReyMotaAppsDj/K8S/env-prod-configmap.yaml index 3c5a9ea..541f93e 100644 --- a/ReyMotaAppsDj/K8S/env-prod-configmap.yaml +++ b/ReyMotaAppsDj/K8S/env-prod-configmap.yaml @@ -1,8 +1,8 @@ apiVersion: v1 data: DEBUG: "True" - DJANGO_ALLOWED_HOSTS: "reymota.es k8s-server localhost 127.0.0.1 [::1]" - CSRF_TRUSTED_ORIGINS: "https://reymota.es" + DJANGO_ALLOWED_HOSTS: "reymota.es vmcluster k8s-server localhost 127.0.0.1 [::1]" + CSRF_TRUSTED_ORIGINS: "https://reymota.es http://vmcluster" SECRET_KEY: change_me SQL_DATABASE: reymota SQL_ENGINE: django.db.backends.postgresql