Browse Source

Añado make para backup

politica
Celestino Rey 1 year ago
parent
commit
82423d05b2
4 changed files with 63 additions and 5 deletions
  1. +5
    -1
      JugarAlPadel/K8S/Makefile.local
  2. +2
    -2
      JugarAlPadel/gestion_reservas/eventos/views.py
  3. +54
    -0
      ReyMotaAppsDj/K8S/Makefile.local
  4. +2
    -2
      ReyMotaAppsDj/K8S/env-prod-configmap.yaml

+ 5
- 1
JugarAlPadel/K8S/Makefile.local View File

@ -2,7 +2,7 @@ export ARQUITECTURA := $(shell lscpu |grep itectur | tr -d ' '| cut -f2 -d':')
export REGISTRY=localhost:30500 export REGISTRY=localhost:30500
#export REGISTRY=registry.reymota.es #export REGISTRY=registry.reymota.es
export IMG_VERSION = 0.50
export IMG_VERSION = 0.52
export IMG_NGINX_VERSION = 2.4 export IMG_NGINX_VERSION = 2.4
# limpia todo # limpia todo
@ -52,3 +52,7 @@ nginx:
verimg: verimg:
docker run -it ${REGISTRY}/jugaralpadel-${ARQUITECTURA}:${IMG_VERSION} bash 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

+ 2
- 2
JugarAlPadel/gestion_reservas/eventos/views.py View File

@ -8,7 +8,8 @@ from django.template.loader import render_to_string
from .models import Evento, Reserva, ListaEspera from .models import Evento, Reserva, ListaEspera
from .forms import ListaEsperaForm, EventoForm from .forms import ListaEsperaForm, EventoForm
import random
# import random
@login_required @login_required
def reservar_evento(request, evento_id): 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 # n es un numero aleatorio entre 2 y el total de plazas
# si es así, y ya hay añadir a dos participantes. # si es así, y ya hay añadir a dos participantes.
messages.success(request, messages.success(request,
f'Reserva realizada para el evento {evento.nombre}.') f'Reserva realizada para el evento {evento.nombre}.')


+ 54
- 0
ReyMotaAppsDj/K8S/Makefile.local View File

@ -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

+ 2
- 2
ReyMotaAppsDj/K8S/env-prod-configmap.yaml View File

@ -1,8 +1,8 @@
apiVersion: v1 apiVersion: v1
data: data:
DEBUG: "True" 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 SECRET_KEY: change_me
SQL_DATABASE: reymota SQL_DATABASE: reymota
SQL_ENGINE: django.db.backends.postgresql SQL_ENGINE: django.db.backends.postgresql


Loading…
Cancel
Save