From 66380bd5d19979e9bcbcf031f14bfac01169e2be Mon Sep 17 00:00:00 2001 From: Celestino Rey Date: Mon, 7 Oct 2024 07:36:49 +0000 Subject: [PATCH 1/3] =?UTF-8?q?Incluyo=20opci=C3=B3n=20cambio=20contrase?= =?UTF-8?q?=C3=B1a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JugarAlPadel/K8S/Makefile | 6 +++--- JugarAlPadel/K8S/env-prod-configmap.yaml | 4 ++-- .../gestion_reservas/templates/eventos/lista_eventos.html | 2 +- .../gestion_reservas/templates/registration/login.html | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/JugarAlPadel/K8S/Makefile b/JugarAlPadel/K8S/Makefile index 0f94e96..d24af26 100644 --- a/JugarAlPadel/K8S/Makefile +++ b/JugarAlPadel/K8S/Makefile @@ -1,8 +1,8 @@ export ARQUITECTURA := $(shell lscpu |grep itectur | tr -d ' '| cut -f2 -d':') -#export REGISTRY=localhost:5000 -export REGISTRY=registry.reymota.es +export REGISTRY=localhost:5000 +#export REGISTRY=registry.reymota.es -export IMG_VERSION = 0.17 +export IMG_VERSION = 0.19 export IMG_NGINX_VERSION = 2.3 # limpia todo diff --git a/JugarAlPadel/K8S/env-prod-configmap.yaml b/JugarAlPadel/K8S/env-prod-configmap.yaml index 971a524..55ef783 100644 --- a/JugarAlPadel/K8S/env-prod-configmap.yaml +++ b/JugarAlPadel/K8S/env-prod-configmap.yaml @@ -1,8 +1,8 @@ apiVersion: v1 data: DEBUG: "False" - DJANGO_ALLOWED_HOSTS: "jugaralpadel.ddns.net reymota.es k8s-server localhost 127.0.0.1 [::1]" - CSRF_TRUSTED_ORIGINS: "https://jugaralpadel.ddns.net" + DJANGO_ALLOWED_HOSTS: "jugaralpadel.ddns.net vmcluster reymota.es k8s-server localhost 127.0.0.1 [::1]" + CSRF_TRUSTED_ORIGINS: "https://jugaralpadel.ddns.net http://vmcluster" SECRET_KEY: change_me SQL_DATABASE: jugaralpadel SQL_ENGINE: django.db.backends.postgresql diff --git a/JugarAlPadel/gestion_reservas/templates/eventos/lista_eventos.html b/JugarAlPadel/gestion_reservas/templates/eventos/lista_eventos.html index e79233c..d5ed08d 100644 --- a/JugarAlPadel/gestion_reservas/templates/eventos/lista_eventos.html +++ b/JugarAlPadel/gestion_reservas/templates/eventos/lista_eventos.html @@ -67,7 +67,7 @@ {% else %} -

No se han encontrado eventos para este autor

+

No se han encontrado eventos.

{% endif %} diff --git a/JugarAlPadel/gestion_reservas/templates/registration/login.html b/JugarAlPadel/gestion_reservas/templates/registration/login.html index 870b4b6..b518ba3 100644 --- a/JugarAlPadel/gestion_reservas/templates/registration/login.html +++ b/JugarAlPadel/gestion_reservas/templates/registration/login.html @@ -56,6 +56,7 @@ {% translate 'Forgotten your password or username?' %} {% endif %} +

Si quieres cambiar la contraseña pincha aquí

