| @ -0,0 +1,82 @@ | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: appsmith | |||||
| namespace: appsmith | |||||
| labels: | |||||
| app: appsmith | |||||
| spec: | |||||
| type: NodePort | |||||
| ports: | |||||
| - port: 80 | |||||
| nodePort: 30798 | |||||
| targetPort: appsmith | |||||
| selector: | |||||
| app: appsmith | |||||
| tier: frontend | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolumeClaim | |||||
| metadata: | |||||
| name: as-pv-claim | |||||
| namespace: appsmith | |||||
| labels: | |||||
| app: appsmith | |||||
| spec: | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| storageClassName: "" | |||||
| resources: | |||||
| requests: | |||||
| storage: 10Gi | |||||
| --- | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: appsmith | |||||
| namespace: appsmith | |||||
| labels: | |||||
| app: appsmith | |||||
| spec: | |||||
| selector: | |||||
| matchLabels: | |||||
| app: appsmith | |||||
| tier: frontend | |||||
| strategy: | |||||
| type: Recreate | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: appsmith | |||||
| tier: frontend | |||||
| spec: | |||||
| containers: | |||||
| - image: index.docker.io/appsmith/appsmith-ce | |||||
| name: appsmith | |||||
| env: | |||||
| - name: DB_TYPE | |||||
| value: mysql | |||||
| - name: DB_NAME | |||||
| value: appsmith | |||||
| - name: DB_HOST | |||||
| value: appsmith-mysql | |||||
| - name: DB_PASS | |||||
| valueFrom: | |||||
| secretKeyRef: | |||||
| name: mysqlas-pass | |||||
| key: password | |||||
| - name: DB_USER | |||||
| valueFrom: | |||||
| secretKeyRef: | |||||
| name: mysqlas-pass | |||||
| key: db_user | |||||
| ports: | |||||
| - containerPort: 80 | |||||
| name: appsmith | |||||
| volumeMounts: | |||||
| - name: appsmith-persistent-storage | |||||
| mountPath: /var/www/html | |||||
| volumes: | |||||
| - name: appsmith-persistent-storage | |||||
| persistentVolumeClaim: | |||||
| claimName: as-pv-claim | |||||
| @ -0,0 +1,4 @@ | |||||
| apiVersion: v1 | |||||
| kind: Namespace | |||||
| metadata: | |||||
| name: appsmith | |||||
| @ -0,0 +1,24 @@ | |||||
| # Backup date | |||||
| today=$(date "+%Y_%m_%d-%H_%M_%S") | |||||
| echo "Current date: $today" | |||||
| # build up filename | |||||
| # destination folder (change to your own needs) | |||||
| BACKUP_FOLDER=/tmp | |||||
| file_name=$BACKUP_FOLDER/bkup_mediawiki | |||||
| new_name=$file_name-$today.sql | |||||
| echo "Backup file name: " "$new_name" | |||||
| #sudo docker exec `sudo docker container ls | grep mysql_mediawiki | cut -f1 -d' '` /usr/bin/mysqldump -u root --password=Dsa-0213 mediawiki > $new_name | |||||
| sudo kubectl --kubeconfig /home/creylopez/.kube/config exec `kubectl --kubeconfig /home/creylopez/.kube/config get pod -n mediawiki|grep mysql|cut -f1 -d' '` -n mediawiki -- /usr/bin/mysqldump -u root --password=Dsa-0213 mediawiki > $new_name | |||||
| message="Backup stored "$today | |||||
| sudo -u creylopez cat $new_name | mail -s "Mediawiki backup finished" "creylopez@yahoo.es" | |||||
| sudo rm $new_name | |||||
| @ -0,0 +1,4 @@ | |||||
| kubectl create -f pv-local-mysql-as.yaml | |||||
| kubectl create -f pv-local-appsmith.yaml | |||||
| kubectl create -k ./ | |||||
| watch kubectl get all -n appsmith | |||||
| @ -0,0 +1,23 @@ | |||||
| version: "3" | |||||
| services: | |||||
| appsmith: | |||||
| image: index.docker.io/appsmith/appsmith-ce | |||||
| container_name: appsmith | |||||
| ports: | |||||
| - "80:80" | |||||
| - "443:443" | |||||
| volumes: | |||||
| - ./stacks:/appsmith-stacks | |||||
| restart: unless-stopped | |||||
| # # Uncomment the lines below to enable auto-update | |||||
| # labels: | |||||
| # com.centurylinklabs.watchtower.enable: "true" | |||||
| # auto_update: | |||||
| # image: containrrr/watchtower:latest-dev | |||||
| # volumes: | |||||
| # - /var/run/docker.sock:/var/run/docker.sock | |||||
| # # Update check interval in seconds. | |||||
| # command: --schedule "0 0 * ? * *" --label-enable --cleanup | |||||
| # restart: unless-stopped | |||||
| @ -0,0 +1 @@ | |||||
| kubectl exec -ti deployment.apps/appsmith -n appsmith -- /bin/bash | |||||
| @ -0,0 +1,12 @@ | |||||
| secretGenerator: | |||||
| - name: mysqlas-pass | |||||
| namespace: appsmith | |||||
| literals: | |||||
| - password=Dsa-0213 | |||||
| - db_user=root | |||||
| - db_passwd=Dsa-0213 | |||||
| resources: | |||||
| - as-namespace.yaml | |||||
| - mysql-deployment-as.yaml | |||||
| - appsmith-deployment.yaml | |||||
| - php-myadmin-as-deployment.yaml | |||||
| @ -0,0 +1,71 @@ | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: appsmith-mysql | |||||
| namespace: appsmith | |||||
| labels: | |||||
| app: appsmith | |||||
| spec: | |||||
| type: NodePort | |||||
| ports: | |||||
| - name: mysql | |||||
| port: 3306 | |||||
| nodePort: 30781 | |||||
| targetPort: mysql | |||||
| selector: | |||||
| app: appsmith | |||||
| tier: mysql | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolumeClaim | |||||
| metadata: | |||||
| name: mysql-as-pv-claim | |||||
| namespace: appsmith | |||||
| labels: | |||||
| app: appsmith | |||||
| spec: | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| resources: | |||||
| requests: | |||||
| storage: 20Gi | |||||
| --- | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: appsmith-mysql | |||||
| namespace: appsmith | |||||
| labels: | |||||
| app: appsmith | |||||
| spec: | |||||
| selector: | |||||
| matchLabels: | |||||
| app: appsmith | |||||
| tier: mysql | |||||
| strategy: | |||||
| type: Recreate | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: appsmith | |||||
| tier: mysql | |||||
| spec: | |||||
| containers: | |||||
| - image: mariadb | |||||
| name: mysql | |||||
| env: | |||||
| - name: MYSQL_ROOT_PASSWORD | |||||
| valueFrom: | |||||
| secretKeyRef: | |||||
| name: mysqlas-pass | |||||
| key: password | |||||
| ports: | |||||
| - containerPort: 3306 | |||||
| name: mysql | |||||
| volumeMounts: | |||||
| - name: mysql-persistent-storage | |||||
| mountPath: /var/lib/mysql | |||||
| volumes: | |||||
| - name: mysql-persistent-storage | |||||
| persistentVolumeClaim: | |||||
| claimName: mysql-as-pv-claim | |||||
| @ -0,0 +1,3 @@ | |||||
| kubectl delete -k ./ | |||||
| kubectl delete -f pv-local-mysql-as.yaml | |||||
| kubectl delete -f pv-local-appsmith.yaml | |||||
| @ -0,0 +1,54 @@ | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: phpmyadmin-appsmith | |||||
| namespace: appsmith | |||||
| labels: | |||||
| app: appsmith | |||||
| spec: | |||||
| selector: | |||||
| app: appsmith | |||||
| tier: phpmyadmin | |||||
| type: NodePort | |||||
| ports: | |||||
| - name: phpadmin | |||||
| port: 80 | |||||
| nodePort: 30780 | |||||
| targetPort: phpmyadm | |||||
| --- | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: phpmyadmin-appsmith | |||||
| namespace: appsmith | |||||
| labels: | |||||
| app: appsmith | |||||
| spec: | |||||
| selector: | |||||
| matchLabels: | |||||
| app: appsmith | |||||
| tier: phpmyadmin | |||||
| strategy: | |||||
| type: Recreate | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: appsmith | |||||
| tier: phpmyadmin | |||||
| spec: | |||||
| containers: | |||||
| - name: phpmyadmin | |||||
| image: phpmyadmin | |||||
| ports: | |||||
| - containerPort: 80 | |||||
| name: phpmyadm | |||||
| env: | |||||
| - name: PMA_HOST | |||||
| value: appsmith-mysql | |||||
| - name: PMA_PORT | |||||
| value: "3306" | |||||
| - name: MYSQL_ROOT_PASSWORD | |||||
| valueFrom: | |||||
| secretKeyRef: | |||||
| name: mysqlas-pass | |||||
| key: password | |||||
| @ -0,0 +1,12 @@ | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolume | |||||
| metadata: | |||||
| name: as-folder | |||||
| spec: | |||||
| capacity: | |||||
| storage: 10Gi | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| hostPath: | |||||
| path: "/mnt/cluster/appsmith/appsmith" | |||||
| @ -0,0 +1,11 @@ | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolume | |||||
| metadata: | |||||
| name: as-data | |||||
| spec: | |||||
| capacity: | |||||
| storage: 20Gi | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| hostPath: | |||||
| path: "/mnt/cluster/appsmith/appsmith-db" | |||||