86 lines
2.0 KiB
YAML
86 lines
2.0 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: wordpress
|
|
namespace: default
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: wordpress
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: wordpress
|
|
spec:
|
|
initContainers:
|
|
- name: init-pg4wp
|
|
image: hub.hamdocker.ir/library/busybox:latest
|
|
command:
|
|
- sh
|
|
- -c
|
|
- |
|
|
wget -O /tmp/pg4wp.zip https://github.com/kevinoid/postgresql-for-wordpress/archive/refs/heads/master.zip
|
|
unzip /tmp/pg4wp.zip -d /var/www/html/wp-content/plugins/
|
|
mv /var/www/html/wp-content/plugins/postgresql-for-wordpress-master /var/www/html/wp-content/plugins/pg4wp
|
|
cp /var/www/html/wp-content/plugins/pg4wp/db.php /var/www/html/wp-content/db.php
|
|
volumeMounts:
|
|
- name: wordpress-data
|
|
mountPath: /var/www/html
|
|
containers:
|
|
- name: wordpress
|
|
image: wordpress:latest
|
|
env:
|
|
- name: WORDPRESS_DB_HOST
|
|
value: "postgresql:5432"
|
|
- name: WORDPRESS_DB_USER
|
|
value: "wp_admin"
|
|
- name: WORDPRESS_DB_PASSWORD
|
|
value: "wp_pass123"
|
|
- name: WORDPRESS_DB_NAME
|
|
value: "wordpress"
|
|
ports:
|
|
- containerPort: 80
|
|
volumeMounts:
|
|
- name: wordpress-data
|
|
mountPath: /var/www/html
|
|
volumes:
|
|
- name: wordpress-data
|
|
emptyDir: {}
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: wordpress
|
|
namespace: default
|
|
spec:
|
|
selector:
|
|
app: wordpress
|
|
ports:
|
|
- port: 80
|
|
targetPort: 80
|
|
---
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: Ingress
|
|
metadata:
|
|
name: wordpress-ingress
|
|
namespace: default
|
|
annotations:
|
|
nginx.ingress.kubernetes.io/proxy-body-size: "0"
|
|
spec:
|
|
ingressClassName: nginx
|
|
tls:
|
|
- hosts:
|
|
- "wordpress.ali.atestd.shop"
|
|
secretName: wildcard-tls
|
|
rules:
|
|
- host: "wordpress.ali.atestd.shop"
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: Prefix
|
|
backend:
|
|
service:
|
|
name: wordpress
|
|
port:
|
|
number: 80 |