diff --git a/EasyAppointments/creaTodo.sh b/EasyAppointments/creaTodo.sh new file mode 100755 index 00000000..f474d214 --- /dev/null +++ b/EasyAppointments/creaTodo.sh @@ -0,0 +1,4 @@ +kubectl create -f pv-local-mysql.yaml +kubectl create -f pv-local-easy.yaml +kubectl create -k ./ +watch kubectl get all -n easy diff --git a/EasyAppointments/easy-deployment.yaml b/EasyAppointments/easy-deployment.yaml new file mode 100755 index 00000000..c633560b --- /dev/null +++ b/EasyAppointments/easy-deployment.yaml @@ -0,0 +1,78 @@ +apiVersion: v1 +kind: Service +metadata: + name: easy + namespace: easy + labels: + app: easy +spec: + type: NodePort + ports: + - port: 80 + nodePort: 30788 + targetPort: easy + selector: + app: easy + tier: frontend +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: easy-pv-claim + namespace: easy + labels: + app: easy +spec: + accessModes: + - ReadWriteOnce + storageClassName: "" + resources: + requests: + storage: 10Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: easy + namespace: easy + labels: + app: easy +spec: + selector: + matchLabels: + app: easy + tier: frontend + strategy: + type: Recreate + template: + metadata: + labels: + app: easy + tier: frontend + spec: + containers: + - image: vanhack/easyappointments + name: easy + env: + - name: WORDPRESS_DB_HOST + value: easy-mysql + - name: WORDPRESS_DB_PASSWORD + valueFrom: + secretKeyRef: + name: mysqleasy-pass + key: password + - name: WORDPRESS_DB_USER + valueFrom: + secretKeyRef: + name: mysqleasy-pass + key: db_user + ports: + - containerPort: 80 + name: easy + volumeMounts: + - name: easy-persistent-storage + mountPath: /var/www/html + volumes: + - name: easy-persistent-storage + persistentVolumeClaim: + claimName: easy-pv-claim diff --git a/EasyAppointments/easy-namespace.yaml b/EasyAppointments/easy-namespace.yaml new file mode 100644 index 00000000..8284ede3 --- /dev/null +++ b/EasyAppointments/easy-namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: easy diff --git a/EasyAppointments/entra.sh b/EasyAppointments/entra.sh new file mode 100755 index 00000000..a66784c8 --- /dev/null +++ b/EasyAppointments/entra.sh @@ -0,0 +1 @@ +kubectl exec -ti deployment.apps/easy -n easy -- /bin/bash diff --git a/EasyAppointments/kustomization.yaml b/EasyAppointments/kustomization.yaml new file mode 100644 index 00000000..b2313ee7 --- /dev/null +++ b/EasyAppointments/kustomization.yaml @@ -0,0 +1,12 @@ +secretGenerator: +- name: mysqleasy-pass + namespace: easy + literals: + - password=Dsa-0213 + - db_user=root + - db_passwd=Dsa-0213 +resources: + - easy-namespace.yaml + - mysql-deployment.yaml + - easy-deployment.yaml + - php-deployment.yaml diff --git a/EasyAppointments/mysql-deployment.yaml b/EasyAppointments/mysql-deployment.yaml new file mode 100755 index 00000000..aea39323 --- /dev/null +++ b/EasyAppointments/mysql-deployment.yaml @@ -0,0 +1,68 @@ +apiVersion: v1 +kind: Service +metadata: + name: easy-mysql + namespace: easy + labels: + app: easy +spec: + ports: + - port: 3306 + selector: + app: easy + tier: mysql + clusterIP: None +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: mysql-wp-pv-claim + namespace: easy + labels: + app: easy +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 20Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: easy-mysql + namespace: easy + labels: + app: easy +spec: + selector: + matchLabels: + app: easy + tier: mysql + strategy: + type: Recreate + template: + metadata: + labels: + app: easy + tier: mysql + spec: + containers: + - image: mariadb + name: mysql + env: + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: mysqleasy-pass + key: password + ports: + - containerPort: 3306 + name: mysql + volumeMounts: + - name: mysql-persistent-storage + mountPath: /var/lib/mysql + volumes: + - name: mysql-persistent-storage + persistentVolumeClaim: + claimName: mysql-wp-pv-claim diff --git a/EasyAppointments/paraTodo.sh b/EasyAppointments/paraTodo.sh new file mode 100755 index 00000000..49793d8c --- /dev/null +++ b/EasyAppointments/paraTodo.sh @@ -0,0 +1,3 @@ +kubectl delete -k ./ +kubectl delete -f pv-local-mysql.yaml +kubectl delete -f pv-local-easy.yaml diff --git a/EasyAppointments/php-deployment.yaml b/EasyAppointments/php-deployment.yaml new file mode 100644 index 00000000..a4ce4dcd --- /dev/null +++ b/EasyAppointments/php-deployment.yaml @@ -0,0 +1,54 @@ +apiVersion: v1 +kind: Service +metadata: + name: phpmyadmin-easy + namespace: easy + labels: + app: easy +spec: + selector: + app: easy + tier: phpmyadmin + type: NodePort + ports: + - name: phpadmin + port: 80 + nodePort: 30790 + targetPort: phpmyadm +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: phpmyadmin-easy + namespace: easy + labels: + app: easy +spec: + selector: + matchLabels: + app: easy + tier: phpmyadmin + strategy: + type: Recreate + template: + metadata: + labels: + app: easy + tier: phpmyadmin + spec: + containers: + - name: phpmyadmin + image: phpmyadmin + ports: + - containerPort: 80 + name: phpmyadm + env: + - name: PMA_HOST + value: easy-mysql + - name: PMA_PORT + value: "3306" + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: mysqleasy-pass + key: password diff --git a/EasyAppointments/pv-local-easy.yaml b/EasyAppointments/pv-local-easy.yaml new file mode 100644 index 00000000..bceba668 --- /dev/null +++ b/EasyAppointments/pv-local-easy.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: easy-folder +spec: + capacity: + storage: 10Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/cluster/easy/easy-folder" + diff --git a/EasyAppointments/pv-local-mysql.yaml b/EasyAppointments/pv-local-mysql.yaml new file mode 100644 index 00000000..da027890 --- /dev/null +++ b/EasyAppointments/pv-local-mysql.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: easy-data +spec: + capacity: + storage: 20Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/cluster/easy/easy-db" diff --git a/Firefly/k8s-cluster/copyDBK8S b/Firefly/k8s-cluster/copyDBK8S index 764548e3..0eda5ae8 100755 --- a/Firefly/k8s-cluster/copyDBK8S +++ b/Firefly/k8s-cluster/copyDBK8S @@ -14,8 +14,10 @@ file_name=$BACKUP_FOLDER/bkup_fireflyiii new_name=$file_name-$today.sql echo "Backup file name: " "$new_name" -docker exec `docker container ls | grep mysql_firefly | cut -f1 -d' '` /usr/bin/mysqldump -u root --password=Rey-1176 fireflyiii > $new_name +sudo docker exec `sudo docker container ls | grep mysql_firefly | cut -f1 -d' '` /usr/bin/mysqldump -u root --password=Rey-1176 fireflyiii > $new_name message="Backup stored "$today -sudo -u creylopez echo $message | mail -s "FireflyIII backup finished" "creylopez@yahoo.es" -A $new_name +sudo -u creylopez cat $new_name | mail -s "FireflyIII backup finished" "creylopez@yahoo.es" + +sudo rm $new_name diff --git a/NextCloud/syncNC2LaCie b/NextCloud/syncNC2LaCie index 89805c05..72aa95cb 100755 --- a/NextCloud/syncNC2LaCie +++ b/NextCloud/syncNC2LaCie @@ -22,7 +22,7 @@ then final=$(date "+%Y_%m_%d-%H_%M_%S") echo "$final - Fin de sincronizacion con LaCie" >> $LOG mensaje="Copia de seguridad del disco duro realizada en la LaCie CloudBox y en disco externo" - sudo -u creylopez echo $mensaje | mail -s "Copia realizada" "celestino.rey@gmail.com" -A $LOG + sudo -u creylopez cat $LOG | mail -s "Copia realizada" "celestino.rey@gmail.com" rm $SINCRONIZANDO else echo "ya se está sincronizando"