From ef84e820c8f077d668cb5d45c42af07547219b6a Mon Sep 17 00:00:00 2001 From: Celestino Rey Date: Thu, 30 May 2024 21:28:47 +0200 Subject: [PATCH] Cambios para funcionar con docker hub --- Calibre-server/docker-calibre-server | 1 - Gitea/creaTodo.sh | 4 + Gitea/gitea-deployment.yaml | 62 ++++++++++++++ Gitea/gitea-namespace.yaml | 4 + Gitea/kustomization.yaml | 13 +++ Gitea/mysql-deployment-gitea.yaml | 73 ++++++++++++++++ Gitea/paraTodo.sh | 3 + Gitea/php-myadmin-gitea-deployment.yaml | 57 +++++++++++++ .../pv-local-gitea.yaml | 7 +- Gitea/pv-local-mysql-gitea.yaml | 11 +++ Gitea/registry-secrets.yaml | 11 +++ Gitea/terminapv.sh | 3 + .../templates/calibre-deployment.yaml | 2 +- HelmCharts/cluster-ingress.yaml | 18 ---- .../templates/mysql-deployment-en.yaml | 2 +- .../templates/mysql-deployment.yaml | 4 +- .../templates/php-deployment.yaml | 2 +- .../templates/mysql-deployment-gogs.yaml | 4 +- HelmCharts/instalaCharts.sh | 20 +++++ .../templates/mediawiki-deployment.yaml | 4 +- .../templates/mysql-deployment-mw.yaml | 3 +- .../templates/php-myadmin-mw-deployment.yaml | 3 +- HelmCharts/mediawiki-ingress.yaml | 24 ------ .../templates/mysql-deployment.yaml | 2 +- .../templates/mysql-deployment.yaml | 2 +- .../templates/php-deployment.yaml | 3 +- .../templates/mysql-deployment.yaml | 2 +- .../templates/pv-local-mysql.yaml | 2 +- .../templates/repostajes-deployment.yaml | 5 +- .../templates/vaultwarden-deployment.yaml | 4 +- .../templates/mysql-deployment.yaml | 2 +- .../templates/php-deployment.yaml | 3 +- .../templates/wordpress-deployment.yaml | 3 +- .../docker-calibre-server/.gitignore | 1 + .../docker-calibre-server/Dockerfile | 42 ++++++++++ .../docker-calibre-server/README.md | 57 +++++++++++++ .../docker-calibre-server/creaImagen.sh | 10 +++ .../docker-calibre-server/server-users.sqlite | Bin 0 -> 12288 bytes .../start-calibre-server.sh | 22 +++++ .../docker-calibre-server/update.sh | 23 ++++++ .../Enphase}/extrae/Dockerfile | 0 .../Enphase}/extrae/app/extrae.sh | 0 .../Enphase}/extrae/app/formateado.json | 0 .../Enphase}/extrae/app/production.json | 0 .../Enphase}/precios/Dockerfile | 0 .../Enphase}/precios/app/pillaPrecios.sh | 0 Imagenes/Mariadb/Dockerfile | 6 ++ Imagenes/Mariadb/creaImagen.sh | 3 + .../PHPMysql}/8.1/Dockerfile | 0 .../PHPMysql}/8.1/creaImagen.sh | 0 .../PHPMysql}/8.2/Dockerfile | 0 Imagenes/PHPMysql/8.2/creaImagen.sh | 3 + Imagenes/PHPMysql/8.2/crearSecret.sh | 1 + MiRegistry/Dockerfile | 2 + MiRegistry/Version-2/10-creaContenedor.sh | 16 ++++ MiRegistry/Version-2/README.md | 11 +++ MiRegistry/Version-2/prueba.sh | 2 + MiRegistry/Version-2/registry-deployment.yaml | 37 +++++++++ MiRegistry/Version-2/registry-pv.yaml | 22 +++++ MiRegistry/Version-3/10-creadirs.sh | 3 + .../registry/nginx/conf.d/additional.conf | 1 + .../registry/nginx/conf.d/registry.conf | 27 ++++++ .../registry/registry-deployment.yaml | 36 ++++++++ MiRegistry/auth/htpasswd | 2 + MiRegistry/certs/tls.crt | 30 +++++++ MiRegistry/certs/tls.key | 52 ++++++++++++ MiRegistry/crearRegistry.sh | 78 ++++++++++++++++++ MiRegistry/minginx-deployment.yaml | 21 +++++ MiRegistry/prueba.sh | 2 +- MiRegistry/registry-pv.yaml | 2 - MiRegistry/step-03.sh | 2 - MiRegistry/step-06-deployment.sh | 3 - MiRegistry/{step-01.sh => step-10.sh} | 0 MiRegistry/{step-02.sh => step-20.sh} | 3 +- MiRegistry/step-30.sh | 3 + MiRegistry/{step-04.sh => step-40.sh} | 0 MiRegistry/step-60.sh | 5 ++ MiRegistry/step-65.sh | 1 + MiRegistry/{step-07.sh => step-68.sh} | 0 MiRegistry/step-70.sh | 4 + MiRegistry/step-90.sh | 7 ++ PHPMysql/8.2/creaImagen.sh | 2 - copyDBK8S | 24 ++++++ copyGogsDB | 24 ++++++ copyMediawikiDB | 24 ++++++ copyNextcloudDB | 29 +++++++ copyRepostajesDB | 24 ++++++ 87 files changed, 951 insertions(+), 79 deletions(-) delete mode 160000 Calibre-server/docker-calibre-server create mode 100755 Gitea/creaTodo.sh create mode 100644 Gitea/gitea-deployment.yaml create mode 100644 Gitea/gitea-namespace.yaml create mode 100644 Gitea/kustomization.yaml create mode 100644 Gitea/mysql-deployment-gitea.yaml create mode 100755 Gitea/paraTodo.sh create mode 100644 Gitea/php-myadmin-gitea-deployment.yaml rename HelmCharts/pv-local-miweb.yaml => Gitea/pv-local-gitea.yaml (58%) create mode 100644 Gitea/pv-local-mysql-gitea.yaml create mode 100644 Gitea/registry-secrets.yaml create mode 100644 Gitea/terminapv.sh delete mode 100644 HelmCharts/cluster-ingress.yaml create mode 100644 HelmCharts/instalaCharts.sh delete mode 100644 HelmCharts/mediawiki-ingress.yaml create mode 100644 Imagenes/Calibre-server/docker-calibre-server/.gitignore create mode 100644 Imagenes/Calibre-server/docker-calibre-server/Dockerfile create mode 100644 Imagenes/Calibre-server/docker-calibre-server/README.md create mode 100644 Imagenes/Calibre-server/docker-calibre-server/creaImagen.sh create mode 100644 Imagenes/Calibre-server/docker-calibre-server/server-users.sqlite create mode 100755 Imagenes/Calibre-server/docker-calibre-server/start-calibre-server.sh create mode 100755 Imagenes/Calibre-server/docker-calibre-server/update.sh rename {Enphase => Imagenes/Enphase}/extrae/Dockerfile (100%) rename {Enphase => Imagenes/Enphase}/extrae/app/extrae.sh (100%) rename {Enphase => Imagenes/Enphase}/extrae/app/formateado.json (100%) rename {Enphase => Imagenes/Enphase}/extrae/app/production.json (100%) rename {Enphase => Imagenes/Enphase}/precios/Dockerfile (100%) rename {Enphase => Imagenes/Enphase}/precios/app/pillaPrecios.sh (100%) create mode 100644 Imagenes/Mariadb/Dockerfile create mode 100644 Imagenes/Mariadb/creaImagen.sh rename {PHPMysql => Imagenes/PHPMysql}/8.1/Dockerfile (100%) rename {PHPMysql => Imagenes/PHPMysql}/8.1/creaImagen.sh (100%) rename {PHPMysql => Imagenes/PHPMysql}/8.2/Dockerfile (100%) create mode 100644 Imagenes/PHPMysql/8.2/creaImagen.sh create mode 100644 Imagenes/PHPMysql/8.2/crearSecret.sh create mode 100644 MiRegistry/Dockerfile create mode 100644 MiRegistry/Version-2/10-creaContenedor.sh create mode 100644 MiRegistry/Version-2/README.md create mode 100644 MiRegistry/Version-2/prueba.sh create mode 100644 MiRegistry/Version-2/registry-deployment.yaml create mode 100644 MiRegistry/Version-2/registry-pv.yaml create mode 100644 MiRegistry/Version-3/10-creadirs.sh create mode 100644 MiRegistry/Version-3/registry/nginx/conf.d/additional.conf create mode 100644 MiRegistry/Version-3/registry/nginx/conf.d/registry.conf create mode 100644 MiRegistry/Version-3/registry/registry-deployment.yaml create mode 100644 MiRegistry/auth/htpasswd create mode 100644 MiRegistry/certs/tls.crt create mode 100644 MiRegistry/certs/tls.key create mode 100644 MiRegistry/crearRegistry.sh create mode 100644 MiRegistry/minginx-deployment.yaml delete mode 100644 MiRegistry/step-03.sh delete mode 100644 MiRegistry/step-06-deployment.sh rename MiRegistry/{step-01.sh => step-10.sh} (100%) rename MiRegistry/{step-02.sh => step-20.sh} (79%) create mode 100644 MiRegistry/step-30.sh rename MiRegistry/{step-04.sh => step-40.sh} (100%) create mode 100644 MiRegistry/step-60.sh create mode 100644 MiRegistry/step-65.sh rename MiRegistry/{step-07.sh => step-68.sh} (100%) create mode 100644 MiRegistry/step-70.sh create mode 100644 MiRegistry/step-90.sh delete mode 100644 PHPMysql/8.2/creaImagen.sh create mode 100755 copyDBK8S create mode 100755 copyGogsDB create mode 100755 copyMediawikiDB create mode 100755 copyNextcloudDB create mode 100755 copyRepostajesDB diff --git a/Calibre-server/docker-calibre-server b/Calibre-server/docker-calibre-server deleted file mode 160000 index f1482b45..00000000 --- a/Calibre-server/docker-calibre-server +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f1482b4579a16540fd63cdccda7d9887f7061e7e diff --git a/Gitea/creaTodo.sh b/Gitea/creaTodo.sh new file mode 100755 index 00000000..c2ff902c --- /dev/null +++ b/Gitea/creaTodo.sh @@ -0,0 +1,4 @@ +kubectl create -f pv-local-mysql-gitea.yaml +kubectl create -f pv-local-gitea.yaml +kubectl create -k ./ +#watch kubectl get all -n gitea diff --git a/Gitea/gitea-deployment.yaml b/Gitea/gitea-deployment.yaml new file mode 100644 index 00000000..4cf26bf1 --- /dev/null +++ b/Gitea/gitea-deployment.yaml @@ -0,0 +1,62 @@ +apiVersion: v1 +kind: Service +metadata: + name: gitea + namespace: gitea + labels: + app: gitea +spec: + type: NodePort + ports: + - port: 3000 + nodePort: 30780 + targetPort: gitea + selector: + app: gitea + tier: frontend +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: gitea + namespace: gitea + labels: + app: gitea +spec: + replicas: 1 + selector: + matchLabels: + app: gitea + template: + metadata: + labels: + app: gitea + spec: + containers: + - name: gitea + image: gitea/gitea:latest + ports: + - containerPort: 3000 + name: gitea + - containerPort: 22 + name: git-ssh + volumeMounts: + - mountPath: /data + name: git-volume + volumes: + - name: git-volume + persistentVolumeClaim: + claimName: gitea-pv-claim + +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: gitea-pv-claim + namespace: gitea +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 2Gi diff --git a/Gitea/gitea-namespace.yaml b/Gitea/gitea-namespace.yaml new file mode 100644 index 00000000..35e8f300 --- /dev/null +++ b/Gitea/gitea-namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: gitea diff --git a/Gitea/kustomization.yaml b/Gitea/kustomization.yaml new file mode 100644 index 00000000..289a29ca --- /dev/null +++ b/Gitea/kustomization.yaml @@ -0,0 +1,13 @@ +secretGenerator: +- name: mysqlgitea-pass + namespace: gitea + literals: + - password=Dsa-0213 + - db_user=root + - db_passwd=Dsa-0213 +resources: + - gitea-namespace.yaml + - registry-secrets.yaml + - mysql-deployment-gitea.yaml + - gitea-deployment.yaml + - php-myadmin-gitea-deployment.yaml diff --git a/Gitea/mysql-deployment-gitea.yaml b/Gitea/mysql-deployment-gitea.yaml new file mode 100644 index 00000000..1a96b024 --- /dev/null +++ b/Gitea/mysql-deployment-gitea.yaml @@ -0,0 +1,73 @@ +apiVersion: v1 +kind: Service +metadata: + name: gitea-mysql + namespace: gitea + labels: + app: gitea +spec: + type: NodePort + ports: + - name: mysql + port: 3306 + nodePort: 30782 + targetPort: mysql + selector: + app: gitea + tier: mysql +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: mysql-gitea-pv-claim + namespace: gitea + labels: + app: gitea +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 20Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: gitea-mysql + namespace: gitea + labels: + app: gitea +spec: + selector: + matchLabels: + app: gitea + tier: mysql + strategy: + type: Recreate + template: + metadata: + labels: + app: gitea + tier: mysql + spec: + containers: + - image: mariadb:latest + name: mysql + env: + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: mysqlgitea-pass + key: password + ports: + - containerPort: 3306 + name: mysql + volumeMounts: + - name: mysql-persistent-storage + mountPath: /var/lib/mysql + imagePullSecrets: + - name: reg-cred-secret + volumes: + - name: mysql-persistent-storage + persistentVolumeClaim: + claimName: mysql-gitea-pv-claim diff --git a/Gitea/paraTodo.sh b/Gitea/paraTodo.sh new file mode 100755 index 00000000..91a25253 --- /dev/null +++ b/Gitea/paraTodo.sh @@ -0,0 +1,3 @@ +kubectl delete -k ./ +kubectl delete -f pv-local-mysql-gitea.yaml +kubectl delete -f pv-local-gitea.yaml diff --git a/Gitea/php-myadmin-gitea-deployment.yaml b/Gitea/php-myadmin-gitea-deployment.yaml new file mode 100644 index 00000000..a6e66966 --- /dev/null +++ b/Gitea/php-myadmin-gitea-deployment.yaml @@ -0,0 +1,57 @@ +apiVersion: v1 +kind: Service +metadata: + name: phpmyadmin-gitea + namespace: gitea + labels: + app: gitea +spec: + selector: + app: gitea + tier: phpmyadmin + type: NodePort + ports: + - name: phpadmin + port: 80 + nodePort: 30781 + targetPort: phpmyadm +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: phpmyadmin-gitea + namespace: gitea + labels: + app: gitea +spec: + selector: + matchLabels: + app: gitea + tier: phpmyadmin + strategy: + type: Recreate + template: + metadata: + labels: + app: gitea + tier: phpmyadmin + spec: + containers: + - name: phpmyadmin + image: phpmyadmin + ports: + - containerPort: 80 + name: phpmyadm + env: + - name: PMA_HOST + value: gitea-mysql + - name: PMA_PORT + value: "3306" + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: mysqlgitea-pass + key: password + imagePullSecrets: + - name: reg-cred-secret + diff --git a/HelmCharts/pv-local-miweb.yaml b/Gitea/pv-local-gitea.yaml similarity index 58% rename from HelmCharts/pv-local-miweb.yaml rename to Gitea/pv-local-gitea.yaml index 800fac9b..4b2dbcef 100644 --- a/HelmCharts/pv-local-miweb.yaml +++ b/Gitea/pv-local-gitea.yaml @@ -1,11 +1,12 @@ apiVersion: v1 kind: PersistentVolume metadata: - name: miweb-www-folder + name: gitea-folder spec: capacity: storage: 2Gi accessModes: - - ReadWriteMany + - ReadWriteOnce hostPath: - path: "/mnt/cluster/nginx" + path: "/mnt/Externo/gitea/data" + diff --git a/Gitea/pv-local-mysql-gitea.yaml b/Gitea/pv-local-mysql-gitea.yaml new file mode 100644 index 00000000..9ccdbe0c --- /dev/null +++ b/Gitea/pv-local-mysql-gitea.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: gitea-data +spec: + capacity: + storage: 20Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/Externo/gitea/gitea-db" diff --git a/Gitea/registry-secrets.yaml b/Gitea/registry-secrets.yaml new file mode 100644 index 00000000..70b1a8f9 --- /dev/null +++ b/Gitea/registry-secrets.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +data: + .dockerconfigjson: eyJhdXRocyI6eyJkb2NrZXItcmVnaXN0cnk6MzIwMDAiOnsidXNlcm5hbWUiOiJjcmV5bG9wZXoiLCJwYXNzd29yZCI6IlJleS0xMTc2IiwiYXV0aCI6IlkzSmxlV3h2Y0dWNk9sSmxlUzB4TVRjMiJ9fX0= +kind: Secret +metadata: + creationTimestamp: "2023-01-29T10:54:14Z" + name: reg-cred-secret + namespace: gitea + resourceVersion: "19890385" + uid: 66b3b7c5-26c1-4e5a-af4e-dc973aaafe4b +type: kubernetes.io/dockerconfigjson diff --git a/Gitea/terminapv.sh b/Gitea/terminapv.sh new file mode 100644 index 00000000..9b1dd5cf --- /dev/null +++ b/Gitea/terminapv.sh @@ -0,0 +1,3 @@ + +kubectl patch pv gitea-folder -p '{"metadata":{"finalizers":null}}' +kubectl patch pv gitea-data -p '{"metadata":{"finalizers":null}}' diff --git a/HelmCharts/calibre-chart/templates/calibre-deployment.yaml b/HelmCharts/calibre-chart/templates/calibre-deployment.yaml index 45c63f24..53a32815 100644 --- a/HelmCharts/calibre-chart/templates/calibre-deployment.yaml +++ b/HelmCharts/calibre-chart/templates/calibre-deployment.yaml @@ -20,7 +20,7 @@ spec: io.kompose.service: calibre spec: containers: - - image: docker-registry:32000/calibre:7 + - image: creylopez/calibre:1.0 name: calibre ports: - containerPort: 8080 diff --git a/HelmCharts/cluster-ingress.yaml b/HelmCharts/cluster-ingress.yaml deleted file mode 100644 index e31c5f3e..00000000 --- a/HelmCharts/cluster-ingress.yaml +++ /dev/null @@ -1,18 +0,0 @@ -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: cluster-ingress - annotations: - kubernetes.io/ingress.class: nginx -spec: - rules: - - http: - paths: - - pathType: Prefix - path: "/" - backend: - service: - name: vaultwarden - port: - number: 80 - diff --git a/HelmCharts/enphase-chart/templates/mysql-deployment-en.yaml b/HelmCharts/enphase-chart/templates/mysql-deployment-en.yaml index c6d7ce61..b586c759 100644 --- a/HelmCharts/enphase-chart/templates/mysql-deployment-en.yaml +++ b/HelmCharts/enphase-chart/templates/mysql-deployment-en.yaml @@ -51,7 +51,7 @@ spec: tier: mysql spec: containers: - - image: docker-registry:32000/mariadb:1.0 + - image: creylopez/mariadb:1.0 name: mysql env: # - name: TZ diff --git a/HelmCharts/firefly-chart/templates/mysql-deployment.yaml b/HelmCharts/firefly-chart/templates/mysql-deployment.yaml index 874f396e..f0e03ac0 100644 --- a/HelmCharts/firefly-chart/templates/mysql-deployment.yaml +++ b/HelmCharts/firefly-chart/templates/mysql-deployment.yaml @@ -52,7 +52,9 @@ spec: tier: mysql spec: containers: - - image: docker-registry:32000/mariadb:1.0 + #- image: docker-registry:32000/mariadb:1.0 + #- image: mariadb:latest + - image: creylopez/mariadb:1.0 name: mysql env: - name: MYSQL_ROOT_PASSWORD diff --git a/HelmCharts/firefly-chart/templates/php-deployment.yaml b/HelmCharts/firefly-chart/templates/php-deployment.yaml index cc69d89d..5008b35b 100644 --- a/HelmCharts/firefly-chart/templates/php-deployment.yaml +++ b/HelmCharts/firefly-chart/templates/php-deployment.yaml @@ -38,7 +38,7 @@ spec: spec: containers: - name: phpmyadmin - image: docker-registry:32000/phpmyadmin:1.0 + image: phpmyadmin ports: - containerPort: 80 name: phpmyadm diff --git a/HelmCharts/gogs-chart/templates/mysql-deployment-gogs.yaml b/HelmCharts/gogs-chart/templates/mysql-deployment-gogs.yaml index cb6146b5..63614798 100644 --- a/HelmCharts/gogs-chart/templates/mysql-deployment-gogs.yaml +++ b/HelmCharts/gogs-chart/templates/mysql-deployment-gogs.yaml @@ -51,8 +51,8 @@ spec: tier: mysql spec: containers: - # - image: docker-registry:32000/mariadb:1.0 - - image: mariadb:latest + #- image: docker-registry:32000/mariadb:1.0 + - image: creylopez/mariadb:1.0 name: mysql env: - name: MYSQL_ROOT_PASSWORD diff --git a/HelmCharts/instalaCharts.sh b/HelmCharts/instalaCharts.sh new file mode 100644 index 00000000..92448db6 --- /dev/null +++ b/HelmCharts/instalaCharts.sh @@ -0,0 +1,20 @@ +if [ "$1" = "i" ] +then + + for i in calibre-chart firefly-chart gogs-chart mealiev1 mediawiki-chart navidrome-chart nextcloud-chart repostajes-chart vaultwarden-chart wordpress-chart + do + chart=`echo $i | cut -f1 -d-` + helm install $chart ./$i --namespace=$chart --create-namespace + done +elif [ "$1" = "u" ] +then + for i in calibre-chart firefly-chart gogs-chart mealie-chart mealiev1 mediawiki-chart navidrome-chart nextcloud-chart repostajes-chart vaultwarden-chart wordpress-chart + do + chart=`echo $i | cut -f1 -d-` + helm uninstall $chart -n $chart + done +else + echo "Falta comando: i=instalar, u=desinstalar" +fi + + diff --git a/HelmCharts/mediawiki-chart/templates/mediawiki-deployment.yaml b/HelmCharts/mediawiki-chart/templates/mediawiki-deployment.yaml index 32797dbe..ca4eb96d 100644 --- a/HelmCharts/mediawiki-chart/templates/mediawiki-deployment.yaml +++ b/HelmCharts/mediawiki-chart/templates/mediawiki-deployment.yaml @@ -51,8 +51,8 @@ spec: tier: frontend spec: containers: - # - image: mediawiki - - image: docker-registry:32000/mediawiki:1.0 + - image: mediawiki + #- image: docker-registry:32000/mediawiki:1.0 name: mediawiki env: - name: DB_TYPE diff --git a/HelmCharts/mediawiki-chart/templates/mysql-deployment-mw.yaml b/HelmCharts/mediawiki-chart/templates/mysql-deployment-mw.yaml index 86c7ab83..a2249ff2 100644 --- a/HelmCharts/mediawiki-chart/templates/mysql-deployment-mw.yaml +++ b/HelmCharts/mediawiki-chart/templates/mysql-deployment-mw.yaml @@ -51,7 +51,8 @@ spec: tier: mysql spec: containers: - - image: docker-registry:32000/mariadb:1.0 + #- image: docker-registry:32000/mariadb:1.0 + - image: creylopez/mariadb:1.0 name: mysql env: - name: MYSQL_ROOT_PASSWORD diff --git a/HelmCharts/mediawiki-chart/templates/php-myadmin-mw-deployment.yaml b/HelmCharts/mediawiki-chart/templates/php-myadmin-mw-deployment.yaml index e18086d3..35972afb 100644 --- a/HelmCharts/mediawiki-chart/templates/php-myadmin-mw-deployment.yaml +++ b/HelmCharts/mediawiki-chart/templates/php-myadmin-mw-deployment.yaml @@ -38,7 +38,8 @@ spec: spec: containers: - name: phpmyadmin - image: docker-registry:32000/phpmyadmin:1.0 + image: phpmyadmin + #image: docker-registry:32000/phpmyadmin:1.0 ports: - containerPort: 80 name: phpmyadm diff --git a/HelmCharts/mediawiki-ingress.yaml b/HelmCharts/mediawiki-ingress.yaml deleted file mode 100644 index 2853a2c3..00000000 --- a/HelmCharts/mediawiki-ingress.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: mediawiki-ingress - namespace: mediawiki - annotations: - kubernetes.io/ingress.class: nginx - cert-manager.io/cluster-issuer: letsencrypt-production -spec: - tls: - - hosts: - - reymota.ddns.net - secretName: letsencrypt-production - rules: - - host: "reymota.ddns.net" - http: - paths: - - pathType: Prefix - path: "/mediawiki" - backend: - service: - name: mediawiki - port: - number: 80 diff --git a/HelmCharts/mivida-chart/templates/mysql-deployment.yaml b/HelmCharts/mivida-chart/templates/mysql-deployment.yaml index 7d190967..02f937e7 100755 --- a/HelmCharts/mivida-chart/templates/mysql-deployment.yaml +++ b/HelmCharts/mivida-chart/templates/mysql-deployment.yaml @@ -48,7 +48,7 @@ spec: tier: mysql spec: containers: - - image: docker-registry:32000/mariadb:1.0 + - image: creylopez/mariadb:1.0 name: mysql env: - name: MYSQL_ROOT_PASSWORD diff --git a/HelmCharts/nextcloud-chart/templates/mysql-deployment.yaml b/HelmCharts/nextcloud-chart/templates/mysql-deployment.yaml index 254ff194..7d32f4c7 100644 --- a/HelmCharts/nextcloud-chart/templates/mysql-deployment.yaml +++ b/HelmCharts/nextcloud-chart/templates/mysql-deployment.yaml @@ -48,7 +48,7 @@ spec: tier: mysql spec: containers: - - image: docker-registry:32000/mariadb:1.0 + - image: creylopez/mariadb:1.0 name: mysql env: - name: MYSQL_ROOT_PASSWORD diff --git a/HelmCharts/nextcloud-chart/templates/php-deployment.yaml b/HelmCharts/nextcloud-chart/templates/php-deployment.yaml index 9c8259c9..ec5b1aeb 100644 --- a/HelmCharts/nextcloud-chart/templates/php-deployment.yaml +++ b/HelmCharts/nextcloud-chart/templates/php-deployment.yaml @@ -38,7 +38,8 @@ spec: spec: containers: - name: phpmyadmin - image: docker-registry:32000/phpmyadmin:1.0 + image: phpmyadmin + #image: docker-registry:32000/phpmyadmin:1.0 ports: - containerPort: 80 name: phpmyadm diff --git a/HelmCharts/repostajes-chart/templates/mysql-deployment.yaml b/HelmCharts/repostajes-chart/templates/mysql-deployment.yaml index 01abeee0..402d76fe 100644 --- a/HelmCharts/repostajes-chart/templates/mysql-deployment.yaml +++ b/HelmCharts/repostajes-chart/templates/mysql-deployment.yaml @@ -54,7 +54,7 @@ spec: tier: mysql spec: containers: - - image: mariadb:latest + - image: creylopez/mariadb:1.0 name: mysql env: - name: MYSQL_ROOT_PASSWORD diff --git a/HelmCharts/repostajes-chart/templates/pv-local-mysql.yaml b/HelmCharts/repostajes-chart/templates/pv-local-mysql.yaml index b35b4498..957182ec 100644 --- a/HelmCharts/repostajes-chart/templates/pv-local-mysql.yaml +++ b/HelmCharts/repostajes-chart/templates/pv-local-mysql.yaml @@ -10,4 +10,4 @@ spec: accessModes: - ReadWriteOnce hostPath: - path: "/mnt/Externo/repostajes/repostajes-db" + path: "/mnt/Externo/repostajes/repostajes-db2" diff --git a/HelmCharts/repostajes-chart/templates/repostajes-deployment.yaml b/HelmCharts/repostajes-chart/templates/repostajes-deployment.yaml index d4c2da89..833167ea 100644 --- a/HelmCharts/repostajes-chart/templates/repostajes-deployment.yaml +++ b/HelmCharts/repostajes-chart/templates/repostajes-deployment.yaml @@ -54,7 +54,7 @@ spec: tier: frontend spec: containers: - - image: docker-registry:32000/phpmysql:2.0 + - image: creylopez/phpmysql:1.0 name: repostajes ports: - containerPort: 80 @@ -63,7 +63,8 @@ spec: - name: repostajes-persistent-storage mountPath: /var/www/html imagePullSecrets: - - name: reg-cred-secret + #- name: reg-cred-secret + - name: regcred volumes: - name: repostajes-persistent-storage persistentVolumeClaim: diff --git a/HelmCharts/vaultwarden-chart/templates/vaultwarden-deployment.yaml b/HelmCharts/vaultwarden-chart/templates/vaultwarden-deployment.yaml index 115d04c5..5b307cf0 100644 --- a/HelmCharts/vaultwarden-chart/templates/vaultwarden-deployment.yaml +++ b/HelmCharts/vaultwarden-chart/templates/vaultwarden-deployment.yaml @@ -51,8 +51,8 @@ spec: tier: frontend spec: containers: - # - image: vaultwarden - - image: docker-registry:32000/vaultwarden:1.0 + - image: vaultwarden/server + #- image: docker-registry:32000/vaultwarden:1.0 name: vaultwarden ports: - containerPort: 80 diff --git a/HelmCharts/wordpress-chart/templates/mysql-deployment.yaml b/HelmCharts/wordpress-chart/templates/mysql-deployment.yaml index 5ab08624..ca763227 100755 --- a/HelmCharts/wordpress-chart/templates/mysql-deployment.yaml +++ b/HelmCharts/wordpress-chart/templates/mysql-deployment.yaml @@ -48,7 +48,7 @@ spec: tier: mysql spec: containers: - - image: docker-registry:32000/mariadb:1.0 + - image: creylopez/mariadb:1.0 name: mysql env: - name: MYSQL_ROOT_PASSWORD diff --git a/HelmCharts/wordpress-chart/templates/php-deployment.yaml b/HelmCharts/wordpress-chart/templates/php-deployment.yaml index 1ccaf689..1d0c36ba 100644 --- a/HelmCharts/wordpress-chart/templates/php-deployment.yaml +++ b/HelmCharts/wordpress-chart/templates/php-deployment.yaml @@ -38,7 +38,8 @@ spec: spec: containers: - name: phpmyadmin - image: docker-registry:32000/phpmyadmin:1.0 + image: phpmyadmin + #image: docker-registry:32000/phpmyadmin:1.0 ports: - containerPort: 80 name: phpmyadm diff --git a/HelmCharts/wordpress-chart/templates/wordpress-deployment.yaml b/HelmCharts/wordpress-chart/templates/wordpress-deployment.yaml index 6ba71e0d..d2c76fe8 100755 --- a/HelmCharts/wordpress-chart/templates/wordpress-deployment.yaml +++ b/HelmCharts/wordpress-chart/templates/wordpress-deployment.yaml @@ -51,7 +51,8 @@ spec: tier: frontend spec: containers: - - image: docker-registry:32000/wordpress:1.0 + #- image: docker-registry:32000/wordpress:1.0 + - image: wordpress name: wordpress env: - name: WORDPRESS_DB_HOST diff --git a/Imagenes/Calibre-server/docker-calibre-server/.gitignore b/Imagenes/Calibre-server/docker-calibre-server/.gitignore new file mode 100644 index 00000000..abfbc21a --- /dev/null +++ b/Imagenes/Calibre-server/docker-calibre-server/.gitignore @@ -0,0 +1 @@ +/library diff --git a/Imagenes/Calibre-server/docker-calibre-server/Dockerfile b/Imagenes/Calibre-server/docker-calibre-server/Dockerfile new file mode 100644 index 00000000..c9a22027 --- /dev/null +++ b/Imagenes/Calibre-server/docker-calibre-server/Dockerfile @@ -0,0 +1,42 @@ +FROM --platform=linux/amd64 ubuntu:latest + +RUN apt-get update && apt-get install -y curl xz-utils + +ARG CALIBRE_RELEASE="7.1.0" + +RUN curl -o /tmp/calibre-tarball.txz -L "https://download.calibre-ebook.com/${CALIBRE_RELEASE}/calibre-${CALIBRE_RELEASE}-x86_64.txz" && \ + mkdir -p /opt/calibre && \ + tar xvf /tmp/calibre-tarball.txz -C /opt/calibre && \ + rm -rf /tmp/* + + +FROM --platform=linux/amd64 debian:bookworm-slim + +RUN apt-get update && apt-get install -y \ + dnsutils \ + iproute2 \ + libfontconfig \ + libgl1 \ + libegl1 \ + libxkbcommon-x11-0 \ + libopengl0 \ + libnss3-dev \ + libxcomposite-dev \ + libxdamage1 \ + libxrandr2 \ + libxtst6 \ + libxkbfile-dev \ + xdg-utils \ + && rm -rf /var/lib/apt/lists/* +COPY --from=0 /opt/calibre /opt/calibre +RUN mkdir /usr/share/desktop-directories/ +RUN /opt/calibre/calibre_postinstall && \ + mkdir /opt/calibre/calibre-library && \ + touch /opt/calibre/calibre-library/metadata.db + +COPY server-users.sqlite /opt/calibre/calibre-library/server-users.sqlite + +COPY start-calibre-server.sh . + +EXPOSE 8080 +CMD [ "/start-calibre-server.sh" ] diff --git a/Imagenes/Calibre-server/docker-calibre-server/README.md b/Imagenes/Calibre-server/docker-calibre-server/README.md new file mode 100644 index 00000000..2266bb85 --- /dev/null +++ b/Imagenes/Calibre-server/docker-calibre-server/README.md @@ -0,0 +1,57 @@ +# [Docker Calibre Server](https://hub.docker.com/r/wietsedv/calibre-server) +![Docker Image Version (latest semver)](https://img.shields.io/docker/v/wietsedv/calibre-server?sort=semver) +![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/wietsedv/calibre-server) +![Docker Cloud Automated build](https://img.shields.io/docker/cloud/automated/wietsedv/calibre-server) +![Docker Pulls](https://img.shields.io/docker/pulls/wietsedv/calibre-server) +![Docker Image Size (tag)](https://img.shields.io/docker/image-size/wietsedv/calibre-server/latest) + +Automatically updating Docker image for `calibre-server`. The image contains a minimal [Calibre](https://calibre-ebook.com/) installation and starts a Calibre server. The current version should correspond with the [latest Calibre release](https://github.com/kovidgoyal/calibre/releases). + +**Note:** This image is unofficial and not affiliated with Calibre. + +## Usage + +Calibre server is a REST API + web interface for Calibre. For more information about usage of `calibre-server` itself, refer to the [user guide](https://manual.calibre-ebook.com/server.html) and the [CLI manual](https://manual.calibre-ebook.com/generated/en/calibre-server.html) of Calibre. + +### Use case 1: Standalone container for local use + +``` +$ docker run -ti -p 8080:8080 wietsedv/calibre-server -v /path/to/library:/library +``` + +Now you have read+write access to your library via `localhost:8080`. + +### Use case 2: Access from other containers within network + +The command of "Use case 1" gives r+w access to your library on the host machine, but other containers in the network have readonly access. Calibre does not allow giving global r+w access without whitelisting or authentication. To give write access to other containers you should use the Docker `host` network type (not recommended) or you can whitelist containers within the bridge network: + +``` +$ docker run -ti -p 8080:8080 -v /path/to/library:/library -e TRUSTED_HOSTS="web1 web2" wietsedv/calibre-server +``` + +**Note:** IP addresses of whitelisted containers (`web1` and `web2`) are resolved when `calibre-server` starts. So containers that need to access `calibre-server` have to start _before_ `calibre-server`. + +### Use case 3: Docker compose (recommended) + +You can get the same setup as "Use case 2" with this `docker-compose.yaml`: + +```yaml +services: + calibre: + image: wietsedv/calibre-server + volumes: + - /path/to/library:/library + ports: + - "8080:8080" + depends_on: # start web1 and web2 before calibre + - web1 + - web2 + environment: + TRUSTED_HOSTS: web1 web2 # whitelist web1 and web2 + + web1: + image: nginx:alpine + + web2: + image: nginx:alpine +``` diff --git a/Imagenes/Calibre-server/docker-calibre-server/creaImagen.sh b/Imagenes/Calibre-server/docker-calibre-server/creaImagen.sh new file mode 100644 index 00000000..058d4353 --- /dev/null +++ b/Imagenes/Calibre-server/docker-calibre-server/creaImagen.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +if [ -z "$1" ] +then + echo "Falta versión" +else + + docker build --no-cache -t creylopez/calibre:$1 . + docker push creylopez/calibre:$1 +fi diff --git a/Imagenes/Calibre-server/docker-calibre-server/server-users.sqlite b/Imagenes/Calibre-server/docker-calibre-server/server-users.sqlite new file mode 100644 index 0000000000000000000000000000000000000000..54638ac083b72c877d12724ea2e485679f0aa6bc GIT binary patch literal 12288 zcmeI%O>fgM7yw|WLwrwNckvswh^)% zDskZ-@hA8-TsUF}I)TK3&~DRf#YyeHew{vP4|We{PLwlzlJSJ*cz_-tO+$MaBZS(r zuF1M8ntX9<)sR=!R<)_L(N_AUqkl)OPJudw{-U9&;009sH0T2KI5C8!X0D&7R z@M)&qF$_cdtmX7LW~YL2QJ-4-F0nm=J^PtMaNUJB+PI-aAs$aX@{+jtz#UI)_Xxit zN1KgfQkpRAkvATmzLs_FIL+~k^Z$v?qlAf^CX1hgo|6~$-0|@K+;z#+^S$we9D4TT zpm|Qggov`#4{1*SoE@(+nq_4+C*kr&cogI^(KT|=FiYd&ss!mj?jeapaJ^44pN?m9 zvZ0<@_sZwm?Y3?kyM~6MG-Myd`&h2*eR`T_b=$AMN`9}tsCE5a^}FiGs_DB(9#B94 z1V8`;KmY_l00ck)1V8`;KmY{(BCuTUX>GLrXs{GSe;9C9#My#yH zJ+%5m+#8ObJRbFTN>gM!w=OQMfX2}=XO=osUYH|nUT&Ifg-itICN^U#a$k+`GafQ7 zgGy7b=ig<#?p1@RjI3nnS;Wr$Bnz4946-xE{kJ>{&8jqiP2vBx6CzZqs!GdB{mHNC o-;g|@fB*=900@8p2!H?xfB*=900@8p2;3Zj`)lj>E;lQF0P}L&2 echo "WARNING: host '$h' not found in network. container with that name will not get write access to the library" + else + TRUSTED_IPS="${TRUSTED_IPS},${HOST_IP}" + fi +done +echo "trusted ips: ${TRUSTED_IPS}" + +touch "/opt/calibre/calibre-library/metadata.db" +XDG_RUNTIME_DIR=/tmp/runtime-root /usr/bin/calibre-server \ + --disable-use-bonjour \ + --enable-local-write \ + --userdb /opt/calibre/calibre-library/server-users.sqlite --enable-auth \ + --trusted-ips="${TRUSTED_IPS}" \ + "$@" \ + "/opt/calibre/calibre-library" diff --git a/Imagenes/Calibre-server/docker-calibre-server/update.sh b/Imagenes/Calibre-server/docker-calibre-server/update.sh new file mode 100755 index 00000000..e9d8c1bc --- /dev/null +++ b/Imagenes/Calibre-server/docker-calibre-server/update.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +set -e + +TAG="$(curl 'https://api.github.com/repos/kovidgoyal/calibre/releases?per_page=1' | jq -r '.[0].tag_name')" + +if [[ ! $TAG =~ ^v[0-9.]+$ ]]; then + echo "skipping invalid tag: $TAG" + exit 1 +fi + +sed -i "s/ARG CALIBRE_RELEASE\=.*/ARG CALIBRE_RELEASE\=\"${TAG:1}\"/" Dockerfile + +if git diff --exit-code Dockerfile; then + echo "Dockerfile already on ${TAG}" + exit 0 +fi + +git add Dockerfile +git commit -m "update Calibre to ${TAG}" +git tag -f "${TAG}" + +git push -f --tags +git push origin main diff --git a/Enphase/extrae/Dockerfile b/Imagenes/Enphase/extrae/Dockerfile similarity index 100% rename from Enphase/extrae/Dockerfile rename to Imagenes/Enphase/extrae/Dockerfile diff --git a/Enphase/extrae/app/extrae.sh b/Imagenes/Enphase/extrae/app/extrae.sh similarity index 100% rename from Enphase/extrae/app/extrae.sh rename to Imagenes/Enphase/extrae/app/extrae.sh diff --git a/Enphase/extrae/app/formateado.json b/Imagenes/Enphase/extrae/app/formateado.json similarity index 100% rename from Enphase/extrae/app/formateado.json rename to Imagenes/Enphase/extrae/app/formateado.json diff --git a/Enphase/extrae/app/production.json b/Imagenes/Enphase/extrae/app/production.json similarity index 100% rename from Enphase/extrae/app/production.json rename to Imagenes/Enphase/extrae/app/production.json diff --git a/Enphase/precios/Dockerfile b/Imagenes/Enphase/precios/Dockerfile similarity index 100% rename from Enphase/precios/Dockerfile rename to Imagenes/Enphase/precios/Dockerfile diff --git a/Enphase/precios/app/pillaPrecios.sh b/Imagenes/Enphase/precios/app/pillaPrecios.sh similarity index 100% rename from Enphase/precios/app/pillaPrecios.sh rename to Imagenes/Enphase/precios/app/pillaPrecios.sh diff --git a/Imagenes/Mariadb/Dockerfile b/Imagenes/Mariadb/Dockerfile new file mode 100644 index 00000000..73323427 --- /dev/null +++ b/Imagenes/Mariadb/Dockerfile @@ -0,0 +1,6 @@ +FROM mariadb +LABEL maintainer="Celestino Rey " +# Install any necessary packages +RUN apt-get update +RUN apt install -y mysql-client + diff --git a/Imagenes/Mariadb/creaImagen.sh b/Imagenes/Mariadb/creaImagen.sh new file mode 100644 index 00000000..dbb1ae99 --- /dev/null +++ b/Imagenes/Mariadb/creaImagen.sh @@ -0,0 +1,3 @@ +docker build --no-cache -t creylopez/mariadb:1.0 . +docker push creylopez/mariadb:1.0 + diff --git a/PHPMysql/8.1/Dockerfile b/Imagenes/PHPMysql/8.1/Dockerfile similarity index 100% rename from PHPMysql/8.1/Dockerfile rename to Imagenes/PHPMysql/8.1/Dockerfile diff --git a/PHPMysql/8.1/creaImagen.sh b/Imagenes/PHPMysql/8.1/creaImagen.sh similarity index 100% rename from PHPMysql/8.1/creaImagen.sh rename to Imagenes/PHPMysql/8.1/creaImagen.sh diff --git a/PHPMysql/8.2/Dockerfile b/Imagenes/PHPMysql/8.2/Dockerfile similarity index 100% rename from PHPMysql/8.2/Dockerfile rename to Imagenes/PHPMysql/8.2/Dockerfile diff --git a/Imagenes/PHPMysql/8.2/creaImagen.sh b/Imagenes/PHPMysql/8.2/creaImagen.sh new file mode 100644 index 00000000..5d787e31 --- /dev/null +++ b/Imagenes/PHPMysql/8.2/creaImagen.sh @@ -0,0 +1,3 @@ +docker build --no-cache -t creylopez/phpmysql:1.0 . +docker push creylopez/phpmysql:1.0 + diff --git a/Imagenes/PHPMysql/8.2/crearSecret.sh b/Imagenes/PHPMysql/8.2/crearSecret.sh new file mode 100644 index 00000000..69d800ec --- /dev/null +++ b/Imagenes/PHPMysql/8.2/crearSecret.sh @@ -0,0 +1 @@ +kubectl create secret generic regcred --from-file=.dockerconfigjson=$HOME/.docker/config.json --type=kubernetes.io/dockerconfigjson diff --git a/MiRegistry/Dockerfile b/MiRegistry/Dockerfile new file mode 100644 index 00000000..567d175d --- /dev/null +++ b/MiRegistry/Dockerfile @@ -0,0 +1,2 @@ +FROM nginx + diff --git a/MiRegistry/Version-2/10-creaContenedor.sh b/MiRegistry/Version-2/10-creaContenedor.sh new file mode 100644 index 00000000..74b08f48 --- /dev/null +++ b/MiRegistry/Version-2/10-creaContenedor.sh @@ -0,0 +1,16 @@ +docker stop local-registry +docker rm local-registry +docker run -d -p 5001:5000 --name local-registry registry:2 + +echo "Para verificar: " +echo "$ docker container ls -a |grep local-registry" +echo "\n" +echo "Para probar:" +echo "$ docker pull nginx:latest" +echo "$ docker tag nginx:latest localhost:5001/minginx:latest" +echo "$ docker push localhost:5001/minginx:latest" +echo "\n" +echo "Entrar en la imagen:" +echo "$ docker exec -it local-registry sh" +echo "# cd /var/lib/registry" +echo "# ls docker .... etcetera" diff --git a/MiRegistry/Version-2/README.md b/MiRegistry/Version-2/README.md new file mode 100644 index 00000000..4ef22e94 --- /dev/null +++ b/MiRegistry/Version-2/README.md @@ -0,0 +1,11 @@ +# Esta no la he probado todavía, pero da pistas +https://kubeops.net/blog/creating-a-local-docker-registry + +# Esta es sin autenticación. kubectl falla al acceder al registry + +https://k21academy.com/docker-kubernetes/how-to-set-up-your-own-local-docker-registry-a-step-by-step-guide/ + + +# probando + +https://phoenixnap.com/kb/set-up-a-private-docker-registry diff --git a/MiRegistry/Version-2/prueba.sh b/MiRegistry/Version-2/prueba.sh new file mode 100644 index 00000000..35ed31e3 --- /dev/null +++ b/MiRegistry/Version-2/prueba.sh @@ -0,0 +1,2 @@ +kubectl run nginx-pod --image=localhost:5000/minginx:latest + diff --git a/MiRegistry/Version-2/registry-deployment.yaml b/MiRegistry/Version-2/registry-deployment.yaml new file mode 100644 index 00000000..83c96c22 --- /dev/null +++ b/MiRegistry/Version-2/registry-deployment.yaml @@ -0,0 +1,37 @@ +apiVersion: v1 +kind: Service +metadata: + name: docker-registry +spec: + ports: + - port: 5000 + targetPort: 5000 + selector: + app: registry +--- +apiVersion: v1 +kind: Pod +metadata: + name: docker-registry-pod + labels: + app: registry +spec: + containers: + - name: registry + image: registry:2 + volumeMounts: + - name: repo-vol + mountPath: "/var/lib/registry" + ports: + - containerPort: 5000 + name: registryport + volumes: + - name: repo-vol + persistentVolumeClaim: + claimName: docker-repo-pvc + - name: certs-vol + secret: + secretName: certs-secret + - name: auth-vol + secret: + secretName: auth-secret diff --git a/MiRegistry/Version-2/registry-pv.yaml b/MiRegistry/Version-2/registry-pv.yaml new file mode 100644 index 00000000..d0ebbb67 --- /dev/null +++ b/MiRegistry/Version-2/registry-pv.yaml @@ -0,0 +1,22 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: docker-repo-pv +spec: + capacity: + storage: 1Gi + accessModes: + - ReadWriteOnce + hostPath: + path: /mnt/Externo/registry +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: docker-repo-pvc +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi diff --git a/MiRegistry/Version-3/10-creadirs.sh b/MiRegistry/Version-3/10-creadirs.sh new file mode 100644 index 00000000..ddf73d7c --- /dev/null +++ b/MiRegistry/Version-3/10-creadirs.sh @@ -0,0 +1,3 @@ +# mkdir -p registry/{nginx,auth} +# mkdir -p registry/nginx/{conf.d,ssl} +# cd registry && tree diff --git a/MiRegistry/Version-3/registry/nginx/conf.d/additional.conf b/MiRegistry/Version-3/registry/nginx/conf.d/additional.conf new file mode 100644 index 00000000..a8e42f5a --- /dev/null +++ b/MiRegistry/Version-3/registry/nginx/conf.d/additional.conf @@ -0,0 +1 @@ +client_max_body_size 2G; diff --git a/MiRegistry/Version-3/registry/nginx/conf.d/registry.conf b/MiRegistry/Version-3/registry/nginx/conf.d/registry.conf new file mode 100644 index 00000000..3f9c5104 --- /dev/null +++ b/MiRegistry/Version-3/registry/nginx/conf.d/registry.conf @@ -0,0 +1,27 @@ +upstream docker-registry { + server registry:5000; +} +server { + listen 80; + server_name registry.k8s-server; + return 301 https://registry.k8s-server$request_uri; +} +server { + listen 443 ssl http2; + server_name registry.k8s-server; + ssl_certificate /etc/nginx/ssl/fullchain.pem; + ssl_certificate_key /etc/nginx/ssl/privkey.pem; + error_log /var/log/nginx/error.log; + access_log /var/log/nginx/access.log; + location / { + if ($http_user_agent ~ "^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$" ) { + return 404; + } + proxy_pass http://docker-registry; + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_read_timeout 900; + } +} diff --git a/MiRegistry/Version-3/registry/registry-deployment.yaml b/MiRegistry/Version-3/registry/registry-deployment.yaml new file mode 100644 index 00000000..eca41a8d --- /dev/null +++ b/MiRegistry/Version-3/registry/registry-deployment.yaml @@ -0,0 +1,36 @@ +version: '3' +services: + registry: + image: registry:2 + restart: always + ports: + - "5000:5000" + environment: + REGISTRY_AUTH: htpasswd + REGISTRY_AUTH_HTPASSWD_REALM: Registry-Realm + REGISTRY_AUTH_HTPASSWD_PATH: /auth/registry.passwd + REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /data + volumes: + - registrydata:/data + - ./auth:/auth + networks: + - mynet + nginx: + image: nginx:alpine + container_name: nginx + restart: unless-stopped + tty: true + ports: + - "80:80" + - "443:443" + volumes: + - ./nginx/conf.d/:/etc/nginx/conf.d/ + - ./nginx/ssl/:/etc/nginx/ssl/ + networks: + - mynet +networks: + mynet: + driver: bridge +volumes: + registrydata: + driver: local diff --git a/MiRegistry/auth/htpasswd b/MiRegistry/auth/htpasswd new file mode 100644 index 00000000..dbdc848e --- /dev/null +++ b/MiRegistry/auth/htpasswd @@ -0,0 +1,2 @@ +creylopez:$2y$05$Cb2PH3cbA.geRwxOpKIVTO1pmbuWHyYpXgPuBw6MoD2JEcC/WoH1G + diff --git a/MiRegistry/certs/tls.crt b/MiRegistry/certs/tls.crt new file mode 100644 index 00000000..25b73877 --- /dev/null +++ b/MiRegistry/certs/tls.crt @@ -0,0 +1,30 @@ +-----BEGIN CERTIFICATE----- +MIIFMTCCAxmgAwIBAgIUWe1wIvAX1VR04IKlf48Jjjrwq7EwDQYJKoZIhvcNAQEL +BQAwGjEYMBYGA1UEAwwPZG9ja2VyLXJlZ2lzdHJ5MB4XDTI0MDUzMDEzMzIzN1oX +DTI1MDUzMDEzMzIzN1owGjEYMBYGA1UEAwwPZG9ja2VyLXJlZ2lzdHJ5MIICIjAN +BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAqlfoQg7+nqHt7WEGUqL6pG8SEKl+ +LfbJW5afwYOIbAVQk3+40wMxVd+UJBlL9WBzccsROFObZ+LuMp65vNevvAB2LAfV +NjFakWeANjNxsGsnrpPbMZj5baNZirGSznZfZUrfzcLEnLik3nNC3WfkMkJ7dZ7P +Oot+FKkSNvFkdhm1UIlr/XzB19vTqwYYS49s7VofrPQawss7oNOLI1qrW8KnSWyP +yAqFRA95d3WI8MSrQxV3Dz5F+nWGAd6qTEbTK+9xyLQrb3uX5i6v6S32Wk4TlMus +3EFon7Ouwx3mi4djPABZrp9Ir5UXzMs9g/BJASDaXrsGCn07gslW7+wUA0TLkM3Z +6lHJKepTyj7z/ymVdFy9ugydiuaHZMrcg7HYM++VkAjuLKZE36YQ8z4FaWEenSP1 +WMRFV+EidyBnMaC8PDeyna9YeKyKkFd3qHgLkJ7vsfB+UqJi6PGEx7Y4pb08SAg5 +3WFKZ/nGBIyJS41aeJiJ+Vv8b4hHBmlJehU5BHWuc/2O7GUR9bgllsr/6ty/SHVa +qDEcPmfg6UrTOhhcU0nh4dvY44nQL7Ls8+R/dJpEVEjTrM+CW+DS3vPlOftEv5Ml +a8QnrOmZiNFjtj5aQ89pOPgIe2U/eZMwbEdQ+vTOF7fEgsc/ZKvinWmH1aBblp6V +Q+mRwUisJMzSfQMCAwEAAaNvMG0wHQYDVR0OBBYEFEvk3nobvzBOHf/PMVq5w0aq +LuKHMB8GA1UdIwQYMBaAFEvk3nobvzBOHf/PMVq5w0aqLuKHMA8GA1UdEwEB/wQF +MAMBAf8wGgYDVR0RBBMwEYIPZG9ja2VyLXJlZ2lzdHJ5MA0GCSqGSIb3DQEBCwUA +A4ICAQByJK/RrIXjrbphThfdRQPkvPzN7uiSay2mGFxtThAEetGlHOZCzaaHcUZ4 +8xmDbLZL5O0W5KFN2WoeG/0sRAeAEZODZtRs0gZ5jwxmPYArdfMLqY1ITwDGUMkF +5BMw+u7qKSS4Gpnj2Ky10F01paHPldJ/Ey5SHbWz3ovCB1L/l05c6RpPTaKc34Rp +w3Y7FHZ0hqKt0l4pcfgdIpUaMi3hBodFMVfGp3rBD8dBasg1lS9RUyFnmJ+nuRel +K7iQMoeqTC8j6zx98nsRkVS2eCCZ20O0zIpG4TTd+LUbeCVtzLEsjXatBK/41fqd +SsC7HooxEO4fjcd2o4a/NN3lfQQ1XQuHXjkK8ctiaah+elKjVoLdHWbSaGZ3hTHD +X2hk0DpXP8inaJ2gt/sSALD6KX7xuLnEqKecJYqTw3/j5eLRoIu+1760MdL34YtO +KaluT6S6Rf2XSZLYN9Y/zhxTxvHt3GnmO0oEbje9b8tDBnUlk/KfI0aTRQDipPNQ +1vDtSUimb9DKGuxJhbOTrYM/xujtTknQ8s6bSQg8EU3nOwrqU4mFibUTS1WkecUs +wT/uXuU8oZEYWlmQAS9P3ztvD9+/gTt4aCYkTdjJIcQ2mrTRiXQm0SPXk/DADAm9 +ectdBAmsCNc8be4Rhm730FsfIkR9Oat+aIRETfYZTgFVFlJbMg== +-----END CERTIFICATE----- diff --git a/MiRegistry/certs/tls.key b/MiRegistry/certs/tls.key new file mode 100644 index 00000000..772f833f --- /dev/null +++ b/MiRegistry/certs/tls.key @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +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 +xoEgZa21U4u/pHUGaXGfAf8b8nmHCYtsx1KGha4BAoIBACARacetKnGJx+BDa3uC +i/OFUQpLLSTuhbvL2d4gSZnECBG1nRvif0/pR7S1s5F3YhkyZJAFXyKRueS4XWw6 +GgnQQaSIgMDjwYiaWnkDdwcNauU3V36VgSjgSIxospSTzufQxXzCJfjHvod5v4+U +6yhKduBtWuFzI6pbFy03RHbqO28xgEAsIMjN+4D9lkMgOSlRZPgFIZXQlZDc8+Cu +nAf/4t59x/xzgCFTWvSB+UMC2fUICEDT92YN6jw+nM0Cs2psjoAVd4fCrB5zH0y9 +vY2U2YMHYrll7/xIDkDnGScFq3Uj0K4eWZGM0SQy48j6Q5s/0a3PxUqirnYwHr2l +PakCggEBAM9ooIMzjTEY06Kk1IbHSfOb7NIDOoE2Rx33SbrFsb3SKVG/9+6dg86F +8ASe3IU+GbtFPdJnVCQ2XCWrRAKnohkU9zTVI3CE9uZEYASiVd4sNJZFGi8GJbaJ +iM2KiBJMLhrMH+Y2tAvhYvaC71Z4XIq6ZYuU8GusCg9ie0CSkaQoP2ZAyJ8kIirC +RAXXnWyXKp0ehyOqjDb0nntVInSVxcU9WpaFCreE2RsLSeM2w/BIq5T0KxjDcFQE +DI9GFTImb/3lFCnVSC+kuBxUTPshdsrNMqyA5tmCKCAbmjGyYJ5EHFLK0prIJngZ +0rB4NTFlZj6aLGuXdEpahpmitNJ0O5s= +-----END PRIVATE KEY----- diff --git a/MiRegistry/crearRegistry.sh b/MiRegistry/crearRegistry.sh new file mode 100644 index 00000000..67745643 --- /dev/null +++ b/MiRegistry/crearRegistry.sh @@ -0,0 +1,78 @@ +borrarActual () { + echo ">>>> Borrando registro actual..." + kubectl delete -f registry-deployment.yaml + kubectl delete -f registry-pv.yaml + echo ">>>> Borrando secrets actuales..." + kubectl delete secret auth-secret + kubectl delete secret certs-secret + kubectl delete secret reg-cred-secret + kubectl delete pod/nginx-pod +} + +step1 () { + echo "Step 1: Creating files for authentication\n\n" + echo ">>>> Creando directorios..." + mkdir -p /registry && cd "$_" + rm -rf auth/ + rm -rf certs/ + echo "Creando certificados..." + mkdir certs + openssl req -x509 -newkey rsa:4096 -days 365 -nodes -sha256 -keyout certs/tls.key -out certs/tls.crt -subj "/CN=docker-registry" -addext "subjectAltName = DNS:docker-registry" + echo "Creando autorizaciones..." + mkdir auth + docker run --rm --entrypoint htpasswd registry:2.7.0 -Bbn creylopez Rey-1176 > auth/htpasswd +} + +step2 () { + echo "Step 2: Using secrets to mount the certificates\n\n" + echo "Creando secret certs-secret..." + kubectl create secret tls certs-secret --cert=/registry/certs/tls.crt --key=/registry/certs/tls.key + echo "Creando secret auth-secret..." + kubectl create secret generic auth-secret --from-file=/registry/auth/htpasswd +} + +step3() { + echo "Step 3: Creating Persistent Volume and Claim for repository storage\n\n" + kubectl create -f /home/creylopez/k8s-cluster-projects/MiRegistry/registry-pv.yaml +} + +step4() { + echo "Step 4: Creating the Registry Pod\n\n" + kubectl create -f /home/creylopez/k8s-cluster-projects/MiRegistry/registry-deployment.yaml +} + +step5() { + echo "Step 5: Allowing access to the registry\n\n" + echo "Copio tls.cert a /etc..." + sudo cp certs/tls.crt /etc/docker/certs.d/docker-registry\:32000/ca.crt +} + +step6() { + echo "Step 6: Testing our Private Docker Registry" + docker login docker-registry:32000 -u creylopez -p Rey-1176 + echo "Creando secret reg-cred-secret..." + kubectl create secret docker-registry reg-cred-secret --docker-server=docker-registry:32000 --docker-username=creylopez --docker-password=Rey-1176 + echo "Descargo imagen nginx..." + docker pull nginx + echo "... la etiqueto..." + docker tag nginx:latest docker-registry:32000/minginx:1 + echo "... y la subo al registry... " + docker push docker-registry:32000/minginx:1 + #kubectl exec docker-registry-pod -it -- sh +} + +prueba() { + echo "Creo un pod con la nueva imagen..." + kubectl run nginx-pod --image=docker-registry:32000/minginx:v1 --overrides='{ "apiVersion": "v1", "spec": { "imagePullSecrets": [{"name": "reg-cred-secret"}] } }' +} + + +borrarActual +#step1 +#step2 +#step3 +#step4 +#step5 +#step6 +#final + diff --git a/MiRegistry/minginx-deployment.yaml b/MiRegistry/minginx-deployment.yaml new file mode 100644 index 00000000..cf61bf38 --- /dev/null +++ b/MiRegistry/minginx-deployment.yaml @@ -0,0 +1,21 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-deployment + labels: + app: nginx +spec: + selector: + matchLabels: + app: nginx + template: + metadata: + labels: + app: nginx + spec: + containers: + - name: nginx + image: mynginx:local + imagePullPolicy: Always + ports: + - containerPort: 80 diff --git a/MiRegistry/prueba.sh b/MiRegistry/prueba.sh index 2a89d6a9..b831c9d9 100644 --- a/MiRegistry/prueba.sh +++ b/MiRegistry/prueba.sh @@ -1,2 +1,2 @@ +kubectl run nginx-pod --image=docker-registry:5000/mynginx:v1 --overrides='{ "apiVersion": "v1", "spec": { "imagePullSecrets": [{"name": "reg-cred-secret"}] } }' -kubectl run nginx-pod --image=docker-registry:32000/minginx:2.0 --overrides='{ "apiVersion": "v1", "spec": { "imagePullSecrets": [{"name": "reg-cred-secret"}] } }' diff --git a/MiRegistry/registry-pv.yaml b/MiRegistry/registry-pv.yaml index 50004097..d0ebbb67 100644 --- a/MiRegistry/registry-pv.yaml +++ b/MiRegistry/registry-pv.yaml @@ -8,8 +8,6 @@ spec: accessModes: - ReadWriteOnce hostPath: -# Debería de llamarse registry el directorio, pero me equivoqué y por no volver a hacer todo... -#path: /mnt/cluster/repository path: /mnt/Externo/registry --- apiVersion: v1 diff --git a/MiRegistry/step-03.sh b/MiRegistry/step-03.sh deleted file mode 100644 index 9fbb6502..00000000 --- a/MiRegistry/step-03.sh +++ /dev/null @@ -1,2 +0,0 @@ -# creando un secret -kubectl create secret tls certs-secret --cert=/registry/certs/tls.crt --key=/registry/certs/tls.key diff --git a/MiRegistry/step-06-deployment.sh b/MiRegistry/step-06-deployment.sh deleted file mode 100644 index 47ad6b77..00000000 --- a/MiRegistry/step-06-deployment.sh +++ /dev/null @@ -1,3 +0,0 @@ -# ya hay otra shell para esto -# Crea el pod -#kubectl create -f registry-deployment.yaml diff --git a/MiRegistry/step-01.sh b/MiRegistry/step-10.sh similarity index 100% rename from MiRegistry/step-01.sh rename to MiRegistry/step-10.sh diff --git a/MiRegistry/step-02.sh b/MiRegistry/step-20.sh similarity index 79% rename from MiRegistry/step-02.sh rename to MiRegistry/step-20.sh index 85392907..ababe298 100644 --- a/MiRegistry/step-02.sh +++ b/MiRegistry/step-20.sh @@ -1,4 +1,5 @@ # Crear htpasswd para autenticación de usuario -sudo docker run --rm --entrypoint htpasswd registry:2.6.2 -Bbn creylopez Rey-1176 +mkdir auth +sudo docker run --rm --entrypoint htpasswd registry:2.6.2 -Bbn creylopez Rey-1176 > auth/htpasswd echo "Copia la salida y pegala en /registry/auth/htpasswd" diff --git a/MiRegistry/step-30.sh b/MiRegistry/step-30.sh new file mode 100644 index 00000000..fb6f7915 --- /dev/null +++ b/MiRegistry/step-30.sh @@ -0,0 +1,3 @@ +# creando un secret +#kubectl create secret tls certs-secret --cert=/registry/certs/tls.crt --key=/registry/certs/tls.key --server=https://k8s-server:6443 +kubectl create secret tls certs-secret --cert=/registry/certs/tls.crt --key=/registry/certs/tls.key diff --git a/MiRegistry/step-04.sh b/MiRegistry/step-40.sh similarity index 100% rename from MiRegistry/step-04.sh rename to MiRegistry/step-40.sh diff --git a/MiRegistry/step-60.sh b/MiRegistry/step-60.sh new file mode 100644 index 00000000..7726c3fa --- /dev/null +++ b/MiRegistry/step-60.sh @@ -0,0 +1,5 @@ +# +cd /registry +sudo mkdir /etc/docker/certs.d/docker-registry:32000 +sudo cp certs/tls.crt /etc/docker/certs.d/docker-registry\:32000/ca.crt + diff --git a/MiRegistry/step-65.sh b/MiRegistry/step-65.sh new file mode 100644 index 00000000..8f86f8f5 --- /dev/null +++ b/MiRegistry/step-65.sh @@ -0,0 +1 @@ +kubectl create secret docker-registry reg-cred-secret --docker-server=k8s-server:32000 --docker-username=creylopez --docker-password=Rey-1176 diff --git a/MiRegistry/step-07.sh b/MiRegistry/step-68.sh similarity index 100% rename from MiRegistry/step-07.sh rename to MiRegistry/step-68.sh diff --git a/MiRegistry/step-70.sh b/MiRegistry/step-70.sh new file mode 100644 index 00000000..86143c8a --- /dev/null +++ b/MiRegistry/step-70.sh @@ -0,0 +1,4 @@ +# ya hay otra shell para esto +# Crea el pod +kubectl create -f registry-pv.yaml +kubectl create -f registry-deployment.yaml diff --git a/MiRegistry/step-90.sh b/MiRegistry/step-90.sh new file mode 100644 index 00000000..317cbe9b --- /dev/null +++ b/MiRegistry/step-90.sh @@ -0,0 +1,7 @@ +docker pull nginx +docker tag nginx:latest docker-registry:32000/mynginx:v1 +docker push docker-registry:32000/mynginx:v1 + + +# para probar +# kubectl exec docker-registry-pod -it -- sh diff --git a/PHPMysql/8.2/creaImagen.sh b/PHPMysql/8.2/creaImagen.sh deleted file mode 100644 index 2536c109..00000000 --- a/PHPMysql/8.2/creaImagen.sh +++ /dev/null @@ -1,2 +0,0 @@ -docker build --no-cache -t docker-registry:32000/phpmysql:2.0 . -docker push docker-registry:32000/phpmysql:2.0 diff --git a/copyDBK8S b/copyDBK8S new file mode 100755 index 00000000..1c250a6e --- /dev/null +++ b/copyDBK8S @@ -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 diff --git a/copyGogsDB b/copyGogsDB new file mode 100755 index 00000000..f15733c3 --- /dev/null +++ b/copyGogsDB @@ -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 --column-statistics=0 -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 diff --git a/copyMediawikiDB b/copyMediawikiDB new file mode 100755 index 00000000..b128183b --- /dev/null +++ b/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 --column-statistics=0 -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/copyNextcloudDB b/copyNextcloudDB new file mode 100755 index 00000000..b8c1313e --- /dev/null +++ b/copyNextcloudDB @@ -0,0 +1,29 @@ +# 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_nc +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 nextcloud|grep mysql|cut -f1 -d' '` -n nextcloud -- /usr/bin/mysqldump --column-statistics=0 -u root --password=Dsa-0213 nextcloud_db > $new_name + +message="Backup stored "$today + +sudo zip $new_name.zip $new_name + +#sudo -u creylopez mail -s "Nextcloud backup finished" "creylopez@yahoo.es" -a $new_name.zip +#sudo -u creylopez cat $new_name | mail -s "Nextcloud backup finished" "creylopez@yahoo.es" + +sudo -u creylopez echo "Nextcloud backup adjunto" |mail -s "Backup de nextcloud" creylopez@yahoo.es -A $new_name.zip + +#sudo rm $new_name.* diff --git a/copyRepostajesDB b/copyRepostajesDB new file mode 100755 index 00000000..7d774fe6 --- /dev/null +++ b/copyRepostajesDB @@ -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_repostajes +new_name=$file_name-$today.sql +echo "Backup file name: " "$new_name" + +#sudo docker exec `sudo docker container ls | grep mysql_repostajes | cut -f1 -d' '` /usr/bin/mysqldump -u root --password=Dsa-0213 repostajes > $new_name +sudo kubectl --kubeconfig /home/creylopez/.kube/config exec `kubectl --kubeconfig /home/creylopez/.kube/config get pod -n repostajes|grep mysql|cut -f1 -d' '` -n repostajes -- /usr/bin/mysqldump --column-statistics=0 -u root --password=Dsa-0213 automoviles > $new_name + +message="Backup stored "$today + +sudo -u creylopez cat $new_name | mail -s "Repostajes backup finished" "creylopez@yahoo.es" + +sudo rm $new_name