This commit is contained in:
Matthos Denys 2021-03-07 01:13:44 +03:00
parent ffa97cd1d3
commit 38c35f3cf1
12 changed files with 1326 additions and 1 deletions

View File

@ -3,8 +3,10 @@ kubectl delete svc nginx-service
kubectl delete svc mariadb-service
kubectl delete svc phpmyadmin-service
kubectl delete svc ftps
kubectl delete svc wp-service
kubectl delete deployment nginx-deployment
kubectl delete deployment mariadb
kubectl delete deployment wp
kubectl delete deployment phpmyadmin-deployment
kubectl delete deployment ftps
kubectl delete pods --all

2
run.sh
View File

@ -9,12 +9,14 @@ docker build -t nginx_image srcs/nginx
docker build -t phpmyadmin_image srcs/phpmyadmin
docker build -t mariadb-image srcs/mariadb
docker build -t my_ftps srcs/ftps
docker build -t wp-image srcs/wp
kubectl apply -f srcs/yaml/metallb.yaml
kubectl apply -f srcs/yaml/nginx_service.yaml
kubectl apply -f srcs/yaml/mariadb.yaml
kubectl apply -f srcs/yaml/phpsvc.yaml
kubectl apply -f srcs/yaml/ftps.yaml
kubectl apply -f srcs/yaml/wp.yaml
echo "Minikube IP: ${IP}"

View File

@ -11,4 +11,7 @@ $cfg['Servers'][$i]['AllowNoPassword'] = false;
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
$cfg['TempDir'] = '/tmp';
$cfg['lang'] = 'ru';
$cfg['Console']['Mode'] = 'collapse';
$cfg['ThemeDefault'] = 'metro';
?>

BIN
srcs/wp/.DS_Store vendored Executable file

Binary file not shown.

15
srcs/wp/Dockerfile Executable file
View File

@ -0,0 +1,15 @@
FROM alpine:3.12
LABEL maintainer="mdenys"
RUN apk update
RUN apk add curl supervisor nginx php7 php7-fpm php7-phar php7-opcache php7-gd php7-mysqli php7-zlib php7-curl php7-mbstring php7-json php7-session mariadb mariadb-client openrc
RUN mkdir "/run/mysqld" && chown -R mysql /run/mysqld
RUN mkdir -p /var/www/localhost/htdocs/
RUN mkdir -p /run/php7
RUN mkdir -p /run/nginx
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY supervisord.conf /etc/supervisord.conf
COPY start.sh .
RUN chmod +x start.sh
EXPOSE 5050
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
ENTRYPOINT sh start.sh

14
srcs/wp/index.html Executable file
View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
</head>
<body>
<div class="container-sm"><h1 class="display-1">phpmyadmin</h1></div>
<?php echo phpinfo();?>
</body>
</html>

14
srcs/wp/nginx.conf Executable file
View File

@ -0,0 +1,14 @@
server {
listen 0.0.0.0:5050;
server_name localhost;
root /var/www/localhost/htdocs/;
autoindex on;
index index.php;
location ~ \.php$ {
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_index index.php;
}
}

1173
srcs/wp/php.ini Executable file

File diff suppressed because it is too large Load Diff

11
srcs/wp/start.sh Normal file
View File

@ -0,0 +1,11 @@
#!/bin/bash
openrc default
/etc/init.d/mariadb setup
rc-service mariadb start
# curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
# chmod +x wp-cli.phar
# mv wp-cli.phar /usr/local/bin/wp
# cd /var/www/localhost/htdocs/
# wp core download --allow-root
# wp core config --allow-root --dbname=wp_db --dbuser=mdenys --dbpass=mdenys --dbhost=mariadb-service:3306 --dbprefix=wp_
# wp core install --allow-root --url="localhost" --title="ecole 21" --admin_user="admin" --admin_password="123456" --admin_email="denis.nadey@gmail.com"

7
srcs/wp/supervisord.conf Executable file
View File

@ -0,0 +1,7 @@
[supervisord]
nodaemon=true
user=root
[program:php]
command= /usr/sbin/php-fpm7
[program:nginx]
command=sh -c "nginx -g 'daemon off;' && kill -s SIGTERM $(cat supervisord.pid)"

View File

@ -60,7 +60,12 @@ spec:
volumeMounts:
- mountPath: "/var/lib/mysql"
name: mariadb-pv
- mountPath: "/var/www/localhost/htdocs/"
name: wp-pv
volumes:
- name: mariadb-pv
persistentVolumeClaim:
claimName: mariadb-pvc
- name: wp-pv
persistentVolumeClaim:
claimName: wp-pvc

79
srcs/yaml/wp.yaml Normal file
View File

@ -0,0 +1,79 @@
apiVersion: v1
kind: Service
metadata:
name: wp-service
labels:
app: wp
spec:
type: ClusterIP
ports:
- port: 5050
name: wp
targetPort: 5050
selector:
app: wp
externalIPs:
- "192.168.99.150"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: wp
labels:
app: wp
spec:
selector:
matchLabels:
app: wp
template:
metadata:
labels:
app: wp
spec:
containers:
- name: wp-container
image: wp-image
resources:
limits:
memory: "128Mi"
cpu: "100m"
imagePullPolicy: Never
ports:
- containerPort: 5050
volumeMounts:
- mountPath: "/var/www/localhost/htdocs/"
name: wp-pv
volumes:
- name: wp-pv
persistentVolumeClaim:
claimName: wp-pvc
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: wp-pv
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 800Mi
accessModes:
- ReadWriteOnce
hostPath:
path: "/var/www/"
claimRef:
name: wp-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: wp-pvc
labels:
app: wp
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 800Mi