Browse Source

Cambio nginx a miweb y paso a Externo

main
Celestino Rey 2 years ago
parent
commit
b9ba8baca5
17 changed files with 196 additions and 6 deletions
  1. +2
    -0
      HelmCharts/miweb-chart/templates/miweb-deployment.yaml
  2. +1
    -1
      HelmCharts/miweb-chart/templates/pv-local-nginx.yaml
  3. +2
    -1
      HelmCharts/miweb-chart/templates/pvc-nginx.yaml
  4. +2
    -0
      shells/borraAntiguos
  5. +23
    -0
      shells/copyDBK8S
  6. +27
    -0
      shells/copyDrupalDB
  7. +24
    -0
      shells/copyGogsDB
  8. +23
    -0
      shells/copyKanboardDB
  9. +24
    -0
      shells/copyMediawikiDB
  10. +0
    -0
      shells/detectadMal
  11. +56
    -0
      shells/estadoPis
  12. +1
    -0
      shells/guardarestic.sh
  13. +1
    -0
      shells/mientra.sh
  14. +1
    -0
      shells/miraRestic.sh
  15. +5
    -0
      shells/muestraPuertos.sh
  16. BIN
      shells/noip2
  17. +4
    -4
      shells/syncNC2LaCie

+ 2
- 0
HelmCharts/miweb-chart/templates/miweb-deployment.yaml View File

@ -2,6 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: miweb
namespace: miweb
spec:
type: NodePort
ports:
@ -16,6 +17,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: miweb
namespace: miweb
labels:
app: miweb
spec:


Nginx/pv-local-nginx.yaml → HelmCharts/miweb-chart/templates/pv-local-nginx.yaml View File

@ -8,4 +8,4 @@ spec:
accessModes:
- ReadWriteMany
hostPath:
path: "/mnt/cluster/nginx"
path: "/mnt/Externo/nginx"

Nginx/pvc-nginx.yaml → HelmCharts/miweb-chart/templates/pvc-nginx.yaml View File

@ -1,7 +1,8 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nginx-pv-claim
name: miweb-pv-claim
namespace: miweb
labels:
app: nginx
spec:

+ 2
- 0
shells/borraAntiguos View File

@ -0,0 +1,2 @@
mysql -u crey -pRey-1176 estadopi -e "delete from estado where fecha < NOW() - INTERVAL 1 WEEK;"
mysql -u crey -pRey-1176 estadopi -e "delete from memoria where fecha < NOW() - INTERVAL 1 WEEK;"

+ 23
- 0
shells/copyDBK8S View File

@ -0,0 +1,23 @@
# 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_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 -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

+ 27
- 0
shells/copyDrupalDB View File

@ -0,0 +1,27 @@
# 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_drupal
new_name=$file_name-$today.sql
echo "Backup file name: " "$new_name"
sudo kubectl --kubeconfig /home/creylopez/.kube/config -n drupal exec `sudo kubectl --kubeconfig /home/creylopez/.kube/config get pod -n drupal | grep mysql | cut -f1 -d' '` -- /usr/bin/mysqldump -u root --password=Dsa-0213 drupaldb > $new_name
message="Backup stored "$today
zip $new_name.zip $new_name
sudo -u creylopez echo "Copia terminada" | mail -s "Drupal backup finished" "creylopez@yahoo.es" -A $new_name.zip
sudo rm $new_name*

+ 24
- 0
shells/copyGogsDB 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
file_name=$BACKUP_FOLDER/bkup_gogs
new_name=$file_name-$today.sql
echo "Backup file name: " "$new_name"
#sudo docker exec `sudo docker container ls | grep mysql_gogs | cut -f1 -d' '` /usr/bin/mysqldump -u root --password=Dsa-0213 gogs > $new_name
sudo kubectl --kubeconfig /home/creylopez/.kube/config exec `kubectl --kubeconfig /home/creylopez/.kube/config get pod -n gogs|grep mysql|cut -f1 -d' '` -n gogs -- /usr/bin/mysqldump -u root --password=Dsa-0213 gogs > $new_name
message="Backup stored "$today
sudo -u creylopez cat $new_name | mail -s "Gogs backup finished" "creylopez@yahoo.es"
sudo rm $new_name

+ 23
- 0
shells/copyKanboardDB View File

