diff --git a/Appsmith/appsmith-deployment.yaml b/Appsmith/appsmith-deployment.yaml new file mode 100644 index 00000000..fe488048 --- /dev/null +++ b/Appsmith/appsmith-deployment.yaml @@ -0,0 +1,82 @@ +apiVersion: v1 +kind: Service +metadata: + name: appsmith + namespace: appsmith + labels: + app: appsmith +spec: + type: NodePort + ports: + - port: 80 + nodePort: 30798 + targetPort: appsmith + selector: + app: appsmith + tier: frontend +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: as-pv-claim + namespace: appsmith + labels: + app: appsmith +spec: + accessModes: + - ReadWriteOnce + storageClassName: "" + resources: + requests: + storage: 10Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: appsmith + namespace: appsmith + labels: + app: appsmith +spec: + selector: + matchLabels: + app: appsmith + tier: frontend + strategy: + type: Recreate + template: + metadata: + labels: + app: appsmith + tier: frontend + spec: + containers: + - image: index.docker.io/appsmith/appsmith-ce + name: appsmith + env: + - name: DB_TYPE + value: mysql + - name: DB_NAME + value: appsmith + - name: DB_HOST + value: appsmith-mysql + - name: DB_PASS + valueFrom: + secretKeyRef: + name: mysqlas-pass + key: password + - name: DB_USER + valueFrom: + secretKeyRef: + name: mysqlas-pass + key: db_user + ports: + - containerPort: 80 + name: appsmith + volumeMounts: + - name: appsmith-persistent-storage + mountPath: /var/www/html + volumes: + - name: appsmith-persistent-storage + persistentVolumeClaim: + claimName: as-pv-claim diff --git a/Appsmith/as-namespace.yaml b/Appsmith/as-namespace.yaml new file mode 100644 index 00000000..4794dd23 --- /dev/null +++ b/Appsmith/as-namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: appsmith diff --git a/Appsmith/copyMediawikiDB b/Appsmith/copyMediawikiDB new file mode 100755 index 00000000..eeac6347 --- /dev/null +++ b/Appsmith/copyMediawikiDB @@ -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 diff --git a/Appsmith/creaTodo.sh b/Appsmith/creaTodo.sh new file mode 100755 index 00000000..e9ea65f3 --- /dev/null +++ b/Appsmith/creaTodo.sh @@ -0,0 +1,4 @@ +kubectl create -f pv-local-mysql-as.yaml +kubectl create -f pv-local-appsmith.yaml +kubectl create -k ./ +watch kubectl get all -n appsmith diff --git a/Appsmith/docker-compose.yml b/Appsmith/docker-compose.yml new file mode 100644 index 00000000..8dbfe542 --- /dev/null +++ b/Appsmith/docker-compose.yml @@ -0,0 +1,23 @@ +version: "3" + +services: + appsmith: + image: index.docker.io/appsmith/appsmith-ce + container_name: appsmith + ports: + - "80:80" + - "443:443" + volumes: + - ./stacks:/appsmith-stacks + restart: unless-stopped + # # Uncomment the lines below to enable auto-update + # labels: + # com.centurylinklabs.watchtower.enable: "true" + + # auto_update: + # image: containrrr/watchtower:latest-dev + # volumes: + # - /var/run/docker.sock:/var/run/docker.sock + # # Update check interval in seconds. + # command: --schedule "0 0 * ? * *" --label-enable --cleanup + # restart: unless-stopped diff --git a/Appsmith/entra.sh b/Appsmith/entra.sh new file mode 100755 index 00000000..d521194b --- /dev/null +++ b/Appsmith/entra.sh @@ -0,0 +1 @@ +kubectl exec -ti deployment.apps/appsmith -n appsmith -- /bin/bash diff --git a/Appsmith/kustomization.yaml b/Appsmith/kustomization.yaml new file mode 100644 index 00000000..300afa9b --- /dev/null +++ b/Appsmith/kustomization.yaml @@ -0,0 +1,12 @@ +secretGenerator: +- name: mysqlas-pass + namespace: appsmith + literals: + - password=Dsa-0213 + - db_user=root + - db_passwd=Dsa-0213 +resources: + - as-namespace.yaml + - mysql-deployment-as.yaml + - appsmith-deployment.yaml + - php-myadmin-as-deployment.yaml diff --git a/Appsmith/mysql-deployment-as.yaml b/Appsmith/mysql-deployment-as.yaml new file mode 100644 index 00000000..404a83db --- /dev/null +++ b/Appsmith/mysql-deployment-as.yaml @@ -0,0 +1,71 @@ +apiVersion: v1 +kind: Service +metadata: + name: appsmith-mysql + namespace: appsmith + labels: + app: appsmith +spec: + type: NodePort + ports: + - name: mysql + port: 3306 + nodePort: 30781 + targetPort: mysql + selector: + app: appsmith + tier: mysql +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: mysql-as-pv-claim + namespace: appsmith + labels: + app: appsmith +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 20Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: appsmith-mysql + namespace: appsmith + labels: + app: appsmith +spec: + selector: + matchLabels: + app: appsmith + tier: mysql + strategy: + type: Recreate + template: + metadata: + labels: + app: appsmith + tier: mysql + spec: + containers: + - image: mariadb + name: mysql + env: + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: mysqlas-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-as-pv-claim diff --git a/Appsmith/paraTodo.sh b/Appsmith/paraTodo.sh new file mode 100755 index 00000000..afc5ef65 --- /dev/null +++ b/Appsmith/paraTodo.sh @@ -0,0 +1,3 @@ +kubectl delete -k ./ +kubectl delete -f pv-local-mysql-as.yaml +kubectl delete -f pv-local-appsmith.yaml diff --git a/Appsmith/php-myadmin-as-deployment.yaml b/Appsmith/php-myadmin-as-deployment.yaml new file mode 100644 index 00000000..55950065 --- /dev/null +++ b/Appsmith/php-myadmin-as-deployment.yaml @@ -0,0 +1,54 @@ +apiVersion: v1 +kind: Service +metadata: + name: phpmyadmin-appsmith + namespace: appsmith + labels: + app: appsmith +spec: + selector: + app: appsmith + tier: phpmyadmin + type: NodePort + ports: + - name: phpadmin + port: 80 + nodePort: 30780 + targetPort: phpmyadm +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: phpmyadmin-appsmith + namespace: appsmith + labels: + app: appsmith +spec: + selector: + matchLabels: + app: appsmith + tier: phpmyadmin + strategy: + type: Recreate + template: + metadata: + labels: + app: appsmith + tier: phpmyadmin + spec: + containers: + - name: phpmyadmin + image: phpmyadmin + ports: + - containerPort: 80 + name: phpmyadm + env: + - name: PMA_HOST + value: appsmith-mysql + - name: PMA_PORT + value: "3306" + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: mysqlas-pass + key: password diff --git a/Appsmith/pv-local-appsmith.yaml b/Appsmith/pv-local-appsmith.yaml new file mode 100644 index 00000000..e1c2b519 --- /dev/null +++ b/Appsmith/pv-local-appsmith.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: as-folder +spec: + capacity: + storage: 10Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/cluster/appsmith/appsmith" + diff --git a/Appsmith/pv-local-mysql-as.yaml b/Appsmith/pv-local-mysql-as.yaml new file mode 100644 index 00000000..b8851444 --- /dev/null +++ b/Appsmith/pv-local-mysql-as.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: as-data +spec: + capacity: + storage: 20Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/cluster/appsmith/appsmith-db" diff --git a/Drupal/copia.zip b/Drupal/copia.zip new file mode 100644 index 00000000..a3426df6 Binary files /dev/null and b/Drupal/copia.zip differ diff --git a/Drupal/copyDrupalDB b/Drupal/copyDrupalDB index e7796265..87ebb426 100755 --- a/Drupal/copyDrupalDB +++ b/Drupal/copyDrupalDB @@ -14,10 +14,14 @@ file_name=$BACKUP_FOLDER/bkup_drupal new_name=$file_name-$today.sql echo "Backup file name: " "$new_name" -sudo docker exec `sudo docker container ls | grep mysql_drupal | cut -f1 -d' '` /usr/bin/mysqldump -u root --password=Dsa-0213 drupaldb > $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 -sudo -u creylopez cat $new_name | mail -s "Drupal backup finished" "creylopez@yahoo.es" +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* + -sudo rm $new_name diff --git a/Firefly/k8s-cluster/copyDBK8S b/Firefly/k8s-cluster/copyDBK8S index 0eda5ae8..dfdc92d2 100755 --- a/Firefly/k8s-cluster/copyDBK8S +++ b/Firefly/k8s-cluster/copyDBK8S @@ -14,7 +14,7 @@ file_name=$BACKUP_FOLDER/bkup_fireflyiii new_name=$file_name-$today.sql echo "Backup file name: " "$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 +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 diff --git a/Mediawiki/copyMediawikiDB b/Mediawiki/copyMediawikiDB index 94603eb5..eeac6347 100755 --- a/Mediawiki/copyMediawikiDB +++ b/Mediawiki/copyMediawikiDB @@ -14,7 +14,8 @@ 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 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