From ac80e74292ae8dcb2c960e002e20d80d2d394b7d Mon Sep 17 00:00:00 2001 From: Joey Hafner Date: Thu, 30 Mar 2023 09:46:07 -0700 Subject: [PATCH] Init wordpress --- homelab/jafner-dev/Ingress.yaml | 11 +++ homelab/jafner-dev/wordpress/Deployment.yaml | 81 +++++++++++++++++++ .../jafner-dev/wordpress/Kustomization.yaml | 9 +++ .../wordpress/PersistentVolumeClaim.yaml | 27 +++++++ homelab/jafner-dev/wordpress/Service.yaml | 25 ++++++ 5 files changed, 153 insertions(+) create mode 100644 homelab/jafner-dev/wordpress/Deployment.yaml create mode 100644 homelab/jafner-dev/wordpress/Kustomization.yaml create mode 100644 homelab/jafner-dev/wordpress/PersistentVolumeClaim.yaml create mode 100644 homelab/jafner-dev/wordpress/Service.yaml diff --git a/homelab/jafner-dev/Ingress.yaml b/homelab/jafner-dev/Ingress.yaml index 62d45b6f..5fb74da5 100644 --- a/homelab/jafner-dev/Ingress.yaml +++ b/homelab/jafner-dev/Ingress.yaml @@ -14,6 +14,7 @@ spec: - hello.jafner.dev - hello2.jafner.dev - 5e.jafner.dev + - wordpress.jafner.dev rules: - host: "hello.jafner.dev" http: @@ -43,5 +44,15 @@ spec: backend: service: name: dndtools + port: + number: 80 + - host: "wordpress.jafner.dev" + http: + paths: + - pathType: Prefix + path: "/" + backend: + service: + name: wordpress port: number: 80 \ No newline at end of file diff --git a/homelab/jafner-dev/wordpress/Deployment.yaml b/homelab/jafner-dev/wordpress/Deployment.yaml new file mode 100644 index 00000000..beec8fd3 --- /dev/null +++ b/homelab/jafner-dev/wordpress/Deployment.yaml @@ -0,0 +1,81 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: wordpress-mysql + labels: + app: wordpress +spec: + selector: + matchLabels: + app: wordpress + tier: mysql + strategy: + type: Recreate + template: + metadata: + labels: + app: wordpress + tier: mysql + spec: + containers: + - image: mysql:5.6 + name: mysql + env: + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: mysql-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-pv-claim + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: 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:4.8-apache + name: wordpress + env: + - name: WORDPRESS_DB_HOST + value: wordpress-mysql + - name: WORDPRESS_DB_PASSWORD + valueFrom: + secretKeyRef: + name: mysql-pass + key: password + ports: + - containerPort: 80 + name: wordpress + volumeMounts: + - name: wordpress-persistent-storage + mountPath: /var/www/html + volumes: + - name: wordpress-persistent-storage + persistentVolumeClaim: + claimName: wp-pv-claim diff --git a/homelab/jafner-dev/wordpress/Kustomization.yaml b/homelab/jafner-dev/wordpress/Kustomization.yaml new file mode 100644 index 00000000..9713d46d --- /dev/null +++ b/homelab/jafner-dev/wordpress/Kustomization.yaml @@ -0,0 +1,9 @@ +secretGenerator: +- name: mysql-pass + literals: + - password=***REMOVED*** + +resources: + - Deployment.yaml + - Service.yaml + - PersistentVolumeClaim.yaml \ No newline at end of file diff --git a/homelab/jafner-dev/wordpress/PersistentVolumeClaim.yaml b/homelab/jafner-dev/wordpress/PersistentVolumeClaim.yaml new file mode 100644 index 00000000..c1abf173 --- /dev/null +++ b/homelab/jafner-dev/wordpress/PersistentVolumeClaim.yaml @@ -0,0 +1,27 @@ +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: mysql-pv-claim + labels: + app: wordpress +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 20Gi + +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: wp-pv-claim + labels: + app: wordpress +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 20Gi diff --git a/homelab/jafner-dev/wordpress/Service.yaml b/homelab/jafner-dev/wordpress/Service.yaml new file mode 100644 index 00000000..ce18aea1 --- /dev/null +++ b/homelab/jafner-dev/wordpress/Service.yaml @@ -0,0 +1,25 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: wordpress-mysql + labels: + app: wordpress +spec: + ports: + - port: 3306 + selector: + app: wordpress + +--- +apiVersion: v1 +kind: Service +metadata: + name: wordpress + labels: + app: wordpress +spec: + ports: + - port: 80 + selector: + app: wordpress