diff --git a/JugarAlPadel/K8S/Makefile b/JugarAlPadel/K8S/Makefile index 7faef73..2095f79 100644 --- a/JugarAlPadel/K8S/Makefile +++ b/JugarAlPadel/K8S/Makefile @@ -1,8 +1,7 @@ export ARQUITECTURA := $(shell lscpu |grep itectur | tr -d ' '| cut -f2 -d':') -#export REGISTRY=localhost:5000 export REGISTRY=registry.reymota.es -export IMG_VERSION = 0.70.14 +export IMG_VERSION = 0.70.21 export IMG_NGINX_VERSION = 2.3 # limpia todo diff --git a/JugarAlPadel/K8S/db-deployment.yaml b/JugarAlPadel/K8S/db-deployment.yaml index eba7712..140946a 100644 --- a/JugarAlPadel/K8S/db-deployment.yaml +++ b/JugarAlPadel/K8S/db-deployment.yaml @@ -5,14 +5,14 @@ metadata: kompose.cmd: kompose convert kompose.version: 1.34.0 (cbf2835db) labels: - io.kompose.service: db - name: db + io.kompose.service: postgresql + name: postgresql namespace: jugaralpadel spec: replicas: 1 selector: matchLabels: - io.kompose.service: db + io.kompose.service: postgresql strategy: type: Recreate template: @@ -21,7 +21,7 @@ spec: kompose.cmd: kompose convert kompose.version: 1.34.0 (cbf2835db) labels: - io.kompose.service: db + io.kompose.service: postgresql spec: containers: - env: @@ -41,7 +41,7 @@ spec: key: POSTGRES_USER name: env-prod-db image: postgres:15 - name: db + name: postgresql volumeMounts: - mountPath: /var/lib/postgresql/data name: postgres-data diff --git a/JugarAlPadel/K8S/db-service.yaml b/JugarAlPadel/K8S/db-service.yaml index 335e238..01920b1 100644 --- a/JugarAlPadel/K8S/db-service.yaml +++ b/JugarAlPadel/K8S/db-service.yaml @@ -5,8 +5,8 @@ metadata: kompose.cmd: kompose convert kompose.version: 1.34.0 (cbf2835db) labels: - io.kompose.service: db - name: db + io.kompose.service: postgresql + name: postgresql namespace: jugaralpadel spec: ports: @@ -14,4 +14,4 @@ spec: port: 5432 targetPort: 5432 selector: - io.kompose.service: db + io.kompose.service: postgresql diff --git a/JugarAlPadel/K8S/env-prod-configmap.yaml b/JugarAlPadel/K8S/env-prod-configmap.yaml index f5def33..f89a569 100644 --- a/JugarAlPadel/K8S/env-prod-configmap.yaml +++ b/JugarAlPadel/K8S/env-prod-configmap.yaml @@ -1,17 +1,6 @@ apiVersion: v1 data: DEBUG: "False" - ENTORNO: "Producción" - DJANGO_ALLOWED_HOSTS: "jugaralpadel.rancher.reymota.lab jugaralpadel.es jugaralpadel.ddns.net vmcluster k8s-server localhost 127.0.0.1 [::1]" - CSRF_TRUSTED_ORIGINS: "http://jugaralpadel.rancher.reymota.lab https://jugaralpadel.rancher.reymota.lab https://jugaralpadel.es http://vmcluster" - SECRET_KEY: change_me - SQL_DATABASE: jugaralpadel - SQL_ENGINE: django.db.backends.postgresql - SQL_HOST: db - SQL_PASSWORD: Dsa-0213 - SQL_PORT: "5432" - SQL_USER: creylopez - DATABASE: postgres kind: ConfigMap metadata: labels: diff --git a/JugarAlPadel/K8S/jugaralpadel-deployment.yaml b/JugarAlPadel/K8S/jugaralpadel-deployment.yaml index 4c2bb17..473425c 100644 --- a/JugarAlPadel/K8S/jugaralpadel-deployment.yaml +++ b/JugarAlPadel/K8S/jugaralpadel-deployment.yaml @@ -41,66 +41,11 @@ spec: env: - name: VERSION value: "$IMG_VERSION" - - name: ENVIRONMENT - valueFrom: - configMapKeyRef: - key: ENTORNO - name: env-prod - name: DEBUG valueFrom: configMapKeyRef: key: DEBUG name: env-prod - - name: DJANGO_ALLOWED_HOSTS - valueFrom: - configMapKeyRef: - key: DJANGO_ALLOWED_HOSTS - name: env-prod - - name: CSRF_TRUSTED_ORIGINS - valueFrom: - configMapKeyRef: - key: CSRF_TRUSTED_ORIGINS - name: env-prod - - name: SECRET_KEY - valueFrom: - configMapKeyRef: - key: SECRET_KEY - name: env-prod - - name: DATABASE - valueFrom: - configMapKeyRef: - key: DATABASE - name: env-prod - - name: SQL_HOST - valueFrom: - configMapKeyRef: - key: SQL_HOST - name: env-prod - - name: SQL_PORT - valueFrom: - configMapKeyRef: - key: SQL_PORT - name: env-prod - - name: SQL_ENGINE - valueFrom: - configMapKeyRef: - key: SQL_ENGINE - name: env-prod - - name: SQL_DATABASE - valueFrom: - configMapKeyRef: - key: SQL_DATABASE - name: env-prod - - name: SQL_USER - valueFrom: - configMapKeyRef: - key: SQL_USER - name: env-prod - - name: SQL_PASSWORD - valueFrom: - configMapKeyRef: - key: SQL_PASSWORD - name: env-prod ports: - containerPort: 8000 protocol: TCP diff --git a/JugarAlPadel/K8S/postgres-topolvm-pvc.yaml b/JugarAlPadel/K8S/postgres-topolvm-pvc.yaml deleted file mode 100644 index 8acdff2..0000000 --- a/JugarAlPadel/K8S/postgres-topolvm-pvc.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - labels: - io.kompose.service: postgres-data - name: postgres-data - namespace: jugaralpadel -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi - storageClassName: topolvm-provisioner - diff --git a/JugarAlPadel/gestion_reservas/eventos/views.py b/JugarAlPadel/gestion_reservas/eventos/views.py index 0468eff..c97ffb6 100644 --- a/JugarAlPadel/gestion_reservas/eventos/views.py +++ b/JugarAlPadel/gestion_reservas/eventos/views.py @@ -335,11 +335,12 @@ def enviar_correo_inscritos(request, evento_id): firma = "\n\n\nSaludos, \n\nPádel entre amigos" mensaje = f"{mensaje_usuario}{firma}" - mensaje_comun = (asunto, mensaje, settings.DEFAULT_FROM_EMAIL, destinatarios) - mensaje_final = [mensaje_comun] + mensajes = [ + (asunto, mensaje, settings.DEFAULT_FROM_EMAIL, [email]) for email in destinatarios + ] try: - send_mass_mail(mensaje_final, fail_silently=False) + send_mass_mail(mensajes, fail_silently=False) except BadHeaderError: return HttpResponse('Encabezado inválido encontrado.') except SMTPException as e: diff --git a/JugarAlPadel/gestion_reservas/gestion_reservas/context_processors.py b/JugarAlPadel/gestion_reservas/gestion_reservas/context_processors.py new file mode 100644 index 0000000..eece58c --- /dev/null +++ b/JugarAlPadel/gestion_reservas/gestion_reservas/context_processors.py @@ -0,0 +1,7 @@ +from django.conf import settings + + +def app_version(request): + return { + 'APP_VERSION': settings.APP_VERSION + } diff --git a/JugarAlPadel/gestion_reservas/gestion_reservas/settings.py b/JugarAlPadel/gestion_reservas/gestion_reservas/settings.py index 898ef8c..7cc413e 100644 --- a/JugarAlPadel/gestion_reservas/gestion_reservas/settings.py +++ b/JugarAlPadel/gestion_reservas/gestion_reservas/settings.py @@ -14,6 +14,7 @@ from pathlib import Path import os import logging +APP_VERSION = "11.0.2" # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -28,8 +29,8 @@ SECRET_KEY = 'hey' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = os.environ["DEBUG"] == 'True' -ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS").split(" ") - +ALLOWED_HOSTS = [".ocp-cluster.reymota.lab", "jugaralpadel.rancher.reymota.lab", "jugaralpadel.es"] +CSRF_TRUSTED_ORIGINS = ["https://*.ocp-cluster.reymota.lab", "http://jugaralpadel.rancher.reymota.lab", " https://jugaralpadel.rancher.reymota.lab", " https://jugaralpadel.es"] # Application definition @@ -71,6 +72,7 @@ TEMPLATES = [ 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', + 'gestion_reservas.context_processors.app_version', ], 'libraries': { 'filtros_de_entorno': 'gestion_reservas.templatetags.filtros_de_entorno', @@ -87,16 +89,15 @@ WSGI_APPLICATION = 'gestion_reservas.wsgi.application' DATABASES = { "default": { - "ENGINE": os.environ.get("SQL_ENGINE", "django.db.backends.sqlite3"), - "NAME": os.environ.get("SQL_DATABASE", BASE_DIR / "db.sqlite3"), - "USER": os.environ.get("SQL_USER", "user"), - "PASSWORD": os.environ.get("SQL_PASSWORD", "password"), - "HOST": os.environ.get("SQL_HOST", "localhost"), - "PORT": os.environ.get("SQL_PORT", "5432"), + "ENGINE": "django.db.backends.postgresql", + "NAME": "jugaralpadel", + "USER": "creylopez", + "PASSWORD": "Dsa-0213", + "HOST": "postgresql", + "PORT": "5432", } } - # Password validation # https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators @@ -152,11 +153,6 @@ AUTH_USER_MODEL = "reymotausers.ReyMotaUser" MEDIA_ROOT = BASE_DIR / "mediafiles" MEDIA_URL = '/media/' -if DEBUG is False: - CSRF_TRUSTED_ORIGINS = os.environ.get("CSRF_TRUSTED_ORIGINS").split(" ") - -CSRF_TRUSTED_ORIGINS = os.environ.get("CSRF_TRUSTED_ORIGINS").split(" ") - # Configuración de correo con Gmail if DEBUG is True: EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' diff --git a/JugarAlPadel/gestion_reservas/templates/_branding.html b/JugarAlPadel/gestion_reservas/templates/_branding.html index 382697c..8e17661 100644 --- a/JugarAlPadel/gestion_reservas/templates/_branding.html +++ b/JugarAlPadel/gestion_reservas/templates/_branding.html @@ -3,12 +3,6 @@ {% load filtros_de_entorno %}
- +