| @ -0,0 +1,101 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: drupal | |||
| namespace: drupal | |||
| labels: | |||
| app: drupal | |||
| spec: | |||
| type: NodePort | |||
| ports: | |||
| - port: 80 | |||
| nodePort: 30898 | |||
| targetPort: drupal | |||
| selector: | |||
| app: drupal | |||
| tier: frontend | |||
| --- | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: drupal-pv-claim | |||
| namespace: drupal | |||
| labels: | |||
| app: drupal | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| storageClassName: "" | |||
| resources: | |||
| requests: | |||
| storage: 10Gi | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: drupal | |||
| namespace: drupal | |||
| labels: | |||
| app: drupal | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: drupal | |||
| tier: frontend | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: drupal | |||
| tier: frontend | |||
| spec: | |||
| initContainers: | |||
| - | |||
| name: init-sites-volume | |||
| image: drupal:latest | |||
| command: ['/bin/bash', '-c'] | |||
| args: ['cp -r /var/www/html/sites/ /data/; chown www-data:www-data /data/ -R'] | |||
| volumeMounts: | |||
| - mountPath: /data | |||
| name: drupal-persistent-storage | |||
| containers: | |||
| - image: drupal:latest | |||
| name: drupal | |||
| env: | |||
| - name: DB_TYPE | |||
| value: mysql | |||
| - name: DB_NAME | |||
| value: drupal | |||
| - name: DB_HOST | |||
| value: drupal-mysql | |||
| - name: DB_PASS | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: mysqldrupal-pass | |||
| key: password | |||
| - name: DB_USER | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: mysqldrupal-pass | |||
| key: db_user | |||
| ports: | |||
| - containerPort: 80 | |||
| name: drupal | |||
| volumeMounts: | |||
| - name: drupal-persistent-storage | |||
| mountPath: /var/www/html/modules | |||
| subPath: modules | |||
| - name: drupal-persistent-storage | |||
| mountPath: /var/www/html/profiles | |||
| subPath: profiles | |||
| - name: drupal-persistent-storage | |||
| mountPath: /var/www/html/sites | |||
| subPath: sites | |||
| - name: drupal-persistent-storage | |||
| mountPath: /var/www/html/themes | |||
| subPath: themes | |||
| volumes: | |||
| - name: drupal-persistent-storage | |||
| persistentVolumeClaim: | |||
| claimName: drupal-pv-claim | |||
| @ -0,0 +1,18 @@ | |||
| apiVersion: networking.k8s.io/v1 | |||
| kind: Ingress | |||
| metadata: | |||
| name: drupal-ingress | |||
| namespace: drupal | |||
| spec: | |||
| ingressClassName: nginx | |||
| rules: | |||
| - host: "reymota.ddns.net" | |||
| http: | |||
| paths: | |||
| - pathType: Prefix | |||
| path: "/drupal" | |||
| backend: | |||
| service: | |||
| name: drupal | |||
| port: | |||
| number: 80 | |||
| @ -0,0 +1,59 @@ | |||
| apiVersion: networking.k8s.io/v1 | |||
| kind: Ingress | |||
| metadata: | |||
| name: minimal-ingress | |||
| annotations: | |||
| kubernetes.io/ingress.class: "nginx" | |||
| cert-manager.io/cluster-issuer: "letsencrypt" | |||
| spec: | |||
| tls: | |||
| - hosts: | |||
| - reymota.ddns.net | |||
| secretName: letsencrypt | |||
| rules: | |||
| - host: reymota.ddns.net | |||
| http: | |||
| paths: | |||
| - path: / | |||
| pathType: Prefix | |||
| backend: | |||
| service: | |||
| name: app | |||
| port: | |||
| number: 80 | |||
| --- | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: app | |||
| spec: | |||
| selector: | |||
| app: app | |||
| type: NodePort | |||
| ports: | |||
| - name: http | |||
| port: 80 | |||
| nodePort: 30580 | |||
| targetPort: 80 | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: app-deployment | |||
| labels: | |||
| app: app | |||
| spec: | |||
| replicas: 1 | |||
| selector: | |||
| matchLabels: | |||
| app: app | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: app | |||
| spec: | |||
| containers: | |||
| - name: app | |||
| image: nginx:latest | |||
| ports: | |||
| - containerPort: 80 | |||
| @ -1,4 +0,0 @@ | |||
| kubectl delete -f configmap.yaml | |||
| kubectl delete -f deployment.yaml | |||
| kubectl delete -f service.yaml | |||
| kubectl delete -f ingress.yaml | |||
| @ -1,16 +0,0 @@ | |||
| apiVersion: v1 | |||
| kind: ConfigMap | |||
| metadata: | |||
| name: https-config | |||
| data: | |||
| default.conf: | | |||
| server { | |||
| listen 80; | |||
| listen [::]:80; | |||
| server_name _; | |||
| location / { | |||
| add_header Content-Type text/plain; # Prevents download | |||
| return 200 "¡Hola mundo! Demo de Kubernetes + Let's encrypt."; | |||
| } | |||
| } | |||
| @ -1,6 +0,0 @@ | |||
| kubectl create -f configmap.yaml | |||
| kubectl create -f deployment.yaml | |||
| kubectl create -f service.yaml | |||
| kubectl create -f ingress.yaml | |||
| watch kubectl get all | |||
| kubectl describe ing kubernetes-demo-app-ingress-service | |||
| @ -0,0 +1 @@ | |||
| kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.10.0/cert-manager.yaml | |||
| @ -1,33 +0,0 @@ | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: https | |||
| labels: | |||
| app: https | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: https | |||
| tier: frontend | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: https | |||
| tier: frontend | |||
| spec: | |||
| containers: | |||
| - image: nginx | |||
| name: https | |||
| ports: | |||
| - containerPort: 80 | |||
| volumeMounts: | |||
| - name: https-configs | |||
| mountPath: /etc/nginx/conf.d | |||
| # Load the configuration files for nginx | |||
| volumes: | |||
| - name: https-configs | |||
| configMap: | |||
| name: https-config | |||
| @ -1,52 +0,0 @@ | |||
| apiVersion: v1 | |||
| kind: ConfigMap | |||
| metadata: | |||
| name: nginx-config | |||
| data: | |||
| default.conf: | | |||
| server { | |||
| listen 80; | |||
| listen [::]:80; | |||
| server_name _; | |||
| location / { | |||
| add_header Content-Type text/plain; # Prevents download | |||
| return 200 "Hello world! Kubernetes + Let's encrypt demo."; | |||
| } | |||
| --- | |||
| apiVersion: v1 | |||
| kind: Deployment | |||
| metadata: | |||
| labels: | |||
| app: nginx | |||
| name: nginx | |||
| spec: | |||
| replicas: 1 | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: nginx | |||
| spec: | |||
| containers: | |||
| - name: nginx | |||
| image: nginx | |||
| ports: | |||
| - containerPort: 80 | |||
| volumeMounts: | |||
| - name: nginx-configs | |||
| mountPath: /etc/nginx/conf.d | |||
| # Load the configuration files for nginx | |||
| volumes: | |||
| - name: nginx-configs | |||
| configMap: | |||
| name: nginx-config | |||
| --- | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: nginx | |||
| spec: | |||
| selector: | |||
| app: nginx | |||
| ports: | |||
| - protocol: "TCP" | |||
| port: 80 | |||
| @ -1,17 +0,0 @@ | |||
| apiVersion: networking.k8s.io/v1 | |||
| kind: Ingress | |||
| metadata: | |||
| name: "kubernetes-demo-app-ingress-service" | |||
| spec: | |||
| rules: | |||
| - host: kubernetes-letsencrypt.jorge.fail | |||
| http: | |||
| paths: | |||
| # The * is needed so that all traffic gets redirected to nginx | |||
| - path: /* | |||
| pathType: Prefix | |||
| backend: | |||
| service: | |||
| name: https | |||
| port: | |||
| number: 80 | |||
| @ -0,0 +1,23 @@ | |||
| apiVersion: networking.k8s.io/v1 | |||
| kind: Ingress | |||
| metadata: | |||
| name: minimal-ingress | |||
| annotations: | |||
| kubernetes.io/ingress.class: "nginx" | |||
| cert-manager.io/cluster-issuer: "letsencrypt" | |||
| spec: | |||
| tls: | |||
| - hosts: | |||
| - reymota.ddns.net | |||
| secretName: letsencrypt | |||
| rules: | |||
| - host: reymota.ddns.net | |||
| http: | |||
| paths: | |||
| - path: / | |||
| pathType: Prefix | |||
| backend: | |||
| service: | |||
| name: nginx-example | |||
| port: | |||
| number: 443 | |||
| @ -0,0 +1,15 @@ | |||
| apiVersion: cert-manager.io/v1 | |||
| kind: ClusterIssuer | |||
| metadata: | |||
| name: letsencrypt | |||
| namespace: cert-manager | |||
| spec: | |||
| acme: | |||
| server: https://acme-v02.api.letsencrypt.org/directory | |||
| email: celestino.rey@gmail.com | |||
| privateKeySecretRef: | |||
| name: letsencrypt | |||
| solvers: | |||
| - http01: | |||
| ingress: | |||
| class: nginx | |||
| @ -1,12 +0,0 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: https | |||
| spec: | |||
| selector: | |||
| app: https | |||
| type: NodePort | |||
| ports: | |||
| - protocol: "TCP" | |||
| port: 80 | |||
| nodePort: 30058 | |||
| @ -0,0 +1,2 @@ | |||
| kubectl create -k ./ | |||
| watch kubectl get all -n mastodon | |||
| @ -0,0 +1 @@ | |||
| kubectl exec -ti deployment.apps/mastodon-pgsql -n mastodon -- /bin/bash | |||
| @ -0,0 +1,7 @@ | |||
| #!/usr/bin/env bash | |||
| kubectl create -f pgadmin.yaml | |||
| sleep 15s | |||
| kubectl logs pgadmin-76gjgvvjh-yghg | |||
| ## Access pgAdmin | |||
| ## https://<IP>:31560 | |||
| ## username/password: user@e-mail.com / password | |||
| @ -0,0 +1,12 @@ | |||
| secretGenerator: | |||
| - name: pgsql-pass | |||
| namespace: mastodon | |||
| literals: | |||
| - password=Dsa-0213 | |||
| - db_user=root | |||
| - db_passwd=Dsa-0213 | |||
| resources: | |||
| - pv-local-pgsql.yaml | |||
| - namespace.yaml | |||
| - postgresql-deployment.yaml | |||
| - pgadmin.yaml | |||
| @ -0,0 +1,4 @@ | |||
| apiVersion: v1 | |||
| kind: Namespace | |||
| metadata: | |||
| name: mastodon | |||
| @ -0,0 +1 @@ | |||
| kubectl delete -k ./ | |||
| @ -0,0 +1,49 @@ | |||
| --- | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| labels: | |||
| app: pgadmin | |||
| name: pgadmin | |||
| namespace: mastodon | |||
| spec: | |||
| ports: | |||
| - name: padmin-port | |||
| nodePort: 30165 | |||
| port: 80 | |||
| targetPort: 80 | |||
| selector: | |||
| app: pgadmin | |||
| type: NodePort | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: pgadmin | |||
| namespace: mastodon | |||
| spec: | |||
| replicas: 1 | |||
| selector: | |||
| matchLabels: | |||
| app: pgadmin | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: pgadmin | |||
| spec: | |||
| containers: | |||
| - env: | |||
| - name: PGADMIN_DEFAULT_EMAIL | |||
| value: celestino.rey@gmail.com | |||
| - name: PGADMIN_DEFAULT_PASSWORD | |||
| value: Rey-1176 | |||
| - name: PGADMIN_PORT | |||
| value: "80" | |||
| image: dpage/pgadmin4:3.6 | |||
| imagePullPolicy: IfNotPresent | |||
| name: pgadmin | |||
| ports: | |||
| - containerPort: 80 | |||
| resources: | |||
| limits: | |||
| memory: 4096Mi | |||
| @ -0,0 +1,68 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: mastodon-pgsql | |||
| namespace: mastodon | |||
| labels: | |||
| app: mastodon | |||
| spec: | |||
| type: NodePort | |||
| ports: | |||
| - port: 5432 | |||
| name: pgsql | |||
| nodePort: 30798 | |||
| targetPort: pgsql | |||
| selector: | |||
| app: mastodon | |||
| tier: pgsql | |||
| --- | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: pgsql-pv-claim | |||
| namespace: mastodon | |||
| labels: | |||
| app: mastodon | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| resources: | |||
| requests: | |||
| storage: 20Gi | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: mastodon-pgsql | |||
| namespace: mastodon | |||
| labels: | |||
| app: mastodon | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: mastodon | |||
| tier: pgsql | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: mastodon | |||
| tier: pgsql | |||
| spec: | |||
| containers: | |||
| - image: postgres | |||
| name: pgsql | |||
| env: | |||
| - name: POSTGRES_PASSWORD | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: pgsql-pass | |||
| key: password | |||
| volumeMounts: | |||
| - name: pgsql-persistent-storage | |||
| mountPath: /var/lib/postgresql/data | |||
| volumes: | |||
| - name: pgsql-persistent-storage | |||
| persistentVolumeClaim: | |||
| claimName: pgsql-pv-claim | |||
| @ -0,0 +1,11 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolume | |||
| metadata: | |||
| name: pg-data | |||
| spec: | |||
| capacity: | |||
| storage: 20Gi | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| hostPath: | |||
| path: "/mnt/cluster/mastodon/mastodon-db" | |||
| @ -0,0 +1 @@ | |||
| kubectl delete -f https://raw.githubusercontent.com/metallb/metallb/v0.13.7/config/manifests/metallb-native.yaml | |||
| @ -0,0 +1 @@ | |||
| kubectl delete -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.5.1/deploy/static/provider/cloud/deploy.yaml | |||
| @ -0,0 +1,4 @@ | |||
| kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.13.7/config/manifests/metallb-native.yaml | |||
| watch kubectl get all -n metallb-system | |||
| kubectl apply -f ipaddresspool.yaml | |||
| kubectl apply -f announceips.yaml | |||
| @ -0,0 +1 @@ | |||
| kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.5.1/deploy/static/provider/cloud/deploy.yaml | |||
| @ -0,0 +1 @@ | |||
| kubectl describe ingress.networking.k8s.io nginx-ingress | |||
| @ -0,0 +1,25 @@ | |||
| kind: Pod | |||
| apiVersion: v1 | |||
| metadata: | |||
| name: apple-app | |||
| labels: | |||
| app: apple | |||
| spec: | |||
| containers: | |||
| - name: apple-app | |||
| image: hashicorp/http-echo | |||
| args: | |||
| - "-text=apple" | |||
| --- | |||
| kind: Service | |||
| apiVersion: v1 | |||
| metadata: | |||
| name: apple-service | |||
| spec: | |||
| type: LoadBalancer | |||
| selector: | |||
| app: apple | |||
| ports: | |||
| - port: 5678 # Default port for image | |||
| @ -0,0 +1,25 @@ | |||
| kind: Pod | |||
| apiVersion: v1 | |||
| metadata: | |||
| name: banana-app | |||
| labels: | |||
| app: banana | |||
| spec: | |||
| containers: | |||
| - name: banana-app | |||
| image: hashicorp/http-echo | |||
| args: | |||
| - "-text=banana" | |||
| --- | |||
| kind: Service | |||
| apiVersion: v1 | |||
| metadata: | |||
| name: banana-service | |||
| spec: | |||
| type: LoadBalancer | |||
| selector: | |||
| app: banana | |||
| ports: | |||
| - port: 5678 # Default port for image | |||
| @ -0,0 +1,31 @@ | |||
| apiVersion: networking.k8s.io/v1 | |||
| kind: Ingress | |||
| metadata: | |||
| name: example-ingress | |||
| annotations: | |||
| ingress.kubernetes.io/rewrite-target: / | |||
| spec: | |||
| rules: | |||
| - http: | |||
| paths: | |||
| - path: /apple | |||
| pathType: Prefix | |||
| backend: | |||
| service: | |||
| name: apple-service | |||
| port: | |||
| number: 5678 | |||
| - path: /banana | |||
| pathType: Prefix | |||
| backend: | |||
| service: | |||
| name: banana-service | |||
| port: | |||
| number: 5678 | |||
| - path: /wordpress | |||
| pathType: Prefix | |||
| backend: | |||
| service: | |||
| name: wordpress | |||
| port: | |||
| number: 80 | |||
| @ -0,0 +1 @@ | |||
| kubectl --namespace ingress-nginx get services -o wide | |||
| @ -0,0 +1 @@ | |||
| kubectl describe ingress.networking.k8s.io nextcloud-ingress -n nextcloud | |||
| @ -0,0 +1,20 @@ | |||
| apiVersion: networking.k8s.io/v1 | |||
| kind: Ingress | |||
| metadata: | |||
| name: nextcloud-ingress | |||
| namespace: nextcloud | |||
| annotations: | |||
| nginx.ingress.kubernetes.io/rewrite-target: /$2 | |||
| spec: | |||
| ingressClassName: nginx | |||
| rules: | |||
| - host: "reymota.ddns.net" | |||
| http: | |||
| paths: | |||
| - pathType: Prefix | |||
| path: "/nextcloud" | |||
| backend: | |||
| service: | |||
| name: nextcloud-server | |||
| port: | |||
| number: 80 | |||
| @ -0,0 +1,48 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: nextcloud-server | |||
| namespace: nextcloud | |||
| labels: | |||
| app: nextcloud | |||
| spec: | |||
| selector: | |||
| pod-label: nextcloud-server-pod | |||
| type: NodePort | |||
| ports: | |||
| - port: 80 | |||
| nodePort: 30289 | |||
| targetPort: nextcloud | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: nextcloud-server | |||
| namespace: nextcloud | |||
| labels: | |||
| app: nextcloud | |||
| spec: | |||
| replicas: 1 | |||
| selector: | |||
| matchLabels: | |||
| pod-label: nextcloud-server-pod | |||
| template: | |||
| metadata: | |||
| labels: | |||
| pod-label: nextcloud-server-pod | |||
| spec: | |||
| containers: | |||
| - name: nextcloud | |||
| image: nextcloud | |||
| volumeMounts: | |||
| - name: server-storage | |||
| mountPath: /var/www/html | |||
| subPath: server-data | |||
| ports: | |||
| - containerPort: 80 | |||
| name: nextcloud | |||
| volumes: | |||
| - name: server-storage | |||
| persistentVolumeClaim: | |||
| claimName: dbnc-pv-claim | |||
| @ -0,0 +1,17 @@ | |||
| apiVersion: networking.k8s.io/v1 | |||
| kind: Ingress | |||
| metadata: | |||
| name: reymota-ingress | |||
| annotations: | |||
| ingress.kubernetes.io/rewrite-target: / | |||
| spec: | |||
| rules: | |||
| - http: | |||
| paths: | |||
| - path: /nginx | |||
| pathType: Prefix | |||
| backend: | |||
| service: | |||
| name: nginx-example | |||
| port: | |||
| number: 80 | |||
| @ -0,0 +1,60 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: nginx-example | |||
| spec: | |||
| type: LoadBalancer | |||
| ports: | |||
| - name: http | |||
| port: 80 | |||
| selector: | |||
| app: nginx | |||
| --- | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: nginx-pv-claim | |||
| labels: | |||
| app: nginx | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteMany | |||
| storageClassName: "" | |||
| resources: | |||
| requests: | |||
| storage: 2Gi | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: nginx-example | |||
| labels: | |||
| app: nginx | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: nginx | |||
| tier: frontend | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: nginx | |||
| tier: frontend | |||
| spec: | |||
| containers: | |||
| - name: nginx | |||
| #image: linuxserver/nginx | |||
| image: httpd | |||
| ports: | |||
| - containerPort: 80 | |||
| name: "nginx-http" | |||
| volumeMounts: | |||
| - name: nginx-www-folder | |||
| # mountPath: /config/www | |||
| mountPath: /usr/local/apache2/htdocs | |||
| volumes: | |||
| - name: nginx-www-folder | |||
| persistentVolumeClaim: | |||
| claimName: nginx-pv-claim | |||
| @ -0,0 +1,62 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: nginx-example | |||
| spec: | |||
| type: NodePort | |||
| ports: | |||
| - name: http | |||
| port: 80 | |||
| nodePort: 30080 | |||
| targetPort: nginx-http | |||
| selector: | |||
| app: nginx | |||
| --- | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: nginx-pv-claim | |||
| labels: | |||
| app: nginx | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteMany | |||
| storageClassName: "" | |||
| resources: | |||
| requests: | |||
| storage: 2Gi | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: nginx-example | |||
| labels: | |||
| app: nginx | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: nginx | |||
| tier: frontend | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: nginx | |||
| tier: frontend | |||
| spec: | |||
| containers: | |||
| - name: nginx | |||
| #image: linuxserver/nginx | |||
| image: httpd | |||
| ports: | |||
| - containerPort: 80 | |||
| name: "nginx-http" | |||
| volumeMounts: | |||
| - name: nginx-www-folder | |||
| # mountPath: /config/www | |||
| mountPath: /usr/local/apache2/htdocs | |||
| volumes: | |||
| - name: nginx-www-folder | |||
| persistentVolumeClaim: | |||
| claimName: nginx-pv-claim | |||
| @ -0,0 +1,3 @@ | |||
| kubectl create -f pv-local-nginx.yaml | |||
| kubectl create -k ./ | |||
| #watch kubectl get all | |||
| @ -0,0 +1 @@ | |||
| kubectl exec -ti deployment.apps/nginx-crey -- /bin/bash | |||
| @ -0,0 +1,16 @@ | |||
| apiVersion: networking.k8s.io/v1 | |||
| kind: Ingress | |||
| metadata: | |||
| name: nginx-ingress | |||
| spec: | |||
| ingressClassName: nginx | |||
| rules: | |||
| - http: | |||
| paths: | |||
| - pathType: Prefix | |||
| path: / | |||
| backend: | |||
| service: | |||
| name: nginx-crey | |||
| port: | |||
| number: 80 | |||
| @ -0,0 +1,3 @@ | |||
| resources: | |||
| - miweb-deployment.yaml | |||
| - ingress.yaml | |||
| @ -0,0 +1,62 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: nginx-crey | |||
| spec: | |||
| type: ClusterIP | |||
| ports: | |||
| - name: http | |||
| port: 80 | |||
| targetPort: nginx-http | |||
| protocol: TCP | |||
| selector: | |||
| app: nginx | |||
| --- | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: nginx-pv-claim | |||
| labels: | |||
| app: nginx | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteMany | |||
| storageClassName: "" | |||
| resources: | |||
| requests: | |||
| storage: 2Gi | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: nginx-crey | |||
| labels: | |||
| app: nginx | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: nginx | |||
| tier: frontend | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: nginx | |||
| tier: frontend | |||
| spec: | |||
| containers: | |||
| - name: nginx | |||
| image: linuxserver/nginx | |||
| #image: httpd | |||
| ports: | |||
| - containerPort: 80 | |||
| name: "nginx-http" | |||
| volumeMounts: | |||
| - name: nginx-www-folder | |||
| mountPath: /config/www | |||
| #mountPath: /usr/local/apache2/htdocs | |||
| volumes: | |||
| - name: nginx-www-folder | |||
| persistentVolumeClaim: | |||
| claimName: nginx-pv-claim | |||
| @ -0,0 +1,60 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: nginx-example | |||
| spec: | |||
| type: LoadBalancer | |||
| ports: | |||
| - name: http | |||
| port: 80 | |||
| selector: | |||
| app: nginx | |||
| --- | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: nginx-pv-claim | |||
| labels: | |||
| app: nginx | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteMany | |||
| storageClassName: "" | |||
| resources: | |||
| requests: | |||
| storage: 2Gi | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: nginx-example | |||
| labels: | |||
| app: nginx | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: nginx | |||
| tier: frontend | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: nginx | |||
| tier: frontend | |||
| spec: | |||
| containers: | |||
| - name: nginx | |||
| #image: linuxserver/nginx | |||
| image: httpd | |||
| ports: | |||
| - containerPort: 80 | |||
| name: "nginx-http" | |||
| volumeMounts: | |||
| - name: nginx-www-folder | |||
| # mountPath: /config/www | |||
| mountPath: /usr/local/apache2/htdocs | |||
| volumes: | |||
| - name: nginx-www-folder | |||
| persistentVolumeClaim: | |||
| claimName: nginx-pv-claim | |||
| @ -0,0 +1,62 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: nginx-example | |||
| spec: | |||
| type: NodePort | |||
| ports: | |||
| - name: http | |||
| port: 80 | |||
| nodePort: 30080 | |||
| targetPort: nginx-http | |||
| selector: | |||
| app: nginx | |||
| --- | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: nginx-pv-claim | |||
| labels: | |||
| app: nginx | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteMany | |||
| storageClassName: "" | |||
| resources: | |||
| requests: | |||
| storage: 2Gi | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: nginx-example | |||
| labels: | |||
| app: nginx | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: nginx | |||
| tier: frontend | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: nginx | |||
| tier: frontend | |||
| spec: | |||
| containers: | |||
| - name: nginx | |||
| #image: linuxserver/nginx | |||
| image: httpd | |||
| ports: | |||
| - containerPort: 80 | |||
| name: "nginx-http" | |||
| volumeMounts: | |||
| - name: nginx-www-folder | |||
| # mountPath: /config/www | |||
| mountPath: /usr/local/apache2/htdocs | |||
| volumes: | |||
| - name: nginx-www-folder | |||
| persistentVolumeClaim: | |||
| claimName: nginx-pv-claim | |||
| @ -0,0 +1,63 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: nginx-example | |||
| spec: | |||
| type: NodePort | |||
| ports: | |||
| - name: http | |||
| port: 80 | |||
| nodePort: 30080 | |||
| targetPort: nginx-http | |||
| selector: | |||
| app: nginx | |||
| --- | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: nginx-pv-claim | |||
| labels: | |||
| app: nginx | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteMany | |||
| storageClassName: "" | |||
| resources: | |||
| requests: | |||
| storage: 2Gi | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: nginx-example | |||
| labels: | |||
| app: nginx | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: nginx | |||
| tier: frontend | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: nginx | |||
| tier: frontend | |||
| spec: | |||
| containers: | |||
| - name: nginx | |||
| image: steveltn/https-portal:1 | |||
| ports: | |||
| - containerPort: 80 | |||
| name: "nginx-http" | |||
| volumeMounts: | |||
| - name: nginx-www-folder | |||
| mountPath: /config/www | |||
| env: | |||
| - name: DOMAINS | |||
| value: 'reymota.ddns.net -> http://nginx:80' | |||
| volumes: | |||
| - name: nginx-www-folder | |||
| persistentVolumeClaim: | |||
| claimName: nginx-pv-claim | |||
| @ -0,0 +1,2 @@ | |||
| kubectl delete -k ./ | |||
| kubectl delete -f pv-local-nginx.yaml | |||
| @ -0,0 +1,20 @@ | |||
| apiVersion: v1 | |||
| kind: Pod | |||
| metadata: | |||
| name: nginx-example | |||
| labels: | |||
| app: nginx | |||
| spec: | |||
| containers: | |||
| - name: nginx | |||
| image: linuxserver/nginx | |||
| ports: | |||
| - containerPort: 80 | |||
| name: "nginx-http" | |||
| volumeMounts: | |||
| - name: nginx-www-folder | |||
| mountPath: /config/www | |||
| volumes: | |||
| - name: nginx-www-folder | |||
| persistentVolumeClaim: | |||
| claimName: nginx-pv-claim | |||
| @ -0,0 +1,11 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolume | |||
| metadata: | |||
| name: www-nginx-folder | |||
| spec: | |||
| capacity: | |||
| storage: 2Gi | |||
| accessModes: | |||
| - ReadWriteMany | |||
| hostPath: | |||
| path: "/mnt/cluster/nginx" | |||
| @ -0,0 +1,12 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolume | |||
| metadata: | |||
| name: www-nginx-folder | |||
| spec: | |||
| capacity: | |||
| storage: 2Gi | |||
| accessModes: | |||
| - ReadWriteMany | |||
| nfs: | |||
| server: k8s-router | |||
| path: "/media/discoexterno/nginx" | |||
| @ -0,0 +1,13 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: nginx-pv-claim | |||
| labels: | |||
| app: nginx | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteMany | |||
| storageClassName: "" | |||
| resources: | |||
| requests: | |||
| storage: 2Gi | |||
| @ -0,0 +1,11 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: nginx-lb | |||
| spec: | |||
| type: LoadBalancer | |||
| ports: | |||
| - port: 80 | |||
| targetPort: nginx-http | |||
| selector: | |||
| app: nginx | |||
| @ -0,0 +1,13 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: nginx-example | |||
| spec: | |||
| type: NodePort | |||
| ports: | |||
| - name: http | |||
| port: 80 | |||
| nodePort: 30080 | |||
| targetPort: nginx-http | |||
| selector: | |||
| app: nginx | |||
| @ -0,0 +1 @@ | |||
| kubectl describe ingress.networking.k8s.io wordpress-ingress -n wordpress | |||
| @ -0,0 +1,18 @@ | |||
| apiVersion: networking.k8s.io/v1 | |||
| kind: Ingress | |||
| metadata: | |||
| name: wordpress-ingress | |||
| namespace: wordpress | |||
| spec: | |||
| ingressClassName: nginx | |||
| rules: | |||
| - host: "reymota.ddns.net" | |||
| http: | |||
| paths: | |||
| - pathType: Prefix | |||
| path: "/wordpress" | |||
| backend: | |||
| service: | |||
| name: wordpress | |||
| port: | |||
| number: 80 | |||
| @ -0,0 +1,76 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: wordpress | |||
| namespace: wordpress | |||
| labels: | |||
| app: wordpress | |||
| spec: | |||
| ports: | |||
| - port: 80 | |||
| targetPort: wordpress | |||
| selector: | |||
| app: wordpress | |||
| tier: frontend | |||
| --- | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: wp-pv-claim | |||
| namespace: wordpress | |||
| labels: | |||
| app: wordpress | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| storageClassName: "" | |||
| resources: | |||
| requests: | |||
| storage: 10Gi | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: wordpress | |||
| namespace: wordpress | |||
| labels: | |||
| app: wordpress | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: wordpress | |||
| tier: frontend | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: wordpress | |||
| tier: frontend | |||
| spec: | |||
| containers: | |||
| - image: wordpress:5.7.2-php7.4-apache | |||
| name: wordpress | |||
| env: | |||
| - name: WORDPRESS_DB_HOST | |||
| value: wordpress-mysql | |||
| - name: WORDPRESS_DB_PASSWORD | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: mysqlwp-pass | |||
| key: password | |||
| - name: WORDPRESS_DB_USER | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: mysqlwp-pass | |||
| key: db_user | |||
| ports: | |||
| - containerPort: 80 | |||
| name: wordpress | |||
| volumeMounts: | |||
| - name: wordpress-persistent-storage | |||
| mountPath: /var/www/html | |||
| volumes: | |||
| - name: wordpress-persistent-storage | |||
| persistentVolumeClaim: | |||
| claimName: wp-pv-claim | |||
| @ -0,0 +1,78 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: wordpress | |||
| namespace: wordpress | |||
| labels: | |||
| app: wordpress | |||
| spec: | |||
| type: NodePort | |||
| ports: | |||
| - port: 80 | |||
| nodePort: 30088 | |||
| targetPort: wordpress | |||
| selector: | |||
| app: wordpress | |||
| tier: frontend | |||
| --- | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: wp-pv-claim | |||
| namespace: wordpress | |||
| labels: | |||
| app: wordpress | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| storageClassName: "" | |||
| resources: | |||
| requests: | |||
| storage: 10Gi | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: wordpress | |||
| namespace: wordpress | |||
| labels: | |||
| app: wordpress | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: wordpress | |||
| tier: frontend | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: wordpress | |||
| tier: frontend | |||
| spec: | |||
| containers: | |||
| - image: wordpress:5.7.2-php7.4-apache | |||
| name: wordpress | |||
| env: | |||
| - name: WORDPRESS_DB_HOST | |||
| value: wordpress-mysql | |||
| - name: WORDPRESS_DB_PASSWORD | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: mysqlwp-pass | |||
| key: password | |||
| - name: WORDPRESS_DB_USER | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: mysqlwp-pass | |||
| key: db_user | |||
| ports: | |||
| - containerPort: 80 | |||
| name: wordpress | |||
| volumeMounts: | |||
| - name: wordpress-persistent-storage | |||
| mountPath: /var/www/html | |||
| volumes: | |||
| - name: wordpress-persistent-storage | |||
| persistentVolumeClaim: | |||
| claimName: wp-pv-claim | |||
| @ -0,0 +1,18 @@ | |||
| apiVersion: networking.k8s.io/v1 | |||
| kind: Ingress | |||
| metadata: | |||
| name: wordpress-ingress | |||
| namespace: wordpress | |||
| annotations: | |||
| ingress.kubernetes.io/rewrite-target: / | |||
| spec: | |||
| rules: | |||
| - http: | |||
| paths: | |||
| - path: / | |||
| pathType: Prefix | |||
| backend: | |||
| service: | |||
| name: wordpress | |||
| port: | |||
| number: 80 | |||
| @ -0,0 +1,14 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: nginx-pv-claim | |||
| namespace: wordpress | |||
| labels: | |||
| app: nginx | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteMany | |||
| storageClassName: "" | |||
| resources: | |||
| requests: | |||
| storage: 2Gi | |||
| @ -0,0 +1,14 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: wp-pv-claim | |||
| namespace: wordpress | |||
| labels: | |||
| app: wordpress | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteMany | |||
| storageClassName: "" | |||
| resources: | |||
| requests: | |||
| storage: 20Gi | |||
| @ -0,0 +1,4 @@ | |||
| kubectl create -f pv-local-mysql.yaml | |||
| kubectl create -f pv-local-wordpress.yaml | |||
| kubectl create -k ./ | |||
| watch kubectl get all -n wordpress | |||
| @ -0,0 +1 @@ | |||
| kubectl describe ingress.networking.k8s.io wordpress -n wordpress | |||
| @ -0,0 +1 @@ | |||
| kubectl exec -ti deployment.apps/wordpress -n wordpress -- /bin/bash | |||
| @ -0,0 +1,17 @@ | |||
| <?php | |||
| /** | |||
| * Front to the WordPress application. This file doesn't do anything, but loads | |||
| * wp-blog-header.php which does and tells WordPress to load the theme. | |||
| * | |||
| * @package WordPress | |||
| */ | |||
| /** | |||
| * Tells WordPress to load the WordPress theme and output it. | |||
| * | |||
| * @var bool | |||
| */ | |||
| define( 'WP_USE_THEMES', true ); | |||
| /** Loads the WordPress Environment and Template */ | |||
| require __DIR__ . '/wp-blog-header.php'; | |||
| @ -0,0 +1,12 @@ | |||
| secretGenerator: | |||
| - name: mysqlwp-pass | |||
| namespace: wordpress | |||
| literals: | |||
| - password=Dsa-0213 | |||
| - db_user=root | |||
| - db_passwd=Dsa-0213 | |||
| resources: | |||
| - wp-namespace.yaml | |||
| - mysql-deployment.yaml | |||
| - wordpress-deployment.yaml | |||
| - php-deployment.yaml | |||
| @ -0,0 +1,68 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: wordpress-mysql | |||
| namespace: wordpress | |||
| labels: | |||
| app: wordpress | |||
| spec: | |||
| ports: | |||
| - port: 3306 | |||
| selector: | |||
| app: wordpress | |||
| tier: mysql | |||
| clusterIP: None | |||
| --- | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: mysql-wp-pv-claim | |||
| namespace: wordpress | |||
| labels: | |||
| app: wordpress | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| resources: | |||
| requests: | |||
| storage: 20Gi | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: wordpress-mysql | |||
| namespace: wordpress | |||
| labels: | |||
| app: wordpress | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: wordpress | |||
| tier: mysql | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: wordpress | |||
| tier: mysql | |||
| spec: | |||
| containers: | |||
| - image: mariadb | |||
| name: mysql | |||
| env: | |||
| - name: MYSQL_ROOT_PASSWORD | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: mysqlwp-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 | |||
| @ -0,0 +1,3 @@ | |||
| kubectl delete -k ./ | |||
| kubectl delete -f pv-local-mysql.yaml | |||
| kubectl delete -f pv-local-wordpress.yaml | |||
| @ -0,0 +1,54 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: phpmyadmin-wordpress | |||
| namespace: wordpress | |||
| labels: | |||
| app: wordpress | |||
| spec: | |||
| selector: | |||
| app: wordpress | |||
| tier: phpmyadmin | |||
| type: NodePort | |||
| ports: | |||
| - name: phpadmin | |||
| port: 80 | |||
| nodePort: 30280 | |||
| targetPort: phpmyadm | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: phpmyadmin-wordpress | |||
| namespace: wordpress | |||
| labels: | |||
| app: wordpress | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: wordpress | |||
| tier: phpmyadmin | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: wordpress | |||
| tier: phpmyadmin | |||
| spec: | |||
| containers: | |||
| - name: phpmyadmin | |||
| image: phpmyadmin | |||
| ports: | |||
| - containerPort: 80 | |||
| name: phpmyadm | |||
| env: | |||
| - name: PMA_HOST | |||
| value: wordpress-mysql | |||
| - name: PMA_PORT | |||
| value: "3306" | |||
| - name: MYSQL_ROOT_PASSWORD | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: mysqlwp-pass | |||
| key: password | |||
| @ -0,0 +1,11 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolume | |||
| metadata: | |||
| name: wp-data | |||
| spec: | |||
| capacity: | |||
| storage: 20Gi | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| hostPath: | |||
| path: "/mnt/cluster/wordpress-ingress/wordpress-db" | |||
| @ -0,0 +1,12 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolume | |||
| metadata: | |||
| name: wp-folder | |||
| spec: | |||
| capacity: | |||
| storage: 10Gi | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| hostPath: | |||
| path: "/mnt/cluster/wordpress-ingress/wordpress-wp" | |||
| @ -0,0 +1,76 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: wordpress | |||
| namespace: wordpress | |||
| labels: | |||
| app: wordpress | |||
| spec: | |||
| ports: | |||
| - port: 80 | |||
| targetPort: wordpress | |||
| selector: | |||
| app: wordpress | |||
| tier: frontend | |||
| --- | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: wp-pv-claim | |||
| namespace: wordpress | |||
| labels: | |||
| app: wordpress | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| storageClassName: "" | |||
| resources: | |||
| requests: | |||
| storage: 10Gi | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: wordpress | |||
| namespace: wordpress | |||
| labels: | |||
| app: wordpress | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: wordpress | |||
| tier: frontend | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: wordpress | |||
| tier: frontend | |||
| spec: | |||
| containers: | |||
| - image: wordpress:5.7.2-php7.4-apache | |||
| name: wordpress | |||
| env: | |||
| - name: WORDPRESS_DB_HOST | |||
| value: wordpress-mysql | |||
| - name: WORDPRESS_DB_PASSWORD | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: mysqlwp-pass | |||
| key: password | |||
| - name: WORDPRESS_DB_USER | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: mysqlwp-pass | |||
| key: db_user | |||
| ports: | |||
| - containerPort: 80 | |||
| name: wordpress | |||
| volumeMounts: | |||
| - name: wordpress-persistent-storage | |||
| mountPath: /var/www/html | |||
| volumes: | |||
| - name: wordpress-persistent-storage | |||
| persistentVolumeClaim: | |||
| claimName: wp-pv-claim | |||
| @ -0,0 +1,78 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: wordpress | |||
| namespace: wordpress | |||
| labels: | |||
| app: wordpress | |||
| spec: | |||
| type: NodePort | |||
| ports: | |||
| - port: 80 | |||
| nodePort: 30088 | |||
| targetPort: wordpress | |||
| selector: | |||
| app: wordpress | |||
| tier: frontend | |||
| --- | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: wp-pv-claim | |||
| namespace: wordpress | |||
| labels: | |||
| app: wordpress | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| storageClassName: "" | |||
| resources: | |||
| requests: | |||
| storage: 10Gi | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: wordpress | |||
| namespace: wordpress | |||
| labels: | |||
| app: wordpress | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: wordpress | |||
| tier: frontend | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: wordpress | |||
| tier: frontend | |||
| spec: | |||
| containers: | |||
| - image: wordpress:5.7.2-php7.4-apache | |||
| name: wordpress | |||
| env: | |||
| - name: WORDPRESS_DB_HOST | |||
| value: wordpress-mysql | |||
| - name: WORDPRESS_DB_PASSWORD | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: mysqlwp-pass | |||
| key: password | |||
| - name: WORDPRESS_DB_USER | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: mysqlwp-pass | |||
| key: db_user | |||
| ports: | |||
| - containerPort: 80 | |||
| name: wordpress | |||
| volumeMounts: | |||
| - name: wordpress-persistent-storage | |||
| mountPath: /var/www/html | |||
| volumes: | |||
| - name: wordpress-persistent-storage | |||
| persistentVolumeClaim: | |||
| claimName: wp-pv-claim | |||
| @ -0,0 +1,26 @@ | |||
| apiVersion: networking.k8s.io/v1 | |||
| kind: Ingress | |||
| metadata: | |||
| annotations: | |||
| nginx.ingress.kubernetes.io/rewrite-target: /$2 | |||
| name: wordpress | |||
| namespace: wordpress | |||
| spec: | |||
| ingressClassName: nginx | |||
| rules: | |||
| - http: | |||
| paths: | |||
| - pathType: Prefix | |||
| path: /wordpress(/|$)(.*) | |||
| backend: | |||
| service: | |||
| name: wordpress | |||
| port: | |||
| number: 80 | |||
| - pathType: Prefix | |||
| path: /wp-admin(/|$)(.*) | |||
| backend: | |||
| service: | |||
| name: wordpress | |||
| port: | |||
| number: 80 | |||
| @ -0,0 +1,4 @@ | |||
| apiVersion: v1 | |||
| kind: Namespace | |||
| metadata: | |||
| name: wordpress | |||
| @ -0,0 +1,13 @@ | |||
| # Nextcloud | |||
| para que funcione hay que dar permisos al directorio para www-data:www-data. | |||
| El nombre del directorio está definido en | |||
| nextcloud-deployment.yaml: subPath: server-data | |||
| y este está alojado dentro del directorio definido en el volumen persistente. | |||
| En micaso en | |||
| pi@k8s-router:/media/discoexterno/owncloud/server-data $ | |||
| @ -0,0 +1,71 @@ | |||
| version: "3" | |||
| volumes: | |||
| files: | |||
| driver: local | |||
| mysql: | |||
| driver: local | |||
| redis: | |||
| driver: local | |||
| services: | |||
| owncloud: | |||
| image: owncloud/server:${OWNCLOUD_VERSION} | |||
| container_name: owncloud_server | |||
| restart: always | |||
| ports: | |||
| - ${HTTP_PORT}:8080 | |||
| depends_on: | |||
| - mariadb | |||
| - redis | |||
| environment: | |||
| - OWNCLOUD_DOMAIN=${OWNCLOUD_DOMAIN} | |||
| - OWNCLOUD_TRUSTED_DOMAINS=${OWNCLOUD_TRUSTED_DOMAINS} | |||
| - OWNCLOUD_DB_TYPE=mysql | |||
| - OWNCLOUD_DB_NAME=owncloud | |||
| - OWNCLOUD_DB_USERNAME=owncloud | |||
| - OWNCLOUD_DB_PASSWORD=owncloud | |||
| - OWNCLOUD_DB_HOST=mariadb | |||
| - OWNCLOUD_ADMIN_USERNAME=${ADMIN_USERNAME} | |||
| - OWNCLOUD_ADMIN_PASSWORD=${ADMIN_PASSWORD} | |||
| - OWNCLOUD_MYSQL_UTF8MB4=true | |||
| - OWNCLOUD_REDIS_ENABLED=true | |||
| - OWNCLOUD_REDIS_HOST=redis | |||
| healthcheck: | |||
| test: ["CMD", "/usr/bin/healthcheck"] | |||
| interval: 30s | |||
| timeout: 10s | |||
| retries: 5 | |||
| volumes: | |||
| - files:/mnt/data | |||
| mariadb: | |||
| image: mariadb:10.6 # minimum required ownCloud version is 10.9 | |||
| container_name: owncloud_mariadb | |||
| restart: always | |||
| environment: | |||
| - MYSQL_ROOT_PASSWORD=owncloud | |||
| - MYSQL_USER=owncloud | |||
| - MYSQL_PASSWORD=owncloud | |||
| - MYSQL_DATABASE=owncloud | |||
| command: ["--max-allowed-packet=128M", "--innodb-log-file-size=64M"] | |||
| healthcheck: | |||
| test: ["CMD", "mysqladmin", "ping", "-u", "root", "--password=owncloud"] | |||
| interval: 10s | |||
| timeout: 5s | |||
| retries: 5 | |||
| volumes: | |||
| - mysql:/var/lib/mysql | |||
| redis: | |||
| image: redis:6 | |||
| container_name: owncloud_redis | |||
| restart: always | |||
| command: ["--databases", "1"] | |||
| healthcheck: | |||
| test: ["CMD", "redis-cli", "ping"] | |||
| interval: 10s | |||
| timeout: 5s | |||
| retries: 5 | |||
| volumes: | |||
| - redis:/data | |||
| @ -0,0 +1,14 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| creationTimestamp: null | |||
| labels: | |||
| io.kompose.service: files | |||
| name: files | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| resources: | |||
| requests: | |||
| storage: 100Mi | |||
| status: {} | |||
| @ -0,0 +1,62 @@ | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| annotations: | |||
| kompose.cmd: kompose convert | |||
| kompose.version: 1.26.0 (40646f47) | |||
| creationTimestamp: null | |||
| labels: | |||
| io.kompose.service: mariadb | |||
| name: mariadb | |||
| spec: | |||
| replicas: 1 | |||
| selector: | |||
| matchLabels: | |||
| io.kompose.service: mariadb | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| annotations: | |||
| kompose.cmd: kompose convert | |||
| kompose.version: 1.26.0 (40646f47) | |||
| creationTimestamp: null | |||
| labels: | |||
| io.kompose.service: mariadb | |||
| spec: | |||
| containers: | |||
| - args: | |||
| - --max-allowed-packet=128M | |||
| - --innodb-log-file-size=64M | |||
| env: | |||
| - name: MYSQL_DATABASE | |||
| value: owncloud | |||
| - name: MYSQL_PASSWORD | |||
| value: owncloud | |||
| - name: MYSQL_ROOT_PASSWORD | |||
| value: owncloud | |||
| - name: MYSQL_USER | |||
| value: owncloud | |||
| image: mariadb:10.6 | |||
| livenessProbe: | |||
| exec: | |||
| command: | |||
| - mysqladmin | |||
| - ping | |||
| - -u | |||
| - root | |||
| - --password=owncloud | |||
| failureThreshold: 5 | |||
| periodSeconds: 10 | |||
| timeoutSeconds: 5 | |||
| name: owncloud-mariadb | |||
| resources: {} | |||
| volumeMounts: | |||
| - mountPath: /var/lib/mysql | |||
| name: mysql | |||
| restartPolicy: Always | |||
| volumes: | |||
| - name: mysql | |||
| persistentVolumeClaim: | |||
| claimName: mysql | |||
| status: {} | |||
| @ -0,0 +1,14 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| creationTimestamp: null | |||
| labels: | |||
| io.kompose.service: mysql | |||
| name: mysql | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| resources: | |||
| requests: | |||
| storage: 100Mi | |||
| status: {} | |||
| @ -0,0 +1,71 @@ | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| annotations: | |||
| kompose.cmd: kompose convert | |||
| kompose.version: 1.26.0 (40646f47) | |||
| creationTimestamp: null | |||
| labels: | |||
| io.kompose.service: owncloud | |||
| name: owncloud | |||
| spec: | |||
| replicas: 1 | |||
| selector: | |||
| matchLabels: | |||
| io.kompose.service: owncloud | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| annotations: | |||
| kompose.cmd: kompose convert | |||
| kompose.version: 1.26.0 (40646f47) | |||
| creationTimestamp: null | |||
| labels: | |||
| io.kompose.service: owncloud | |||
| spec: | |||
| containers: | |||
| - env: | |||
| - name: OWNCLOUD_ADMIN_PASSWORD | |||
| value: Dsa-0213 | |||
| - name: OWNCLOUD_ADMIN_USERNAME | |||
| value: tino | |||
| - name: OWNCLOUD_DB_HOST | |||
| value: mariadb | |||
| - name: OWNCLOUD_DB_NAME | |||
| value: owncloud | |||
| - name: OWNCLOUD_DB_PASSWORD | |||
| value: owncloud | |||
| - name: OWNCLOUD_DB_TYPE | |||
| value: mysql | |||
| - name: OWNCLOUD_DB_USERNAME | |||
| value: owncloud | |||
| - name: OWNCLOUD_DOMAIN | |||
| - name: OWNCLOUD_MYSQL_UTF8MB4 | |||
| value: "true" | |||
| - name: OWNCLOUD_REDIS_ENABLED | |||
| value: "true" | |||
| - name: OWNCLOUD_REDIS_HOST | |||
| value: redis | |||
| - name: OWNCLOUD_TRUSTED_DOMAINS | |||
| image: 'owncloud/server:' | |||
| livenessProbe: | |||
| exec: | |||
| command: | |||
| - /usr/bin/healthcheck | |||
| failureThreshold: 5 | |||
| periodSeconds: 30 | |||
| timeoutSeconds: 10 | |||
| name: owncloud-server | |||
| ports: | |||
| - containerPort: 8080 | |||
| resources: {} | |||
| volumeMounts: | |||
| - mountPath: /mnt/data | |||
| name: files | |||
| restartPolicy: Always | |||
| volumes: | |||
| - name: files | |||
| persistentVolumeClaim: | |||
| claimName: files | |||
| status: {} | |||
| @ -0,0 +1,19 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| annotations: | |||
| kompose.cmd: kompose convert | |||
| kompose.version: 1.26.0 (40646f47) | |||
| creationTimestamp: null | |||
| labels: | |||
| io.kompose.service: owncloud | |||
| name: owncloud | |||
| spec: | |||
| ports: | |||
| - name: "8080" | |||
| port: 8080 | |||
| targetPort: 8080 | |||
| selector: | |||
| io.kompose.service: owncloud | |||
| status: | |||
| loadBalancer: {} | |||
| @ -0,0 +1,50 @@ | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| annotations: | |||
| kompose.cmd: kompose convert | |||
| kompose.version: 1.26.0 (40646f47) | |||
| creationTimestamp: null | |||
| labels: | |||
| io.kompose.service: redis | |||
| name: redis | |||
| spec: | |||
| replicas: 1 | |||
| selector: | |||
| matchLabels: | |||
| io.kompose.service: redis | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| annotations: | |||
| kompose.cmd: kompose convert | |||
| kompose.version: 1.26.0 (40646f47) | |||
| creationTimestamp: null | |||
| labels: | |||
| io.kompose.service: redis | |||
| spec: | |||
| containers: | |||
| - args: | |||
| - --databases | |||
| - "1" | |||
| image: redis:6 | |||
| livenessProbe: | |||
| exec: | |||
| command: | |||
| - redis-cli | |||
| - ping | |||
| failureThreshold: 5 | |||
| periodSeconds: 10 | |||
| timeoutSeconds: 5 | |||
| name: owncloud-redis | |||
| resources: {} | |||
| volumeMounts: | |||
| - mountPath: /data | |||
| name: redis | |||
| restartPolicy: Always | |||
| volumes: | |||
| - name: redis | |||
| persistentVolumeClaim: | |||
| claimName: redis | |||
| status: {} | |||
| @ -0,0 +1,14 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| creationTimestamp: null | |||
| labels: | |||
| io.kompose.service: redis | |||
| name: redis | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| resources: | |||
| requests: | |||
| storage: 100Mi | |||
| status: {} | |||
| @ -0,0 +1,4 @@ | |||
| kubectl create -f pv-local-owncloud.yaml | |||
| kubectl create -f pv-local-mysql.yaml | |||
| kubectl create -k ./ | |||
| watch kubectl get all -n owncloud | |||
| @ -0,0 +1 @@ | |||
| kubectl exec -ti deployment.apps/owncloud-server -n owncloud -- /bin/bash | |||
| @ -0,0 +1,21 @@ | |||
| - env: | |||
| - name: OWNCLOUD_ADMIN_PASSWORD | |||
| value: Dsa-0213 | |||
| - name: OWNCLOUD_ADMIN_USERNAME | |||
| value: tino | |||
| - name: OWNCLOUD_DB_HOST | |||
| value: mariadb | |||
| - name: OWNCLOUD_DB_NAME | |||
| value: owncloud | |||
| - name: OWNCLOUD_DB_PASSWORD | |||
| value: owncloud | |||
| - name: OWNCLOUD_DB_TYPE | |||
| value: mysql | |||
| - name: OWNCLOUD_DB_USERNAME | |||
| value: owncloud | |||
| - name: OWNCLOUD_MYSQL_UTF8MB4 | |||
| value: "true" | |||
| - name: OWNCLOUD_REDIS_ENABLED | |||
| value: "true" | |||
| - name: OWNCLOUD_REDIS_HOST | |||
| value: redis | |||
| @ -0,0 +1,12 @@ | |||
| secretGenerator: | |||
| - name: mysqloc-pass | |||
| namespace: owncloud | |||
| literals: | |||
| - password=Dsa-0213 | |||
| - db_user=root | |||
| - db_passwd=Dsa-0213 | |||
| resources: | |||
| - oc-namespace.yaml | |||
| - mysql-deployment.yaml | |||
| - php-deployment.yaml | |||
| - owncloud-deployment.yaml | |||
| @ -0,0 +1,68 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: owncloud-mysql | |||
| namespace: owncloud | |||
| labels: | |||
| app: owncloud | |||
| spec: | |||
| ports: | |||
| - port: 3306 | |||
| selector: | |||
| app: owncloud | |||
| tier: mysql | |||
| clusterIP: None | |||
| --- | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: mysql-oc-pv-claim | |||
| namespace: owncloud | |||
| labels: | |||
| app: owncloud | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| resources: | |||
| requests: | |||
| storage: 20Gi | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: owncloud-mysql | |||
| namespace: owncloud | |||
| labels: | |||
| app: owncloud | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: owncloud | |||
| tier: mysql | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: owncloud | |||
| tier: mysql | |||
| spec: | |||
| containers: | |||
| - image: mariadb | |||
| name: mysql | |||
| env: | |||
| - name: MYSQL_ROOT_PASSWORD | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: mysqloc-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-oc-pv-claim | |||
| @ -0,0 +1,4 @@ | |||
| apiVersion: v1 | |||
| kind: Namespace | |||
| metadata: | |||
| name: owncloud | |||
| @ -0,0 +1,10 @@ | |||
| apiVersion: v1 | |||
| kind: Secret | |||
| metadata: | |||
| name: mysqloc-pass | |||
| namespace: owncloud | |||
| type: Opaque | |||
| data: | |||
| password: RHNhLTAyMTM= | |||
| db_user: cm9vdA== | |||
| db_passwd: RHNhLTAyMTM= | |||
| @ -0,0 +1,61 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: owncloud-server | |||
| namespace: owncloud | |||
| labels: | |||
| app: owncloud | |||
| spec: | |||
| selector: | |||
| pod-label: owncloud-server-pod | |||
| type: NodePort | |||
| ports: | |||
| - port: 8080 | |||
| nodePort: 30689 | |||
| targetPort: owncloud | |||
| --- | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: dboc-pv-claim | |||
| namespace: owncloud | |||
| labels: | |||
| app: owncloud | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| resources: | |||
| requests: | |||
| storage: 50Gi | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: owncloud-server | |||
| namespace: owncloud | |||
| labels: | |||
| app: owncloud | |||
| spec: | |||
| replicas: 1 | |||
| selector: | |||
| matchLabels: | |||
| pod-label: owncloud-server-pod | |||
| template: | |||
| metadata: | |||
| labels: | |||
| pod-label: owncloud-server-pod | |||
| spec: | |||
| containers: | |||
| - name: owncloud | |||
| image: 'owncloud/server:latest' | |||
| volumeMounts: | |||
| - name: server-storage | |||
| mountPath: /mnt/data | |||
| ports: | |||
| - containerPort: 8080 | |||
| name: owncloud | |||
| volumes: | |||
| - name: server-storage | |||
| persistentVolumeClaim: | |||
| claimName: dboc-pv-claim | |||
| @ -0,0 +1,3 @@ | |||
| kubectl delete -k ./ | |||
| kubectl delete -f pv-local-owncloud.yaml | |||
| kubectl delete -f pv-local-mysql.yaml | |||
| @ -0,0 +1,54 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: phpmyadmin-owncloud | |||
| namespace: owncloud | |||
| labels: | |||
| app: owncloud | |||
| spec: | |||
| selector: | |||
| app: owncloud | |||
| tier: phpmyadmin | |||
| type: NodePort | |||
| ports: | |||
| - name: phpadmin | |||
| port: 80 | |||
| nodePort: 30680 | |||
| targetPort: phpmyadm | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: phpmyadmin-owncloud | |||
| namespace: owncloud | |||
| labels: | |||
| app: owncloud | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: owncloud | |||
| tier: phpmyadmin | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: owncloud | |||
| tier: phpmyadmin | |||
| spec: | |||
| containers: | |||
| - name: phpmyadmin | |||
| image: phpmyadmin | |||
| ports: | |||
| - containerPort: 80 | |||
| name: phpmyadm | |||
| env: | |||
| - name: PMA_HOST | |||
| value: owncloud-mysql | |||
| - name: PMA_PORT | |||
| value: "3306" | |||
| - name: MYSQL_ROOT_PASSWORD | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: mysqloc-pass | |||
| key: password | |||
| @ -0,0 +1,11 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolume | |||
| metadata: | |||
| name: oc-data | |||
| spec: | |||
| capacity: | |||
| storage: 20Gi | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| hostPath: | |||
| path: "/mnt/cluster/owncloud/owncloud-db" | |||
| @ -0,0 +1,11 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolume | |||
| metadata: | |||
| name: owncloud | |||
| spec: | |||
| capacity: | |||
| storage: 50Gi | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| hostPath: | |||
| path: "/mnt/cluster/owncloud" | |||
| @ -0,0 +1,29 @@ | |||
| comienzo=$(date "+%Y_%m_%d-%H_%M_%S") | |||
| SINCRONIZANDO=/tmp/sincronizando | |||
| LOG=/tmp/resultadosync.log | |||
| ORIGEN=/mnt/cluster | |||
| DESTINO=/mnt/LaCie/BeeLink | |||
| DESTINOext=/mnt/Externo/Cluster | |||
| echo "$comienzo - Sincronizacion con LaCie" > $LOG | |||
| #echo "$comienzo - Sincronizacion con LaCie" | |||
| if [ ! -f "$SINCRONIZANDO" ] | |||
| then | |||
| touch $SINCRONIZANDO | |||
| echo "Empieza sincronización..." >> $LOG | |||
| for i in fireflyiii nextcloud nginx reevolution wordpress | |||
| do | |||
| echo "Guardando '$i'..." >> $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 | |||
| mensaje="Copia de seguridad del disco duro realizada en la LaCie CloudBox y en disco externo" | |||
| sudo -u creylopez cat $LOG | mail -s "Copia realizada" "celestino.rey@gmail.com" | |||
| rm $SINCRONIZANDO | |||
| else | |||
| echo "ya se está sincronizando" | |||
| fi | |||