@ -0,0 +1,23 @@
# 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_kanboard
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 kanboard|grep mysql|cut -f1 -d' '` -n kanboard -- /usr/bin/mysqldump -u root --password=Dsa-0213 kanboard > $new_name
message="Backup stored "$today
sudo -u creylopez cat $new_name | mail -s "Kanboard backup finished" "creylopez@yahoo.es"
sudo rm $new_name

+ 24
- 0
shells/copyMediawikiDB 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
file_name=$BACKUP_FOLDER/bkup_mediawiki
new_name=$file_name-$today.sql
echo "Backup file name: " "$new_name"
#sudo docker exec `sudo docker container ls | grep mysql_mediawiki | cut -f1 -d' '` /usr/bin/mysqldump -u root --password=Dsa-0213 mediawiki > $new_name
sudo kubectl --kubeconfig /home/creylopez/.kube/config exec `kubectl --kubeconfig /home/creylopez/.kube/config get pod -n mediawiki|grep mysql|cut -f1 -d' '` -n mediawiki -- /usr/bin/mysqldump -u root --password=Dsa-0213 mediawiki > $new_name
message="Backup stored "$today
sudo -u creylopez cat $new_name | mail -s "Mediawiki backup finished" "creylopez@yahoo.es"
sudo rm $new_name

detectadMal → shells/detectadMal View File


+ 56
- 0
shells/estadoPis View File

@ -0,0 +1,56 @@
# ssh crey@k8s-maestro "cat /sys/class/thermal/thermal_zone0/temp"
# Shell script: estado.sh
# Autor: Celestino Rey
# Los remotos
for i in k8s-maestro k8s-currante-01 k8s-currante-02
do
cpu=$(ssh crey@$i "cat /sys/class/thermal/thermal_zone0/temp")
equipo=$i
tempcpu=$((cpu/1000))
memtotal=$(ssh crey@$i "egrep 'MemTotal' /proc/meminfo |cut -c17-25")
memfree=$(ssh crey@$i "egrep 'MemFree' /proc/meminfo |cut -c17-25")
memavailable=$(ssh crey@$i "egrep 'MemAvailable' /proc/meminfo |cut -c17-25")
echo "------------------------------"
echo "Temp.CPU => $tempcpu'C"
echo "Equipo => $equipo"
echo "Memoria Total => $memtotal"
echo "Memoria libre => $memfree"
echo "Memoria disponible => $memavailable"
echo "------------------------------"
mysql -u crey -pRey-1176 estadopi -e "insert into estado (tempcpu,fecha,equipo) values($tempcpu,NOW(),'$equipo');"
mysql -u crey -pRey-1176 estadopi -e "insert into memoria (memtotal,memfree,memav,fecha,equipo) values($memtotal,$memfree,$memavailable,NOW(),'$equipo');"
done
# El local
cpu=$(cat /sys/class/thermal/thermal_zone0/temp)
equipo=$(hostname)
tempcpu=$((cpu/1000))
memtotal=$(egrep 'MemTotal' /proc/meminfo |cut -c17-25)
memfree=$(egrep 'MemFree' /proc/meminfo |cut -c17-25)
memavalilable=$(egrep 'MemAvalilable' /proc/meminfo |cut -c17-25)
echo "------------------------------"
echo "Temp.CPU => $tempcpu'C"
echo "Equipo => $equipo"
echo "Memoria Total => $memtotal"
echo "Memoria libre => $memfree"
echo "Memoria disponible => $memavailable"
echo "------------------------------"
mysql -u crey -pRey-1176 estadopi -e "insert into estado (tempcpu,fecha,equipo) values($tempcpu,NOW(),'$equipo');"
mysql -u crey -pRey-1176 estadopi -e "insert into memoria (memtotal,memfree,memav,fecha,equipo) values($memtotal,$memfree,$memavailable,NOW(),'$equipo');"
# el disco externo
espaciototal=$(df |grep discoexterno |cut -c19-28)
espaciousado=$(df |grep discoexterno |cut -c29-36)
espaciolibre=$(df |grep discoexterno |cut -c39-48)
libre=$(($espaciolibre/1000000))
echo "------------------------------"
echo "Espacio total => $espaciototal"
echo "Espacio usado => $espaciousado"
echo "Espacio libre => $espaciolibre/$libre Gb"
echo "------------------------------"
mysql -u crey -pRey-1176 estadopi -e "insert into discoexterno (espaciototal,espaciousado,espaciolibre,fecha) values($espaciototal,$espaciousado,$libre,NOW());"

+ 1
- 0
shells/guardarestic.sh View File

@ -0,0 +1 @@
sudo restic -r /mnt/Family/restic-repo backup /mnt/cluster/ -p /home/creylopez/.restic

+ 1
- 0
shells/mientra.sh View File

@ -0,0 +1 @@
kubectl exec -ti deployment.apps/nginx-php-dev -- /bin/bash

+ 1
- 0
shells/miraRestic.sh View File

@ -0,0 +1 @@
sudo restic -r /mnt/Family/restic-repo snapshots -p /home/creylopez/.restic

+ 5
- 0
shells/muestraPuertos.sh View File

@ -0,0 +1,5 @@
kubectl get svc --all-namespaces |grep NodePort
while read -r line
do
echo "$line" | cut -c1-15
done

BIN
shells/noip2 View File


NextCloud/syncNC2LaCie → shells/syncNC2LaCie View File

@ -2,7 +2,7 @@ comienzo=$(date "+%Y_%m_%d-%H_%M_%S")
SINCRONIZANDO=/tmp/sincronizando
LOG=/tmp/resultadosync.log
ORIGEN=/mnt/cluster
ORIGEN=/mnt/Externo
DESTINO=/mnt/LaCie/BeeLink
DESTINOext=/mnt/Externo/Cluster
@ -13,11 +13,11 @@ if [ ! -f "$SINCRONIZANDO" ]
then
touch $SINCRONIZANDO
echo "Empieza sincronización..." >> $LOG
for i in fireflyiii nextcloud nginx reevolution wordpress
for i in fireflyiii nextcloud nginx mattermost hammond gogs navidrome mediawiki mealie kanboard wordpress registry vaultwarden
do
echo "Guardando '$i'..." >> $LOG
# sudo rsync -avh $ORIGEN/$i $DESTINO --delete >> $LOG
sudo rsync -avh $ORIGEN/$i $DESTINOext --delete >> $LOG
sudo rsync -avh $ORIGEN/$i $DESTINO --delete >> $LOG
#sudo rsync -avh $ORIGEN/$i $DESTINOext --delete >> $LOG
done
final=$(date "+%Y_%m_%d-%H_%M_%S")
echo "$final - Fin de sincronizacion con LaCie" >> $LOG

Loading…
Cancel
Save