Browse Source

Cambio en las shells de backups

main
Celestino Rey 1 month ago
parent
commit
577ac7fe48
6 changed files with 108 additions and 13 deletions
  1. +1
    -1
      Forgejo/010-deployment.yaml
  2. +24
    -0
      HelmCharts/firefly-chart/templates/copyDBK8S
  3. +24
    -0
      shells/copyFinanzas
  4. +45
    -0
      shells/copyReyMotaApps
  5. +12
    -12
      shells/guardaJson.sh
  6. +2
    -0
      terminaNS.sh

+ 1
- 1
Forgejo/010-deployment.yaml View File

@ -29,7 +29,7 @@ spec:
spec: spec:
containers: containers:
- name: forgejo - name: forgejo
image: codeberg.org/forgejo/forgejo:10
image: codeberg.org/forgejo/forgejo:12.0.4
ports: ports:
- containerPort: 3000 - containerPort: 3000
name: forgejo name: forgejo


+ 24
- 0
HelmCharts/firefly-chart/templates/copyDBK8S View File

@ -0,0 +1,24 @@
# Backup date
today=$(date "+%Y_%m_%d-%H_%M_%S")
echo "Current date: $today"
# build up filename
# destination folder (change to your own needs)
#BACKUP_FOLDER=/tmp
BACKUP_FOLDER=/mnt/Externo/copiasFF
file_name=$BACKUP_FOLDER/bkup_fireflyiii
new_name=$file_name-$today.sql
echo "Backup file name: " "$new_name"
sudo kubectl --kubeconfig /home/creylopez/.kube/config exec `kubectl --kubeconfig /home/creylopez/.kube/config get pod -n firefly|grep iii-mysql|cut -f1 -d' '` -n firefly -- /usr/bin/mysqldump --column-statistics=0 -u root --password=Rey-1176 fireflyiii > $new_name
message="Backup stored "$today
sudo -u creylopez cat $new_name | mail -s "FireflyIII backup finished" "creylopez@yahoo.es"
#sudo rm $new_name

+ 24
- 0
shells/copyFinanzas View File

@ -0,0 +1,24 @@
# Backup date
today=$(date "+%Y_%m_%d-%H_%M_%S")
echo "Current date: $today"
# build up filename
# destination folder (change to your own needs)
BACKUP_FOLDER=/tmp
new_name=$BACKUP_FOLDER/Finanzas-$today.json
ping -c 4 finanzas.reymota.es
#curl https://finanzas.reymota.es/api/datos/ > $new_name
curl http://finanzas-finanzas.apps.ocp-cluster.reymota.lab/api/datos/ > $new_name
message="Backup stored "$today
sudo -u creylopez echo "Finanzas backup adjunto" |mail -s "Backup de Finanzas" creylopez@yahoo.es -A $new_name
sudo rm $new_name

+ 45
- 0
shells/copyReyMotaApps View File

@ -0,0 +1,45 @@
# Backup date
today=$(date "+%Y_%m_%d-%H_%M_%S")
echo "Current date: $today"
# build up filename
# destination folder (change to your own needs)
BACKUP_FOLDER=/tmp
file_name=$BACKUP_FOLDER/bkup_reymota
new_name=$file_name-$today.sql
artistas=$BACKUP_FOLDER/artistas-$today.json
albumes=$BACKUP_FOLDER/albumes-$today.json
canciones=$BACKUP_FOLDER/canciones-$today.json
vehiculos=$BACKUP_FOLDER/vehiculos-$today.json
repostajes=$BACKUP_FOLDER/repostajes-$today.json
curl http://reymota-reymota.apps.ocp-cluster.reymota.lab/lyrics/api/artistas/ > $artistas
curl http://reymota-reymota.apps.ocp-cluster.reymota.lab/lyrics/api/albumes/ > $albumes
curl http://reymota-reymota.apps.ocp-cluster.reymota.lab/lyrics/api/canciones/ > $canciones
curl http://reymota-reymota.apps.ocp-cluster.reymota.lab/repostajes/api/vehiculos/ > $vehiculos
curl http://reymota-reymota.apps.ocp-cluster.reymota.lab/repostajes/api/repostajes/ > $repostajes
zip $BACKUP_FOLDER/reymota-$today.zip $artistas $albumes $canciones $vehiculos $repostajes
#kubectl --kubeconfig /home/creylopez/.kube/kubeconfig-okd -n reymota exec -ti deployment.apps/db -- /usr/lib/postgresql/15/bin/pg_dump --username=creylopez --dbname=reymota > $new_name
message="Backup stored "$today
#sudo -u creylopez cat $new_name | mail -s "ReyMotaApps backup finished" "creylopez@yahoo.es"
sudo -u creylopez echo "Reymota backup adjunto" |mail -s "Backup de Reymota" creylopez@yahoo.es -A $BACKUP_FOLDER/reymota-$today.zip
#sudo rm $new_name
rm $BACKUP_FOLDER/artista*
rm $BACKUP_FOLDER/albumes*
rm $BACKUP_FOLDER/canciones*
rm $BACKUP_FOLDER/vehiculos*
rm $BACKUP_FOLDER/repostajes*