From 47590cbf0f5ea9806012aa93c391a62a7f8e7080 Mon Sep 17 00:00:00 2001 From: Celestino Rey Date: Mon, 7 Oct 2024 16:33:38 +0200 Subject: [PATCH 2/3] Creo makefile para local y shell para crear directorios --- JugarAlPadel/K8S/Makefile | 4 +-- JugarAlPadel/K8S/Makefile.local | 51 +++++++++++++++++++++++++++++++++ JugarAlPadel/K8S/creaDirs.sh | 5 ++++ 3 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 JugarAlPadel/K8S/Makefile.local create mode 100644 JugarAlPadel/K8S/creaDirs.sh diff --git a/JugarAlPadel/K8S/Makefile b/JugarAlPadel/K8S/Makefile index d24af26..225a580 100644 --- a/JugarAlPadel/K8S/Makefile +++ b/JugarAlPadel/K8S/Makefile @@ -1,6 +1,6 @@ export ARQUITECTURA := $(shell lscpu |grep itectur | tr -d ' '| cut -f2 -d':') -export REGISTRY=localhost:5000 -#export REGISTRY=registry.reymota.es +#export REGISTRY=localhost:5000 +export REGISTRY=registry.reymota.es export IMG_VERSION = 0.19 export IMG_NGINX_VERSION = 2.3 diff --git a/JugarAlPadel/K8S/Makefile.local b/JugarAlPadel/K8S/Makefile.local new file mode 100644 index 0000000..d24af26 --- /dev/null +++ b/JugarAlPadel/K8S/Makefile.local @@ -0,0 +1,51 @@ +export ARQUITECTURA := $(shell lscpu |grep itectur | tr -d ' '| cut -f2 -d':') +export REGISTRY=localhost:5000 +#export REGISTRY=registry.reymota.es + +export IMG_VERSION = 0.19 +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 diff --git a/JugarAlPadel/K8S/creaDirs.sh b/JugarAlPadel/K8S/creaDirs.sh new file mode 100644 index 0000000..fe06597 --- /dev/null +++ b/JugarAlPadel/K8S/creaDirs.sh @@ -0,0 +1,5 @@ +sudo mkdir -p /mnt/Externo/jugaralpadel/media +sudo mkdir -p /mnt/Externo/jugaralpadel/migrations/eventos +sudo mkdir -p /mnt/Externo/jugaralpadel/migrations/reymotausers +sudo mkdir -p /mnt/Externo/jugaralpadel/static +sudo mkdir -p /mnt/Externo/jugaralpadel/pg From 73e9b7abc00d4fff0b5cce5b28275fa64fa1cc51 Mon Sep 17 00:00:00 2001 From: Celestino Rey Date: Tue, 8 Oct 2024 15:19:16 +0200 Subject: [PATCH 3/3] =?UTF-8?q?Empezando=20con=20el=20recordatorio=20de=20?= =?UTF-8?q?contrase=C3=B1a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JugarAlPadel/K8S/Makefile.local | 4 +- JugarAlPadel/README.md | 5 +- .../gestion_reservas/templates/base.html | 17 +++++ .../templates/registration/login.html | 2 - .../registration/password_change_done.html | 20 +++++ .../registration/password_change_form.html | 75 +++++++++++++++++++ 6 files changed, 116 insertions(+), 7 deletions(-) create mode 100644 JugarAlPadel/gestion_reservas/templates/registration/password_change_done.html create mode 100644 JugarAlPadel/gestion_reservas/templates/registration/password_change_form.html diff --git a/JugarAlPadel/K8S/Makefile.local b/JugarAlPadel/K8S/Makefile.local index d24af26..60fe2ef 100644 --- a/JugarAlPadel/K8S/Makefile.local +++ b/JugarAlPadel/K8S/Makefile.local @@ -2,8 +2,8 @@ export ARQUITECTURA := $(shell lscpu |grep itectur | tr -d ' '| cut -f2 -d':') export REGISTRY=localhost:5000 #export REGISTRY=registry.reymota.es -export IMG_VERSION = 0.19 -export IMG_NGINX_VERSION = 2.3 +export IMG_VERSION = 0.21 +export IMG_NGINX_VERSION = 2.4 # limpia todo all: imagen clean install diff --git a/JugarAlPadel/README.md b/JugarAlPadel/README.md index 445a7b2..012a447 100644 --- a/JugarAlPadel/README.md +++ b/JugarAlPadel/README.md @@ -2,7 +2,7 @@ Desde el directorio K8S ejecutar make (esto hace todo: la imagen, para los pods y los lanza otra vez) -La primera vez, hay que entrar en el pod de vehículos con 'entra.sh' y +La primera vez, hay que entrar en el pod con 'entra.sh' y python manage.py createsuperuser @@ -41,9 +41,8 @@ https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/ -## Cambiar la secuencia de lo sid +## Cambiar la secuencia de los id ALTER SEQUENCE tablename_id_seq RESTART WITH nn; esto se hace cuando restauro un volcado de la bd sobre una instalación nueva. Si hay índices ya creados, hay que reinciar a partir del último. - diff --git a/JugarAlPadel/gestion_reservas/templates/base.html b/JugarAlPadel/gestion_reservas/templates/base.html index 6b908c3..89e6091 100644 --- a/JugarAlPadel/gestion_reservas/templates/base.html +++ b/JugarAlPadel/gestion_reservas/templates/base.html @@ -34,6 +34,23 @@
  • {{ user.nombre }}
  • +
  • +
    + {% csrf_token %} + +
    +
  • {% csrf_token %} diff --git a/JugarAlPadel/gestion_reservas/templates/registration/login.html b/JugarAlPadel/gestion_reservas/templates/registration/login.html index b518ba3..01d9f8f 100644 --- a/JugarAlPadel/gestion_reservas/templates/registration/login.html +++ b/JugarAlPadel/gestion_reservas/templates/registration/login.html @@ -56,7 +56,6 @@ {% translate 'Forgotten your password or username?' %}
  • {% endif %} -

    Si quieres cambiar la contraseña pincha aquí

    @@ -85,6 +84,5 @@
    - diff --git a/JugarAlPadel/gestion_reservas/templates/registration/password_change_done.html b/JugarAlPadel/gestion_reservas/templates/registration/password_change_done.html new file mode 100644 index 0000000..784ab37 --- /dev/null +++ b/JugarAlPadel/gestion_reservas/templates/registration/password_change_done.html @@ -0,0 +1,20 @@ +{% extends "admin/base_site.html" %} +{% load i18n %} +{% block userlinks %} + {% url 'django-admindocs-docroot' as docsroot %}{% if docsroot %}{% translate 'Documentation' %} / {% endif %}{% translate 'Change password' %} / + + {% csrf_token %} + + + {% include "admin/color_theme_toggle.html" %} +{% endblock %} +{% block breadcrumbs %} + +{% endblock %} + +{% block content %} +

    {% translate 'Your password was changed.' %}

    +{% endblock %} diff --git a/JugarAlPadel/gestion_reservas/templates/registration/password_change_form.html b/JugarAlPadel/gestion_reservas/templates/registration/password_change_form.html new file mode 100644 index 0000000..c6a9484 --- /dev/null +++ b/JugarAlPadel/gestion_reservas/templates/registration/password_change_form.html @@ -0,0 +1,75 @@ +{% load i18n static %} + +{% include "_head.html" %} + + +
    +
    +
    +
    + {% include "_branding.html" %} +

    Cambio de contraseña

    + + {% if form.errors and not form.non_field_errors %} +

    + {% blocktranslate count counter=form.errors.items|length %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktranslate %} +

    + {% endif %} + + +
    + +
    + {% if form.new_password2.help_text %} +
    {{ form.new_password2.help_text|safe }}
    + {% endif %} +
    + +
    + +
    + + +
    +
    +
    + + + +