+ 12
- 12
shells/guardaJson.sh View File

@ -8,12 +8,12 @@ BACKUP_FOLDER=/tmp
# Jugaralpadel # Jugaralpadel
curl https://jugaralpadel.es/usuarios/api/usuarios/ > $BACKUP_FOLDER/jugar-usuarios.json
curl https://jugaralpadel.es/eventos/api/eventos/ > $BACKUP_FOLDER/jugar-eventos.json
curl https://jugaralpadel.es/eventos/api/reservas/ > $BACKUP_FOLDER/jugar-reservas.json
curl https://jugaralpadel.es/eventos/api/listaespera/ > $BACKUP_FOLDER/jugar-listaespera.json
curl https://jugaralpadel.es/eventos/api/noticias/ > $BACKUP_FOLDER/jugar-noticias.json
curl https://jugaralpadel.es/api/ayuda/ > $BACKUP_FOLDER/jugar-ayuda.json
curl http://jugaralpadel-jugaralpadel.apps.ocp-cluster.reymota.lab/usuarios/api/usuarios/ > $BACKUP_FOLDER/jugar-usuarios.json
curl http://jugaralpadel-jugaralpadel.apps.ocp-cluster.reymota.lab/eventos/api/eventos/ > $BACKUP_FOLDER/jugar-eventos.json
curl http://jugaralpadel-jugaralpadel.apps.ocp-cluster.reymota.lab/eventos/api/reservas/ > $BACKUP_FOLDER/jugar-reservas.json
curl http://jugaralpadel-jugaralpadel.apps.ocp-cluster.reymota.lab/eventos/api/listaespera/ > $BACKUP_FOLDER/jugar-listaespera.json
curl http://jugaralpadel-jugaralpadel.apps.ocp-cluster.reymota.lab/eventos/api/noticias/ > $BACKUP_FOLDER/jugar-noticias.json
curl http://jugaralpadel-jugaralpadel.apps.ocp-cluster.reymota.lab/api/ayuda/ > $BACKUP_FOLDER/jugar-ayuda.json
tar cvfz $BACKUP_FOLDER/jugaralpadel-json.tar.gz $BACKUP_FOLDER/*.json tar cvfz $BACKUP_FOLDER/jugaralpadel-json.tar.gz $BACKUP_FOLDER/*.json
sudo rm $BACKUP_FOLDER/*.json sudo rm $BACKUP_FOLDER/*.json
@ -24,14 +24,14 @@ sudo rm $BACKUP_FOLDER/jugaralpadel-json.tar.gz
# Reymota # Reymota
curl https://reymota.es/usuarios/api/usuarios/ > $BACKUP_FOLDER/reymota-usuarios.json
curl http://reymota-reymota.apps.ocp-cluster.reymota.lab/usuarios/api/usuarios/ > $BACKUP_FOLDER/reymota-usuarios.json
curl https://reymota.es/lyrics/api/artistas/ > $BACKUP_FOLDER/reymota-artistas.json
curl https://reymota.es/lyrics/api/albumes/ > $BACKUP_FOLDER/reymota-albumes.json
curl https://reymota.es/lyrics/api/canciones/ > $BACKUP_FOLDER/reymota-canciones.json
curl http://reymota-reymota.apps.ocp-cluster.reymota.lab/lyrics/api/artistas/ > $BACKUP_FOLDER/reymota-artistas.json
curl http://reymota-reymota.apps.ocp-cluster.reymota.lab/lyrics/api/albumes/ > $BACKUP_FOLDER/reymota-albumes.json
curl http://reymota-reymota.apps.ocp-cluster.reymota.lab/lyrics/api/canciones/ > $BACKUP_FOLDER/reymota-canciones.json
curl https://reymota.es/repostajes/api/vehiculos/ > $BACKUP_FOLDER/reymota-vehiculos.json
curl https://reymota.es/repostajes/api/repostajes/ > $BACKUP_FOLDER/reymota-repostajes.json
curl http://reymota-reymota.apps.ocp-cluster.reymota.lab/repostajes/api/vehiculos/ > $BACKUP_FOLDER/reymota-vehiculos.json
curl http://reymota-reymota.apps.ocp-cluster.reymota.lab/repostajes/api/repostajes/ > $BACKUP_FOLDER/reymota-repostajes.json
tar cvfz $BACKUP_FOLDER/reymota-json.tar.gz $BACKUP_FOLDER/*.json tar cvfz $BACKUP_FOLDER/reymota-json.tar.gz $BACKUP_FOLDER/*.json
sudo rm $BACKUP_FOLDER/*.json sudo rm $BACKUP_FOLDER/*.json


+ 2
- 0
terminaNS.sh View File

@ -0,0 +1,2 @@
NS=`kubectl get ns |grep Terminating | awk 'NR==1 {print $1}'` && kubectl get namespace "$NS" -o json | tr -d "\n" | sed "s/\"finalizers\": \[[^]]\+\]/\"finalizers\": []/" | kubectl replace --raw /api/v1/namespaces/$NS/finalize -f -

Loading…
Cancel
Save