yes
This commit is contained in:
parent
bdd57d0a05
commit
5d225e1206
5
run.sh
5
run.sh
@ -7,12 +7,11 @@ eval $(minikube docker-env)
|
|||||||
minikube dashboard &
|
minikube dashboard &
|
||||||
docker build -t nginx_image srcs/nginx
|
docker build -t nginx_image srcs/nginx
|
||||||
docker build -t phpmyadmin_image srcs/phpmyadmin
|
docker build -t phpmyadmin_image srcs/phpmyadmin
|
||||||
docker build -t mariadb-image srcs/newmysql
|
docker build -t mariadb-image srcs/mariadb
|
||||||
|
|
||||||
kubectl apply -f srcs/yaml/metallb.yaml
|
kubectl apply -f srcs/yaml/metallb.yaml
|
||||||
kubectl apply -f srcs/yaml/nginx_service.yaml
|
kubectl apply -f srcs/yaml/nginx_service.yaml
|
||||||
# kubectl apply -f srcs/yaml/persistencevolume.yaml
|
kubectl apply -f srcs/yaml/mariadb.yaml
|
||||||
kubectl apply -f srcs/newmysql/mariadb.yaml
|
|
||||||
kubectl apply -f srcs/yaml/phpsvc.yaml
|
kubectl apply -f srcs/yaml/phpsvc.yaml
|
||||||
|
|
||||||
echo "Minikube IP: ${IP}"
|
echo "Minikube IP: ${IP}"
|
||||||
|
|||||||
BIN
srcs/.DS_Store
vendored
BIN
srcs/.DS_Store
vendored
Binary file not shown.
12
srcs/mariadb/Dockerfile
Normal file
12
srcs/mariadb/Dockerfile
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
FROM alpine:3.12.3
|
||||||
|
RUN apk update
|
||||||
|
RUN apk add mariadb mariadb-client openrc
|
||||||
|
RUN mkdir "/run/mysqld" && chown -R mysql /run/mysqld
|
||||||
|
COPY create_db.sql .
|
||||||
|
COPY my.cnf /etc/
|
||||||
|
COPY wp_db.sql .
|
||||||
|
COPY start_mysql.sh .
|
||||||
|
RUN chmod +x start_mysql.sh
|
||||||
|
VOLUME ["/var/lib/mysql"]
|
||||||
|
EXPOSE 3306
|
||||||
|
CMD sh start_mysql.sh
|
||||||
@ -1,9 +0,0 @@
|
|||||||
FROM alpine:3.12.3
|
|
||||||
RUN apk update
|
|
||||||
RUN apk add mariadb mariadb-common mariadb-client
|
|
||||||
COPY my.cnf /etc/my.cnf
|
|
||||||
EXPOSE 3306
|
|
||||||
COPY start.sh /start.sh
|
|
||||||
RUN chmod +x /start.sh
|
|
||||||
VOLUME ["/var/lib/mysql"]
|
|
||||||
CMD ["/start.sh"]
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
[mysqld]
|
|
||||||
user = root
|
|
||||||
datadir = /var/lib/mysql
|
|
||||||
port = 3306
|
|
||||||
bind-address = 0.0.0.0
|
|
||||||
skip-networking = false
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
if [ ! -d "/run/mysqld" ]; then
|
|
||||||
mkdir -p /run/mysqld
|
|
||||||
# chown -R mysql:mysql /run/mysqld
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d /var/lib/mysql/mysql ]; then
|
|
||||||
echo '[i] MySQL directory already present, skipping creation'
|
|
||||||
else
|
|
||||||
echo "[i] MySQL data directory not found, creating initial DBs"
|
|
||||||
|
|
||||||
# chown -R mysql:mysql /var/lib/mysql
|
|
||||||
|
|
||||||
# init database
|
|
||||||
echo 'Initializing database'
|
|
||||||
mysql_install_db --user=mysql > /dev/null
|
|
||||||
echo 'Database initialized'
|
|
||||||
|
|
||||||
echo "[i] MySql root password: root"
|
|
||||||
|
|
||||||
# create temp file
|
|
||||||
tfile=`mktemp`
|
|
||||||
if [ ! -f "$tfile" ]; then
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# save sql
|
|
||||||
echo "[i] Create temp file: $tfile"
|
|
||||||
cat << EOF > $tfile
|
|
||||||
CREATE DATABASE wordpress;
|
|
||||||
CREATE USER 'new'@'%' IDENTIFIED BY '';
|
|
||||||
GRANT ALL PRIVILEGES ON *.* TO 'new'@'%' WITH GRANT OPTION;
|
|
||||||
FLUSH PRIVILEGES;
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo 'FLUSH PRIVILEGES;' >> $tfile
|
|
||||||
|
|
||||||
# run sql in tempfile
|
|
||||||
echo "[i] run tempfile: $tfile"
|
|
||||||
/usr/bin/mysqld --user=mysql --bootstrap --verbose=0 < $tfile
|
|
||||||
rm -f $tfile
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "[i] Sleeping 5 sec"
|
|
||||||
sleep 5
|
|
||||||
|
|
||||||
echo '[i] start running mysqld'
|
|
||||||
exec /usr/bin/mysqld_safe
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
[supervisord]
|
|
||||||
nodaemon=true
|
|
||||||
[program:mysql]
|
|
||||||
command= rc-service mariadb start && kill -s SIGTERM $(cat supervisord.pid)
|
|
||||||
File diff suppressed because one or more lines are too long
@ -1,12 +0,0 @@
|
|||||||
FROM alpine:3.12.3
|
|
||||||
RUN apk update
|
|
||||||
RUN apk add mariadb mariadb-common mariadb-client openrc supervisor
|
|
||||||
COPY my.cnf /etc/my.cnf
|
|
||||||
COPY mysql.sql ./
|
|
||||||
COPY wordpress.sql ./
|
|
||||||
COPY supervisord.conf /etc/supervisord.conf
|
|
||||||
EXPOSE 3306
|
|
||||||
COPY start.sh /start.sh
|
|
||||||
RUN chmod +x /start.sh
|
|
||||||
VOLUME ["/var/lib/mysql"]
|
|
||||||
CMD ["/start.sh"]
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
[mysqld]
|
|
||||||
user = root
|
|
||||||
datadir = /var/lib/mysql
|
|
||||||
port = 3306
|
|
||||||
bind-address = 0.0.0.0
|
|
||||||
skip-networking = false
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
CREATE DATABASE my_db;
|
|
||||||
CREATE USER 'root'@'%' IDENTIFIED BY 'root';
|
|
||||||
GRANT ALL PRIVILEGES ON my_db.* TO 'root';
|
|
||||||
FLUSH PRIVILEGES;
|
|
||||||
@ -1,63 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
rc default
|
|
||||||
|
|
||||||
if [ ! -d "/run/mysqld" ]; then
|
|
||||||
mkdir -p /run/mysqld
|
|
||||||
fi
|
|
||||||
|
|
||||||
rc-status
|
|
||||||
touch /run/openrc/softlevel
|
|
||||||
/etc/init.d/mariadb setup
|
|
||||||
/etc/init.d/mariadb start
|
|
||||||
mysql < mysql.sql
|
|
||||||
mysql -u root wordpress < wordpress.sql
|
|
||||||
/etc/init.d/mariadb stop
|
|
||||||
/usr/bin/supervisord
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# if [ -d /var/lib/mysql/mysql ]; then
|
|
||||||
# echo '[i] MySQL directory already present, skipping creation'
|
|
||||||
# else
|
|
||||||
# echo "[i] MySQL data directory not found, creating initial DBs"
|
|
||||||
|
|
||||||
# # chown -R mysql:mysql /var/lib/mysql
|
|
||||||
|
|
||||||
# # init database
|
|
||||||
# echo 'Initializing database'
|
|
||||||
# mysql_install_db --user=mysql > /dev/null
|
|
||||||
# echo 'Database initialized'
|
|
||||||
|
|
||||||
# echo "[i] MySql root password: root"
|
|
||||||
|
|
||||||
# # create temp file
|
|
||||||
# tfile=`mktemp`
|
|
||||||
# if [ ! -f "$tfile" ]; then
|
|
||||||
# return 1
|
|
||||||
# fi
|
|
||||||
|
|
||||||
# # save sql
|
|
||||||
# echo "[i] Create temp file: $tfile"
|
|
||||||
# cat << EOF > $tfile
|
|
||||||
# CREATE DATABASE wordpress;
|
|
||||||
# CREATE USER 'new'@'%' IDENTIFIED BY '';
|
|
||||||
# GRANT ALL PRIVILEGES ON *.* TO 'new'@'%' WITH GRANT OPTION;
|
|
||||||
# FLUSH PRIVILEGES;
|
|
||||||
# EOF
|
|
||||||
|
|
||||||
# echo 'FLUSH PRIVILEGES;' >> $tfile
|
|
||||||
|
|
||||||
# # run sql in tempfile
|
|
||||||
# echo "[i] run tempfile: $tfile"
|
|
||||||
# /usr/bin/mysqld --user=mysql --bootstrap --verbose=0 < $tfile
|
|
||||||
# rm -f $tfile
|
|
||||||
# fi
|
|
||||||
|
|
||||||
# echo "[i] Sleeping 5 sec"
|
|
||||||
# sleep 5
|
|
||||||
|
|
||||||
# echo '[i] start running mysqld'
|
|
||||||
# exec /usr/bin/mysqld_safe
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
[supervisord]
|
|
||||||
user = root
|
|
||||||
nodaemon=true
|
|
||||||
|
|
||||||
[program:mysqld_safe]
|
|
||||||
command = sh -c "/usr/bin/mysqld_safe && kill -s SIGTERM $(cat supervisord.pid)"
|
|
||||||
File diff suppressed because one or more lines are too long
@ -1,18 +0,0 @@
|
|||||||
FROM alpine:3.12.3
|
|
||||||
|
|
||||||
RUN apk update && apk upgrade
|
|
||||||
RUN apk add mariadb mariadb-client openrc
|
|
||||||
|
|
||||||
RUN mkdir "/run/mysqld" && chown -R mysql /run/mysqld
|
|
||||||
|
|
||||||
COPY create_db.sql .
|
|
||||||
COPY my.cnf /etc/
|
|
||||||
COPY wp_db.sql .
|
|
||||||
COPY start_mysql.sh .
|
|
||||||
RUN chmod +x start_mysql.sh
|
|
||||||
|
|
||||||
VOLUME ["/var/lib/mysql"]
|
|
||||||
|
|
||||||
EXPOSE 3306
|
|
||||||
|
|
||||||
CMD sh start_mysql.sh
|
|
||||||
@ -5,8 +5,8 @@ RUN apk add supervisor nginx php7 php7-fpm php7-opcache php7-gd php7-m
|
|||||||
RUN mkdir -p /var/www/localhost/htdocs/
|
RUN mkdir -p /var/www/localhost/htdocs/
|
||||||
RUN mkdir -p /run/php7
|
RUN mkdir -p /run/php7
|
||||||
RUN mkdir -p /run/nginx
|
RUN mkdir -p /run/nginx
|
||||||
RUN wget https://files.phpmyadmin.net/phpMyAdmin/5.0.4/phpMyAdmin-5.0.4-english.tar.gz
|
RUN wget http://files.directadmin.com/services/all/phpMyAdmin/phpMyAdmin-5.0.1-all-languages.tar.gz
|
||||||
RUN tar -xvf phpMyAdmin-5.0.4-english.tar.gz --strip-components 1 -C /var/www/localhost/htdocs/
|
RUN tar -xvf phpMyAdmin-5.0.1-all-languages.tar.gz --strip-components 1 -C /var/www/localhost/htdocs/
|
||||||
COPY phpmyadmin.inc.php /var/www/localhost/htdocs/config.inc.php
|
COPY phpmyadmin.inc.php /var/www/localhost/htdocs/config.inc.php
|
||||||
RUN mkdir -p /var/www/localhost/htdocs/tmp
|
RUN mkdir -p /var/www/localhost/htdocs/tmp
|
||||||
RUN chmod 777 /var/www/localhost/htdocs/tmp
|
RUN chmod 777 /var/www/localhost/htdocs/tmp
|
||||||
|
|||||||
@ -12,7 +12,6 @@ spec:
|
|||||||
targetPort: 3306
|
targetPort: 3306
|
||||||
selector:
|
selector:
|
||||||
app: mariadb
|
app: mariadb
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
@ -35,6 +34,10 @@ spec:
|
|||||||
containers:
|
containers:
|
||||||
- name: mariadb-container
|
- name: mariadb-container
|
||||||
image: mariadb-image
|
image: mariadb-image
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: "128Mi"
|
||||||
|
cpu: "500m"
|
||||||
imagePullPolicy: Never
|
imagePullPolicy: Never
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 3306
|
- containerPort: 3306
|
||||||
@ -45,7 +48,6 @@ spec:
|
|||||||
- name: mariadb-pv
|
- name: mariadb-pv
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: mariadb-pvc
|
claimName: mariadb-pvc
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: PersistentVolume
|
kind: PersistentVolume
|
||||||
@ -63,9 +65,7 @@ spec:
|
|||||||
path: "/var/lib/mysql"
|
path: "/var/lib/mysql"
|
||||||
claimRef:
|
claimRef:
|
||||||
name: mysql-pvc
|
name: mysql-pvc
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: PersistentVolumeClaim
|
kind: PersistentVolumeClaim
|
||||||
metadata:
|
metadata:
|
||||||
@ -1,47 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: mysql-service
|
|
||||||
labels:
|
|
||||||
app: mysql
|
|
||||||
spec:
|
|
||||||
type: ClusterIP
|
|
||||||
ports:
|
|
||||||
- port: 3306
|
|
||||||
targetPort: 3306
|
|
||||||
protocol: TCP
|
|
||||||
name: mysql-port
|
|
||||||
selector:
|
|
||||||
app: mysql
|
|
||||||
---
|
|
||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: mysql-deployment
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: mysql-deployment
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: mysql-deployment
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: mysql-deployment
|
|
||||||
imagePullPolicy: Never
|
|
||||||
image: mysqlserver
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
memory: "128Mi"
|
|
||||||
cpu: "500m"
|
|
||||||
ports:
|
|
||||||
- containerPort: 3306
|
|
||||||
name: mysql
|
|
||||||
volumeMounts:
|
|
||||||
- name: mysql-storage
|
|
||||||
mountPath: /var/lib/mysql
|
|
||||||
volumes:
|
|
||||||
- name: mysql-storage
|
|
||||||
persistentVolumeClaim:
|
|
||||||
claimName: mysql-volume
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: PersistentVolumeClaim
|
|
||||||
metadata:
|
|
||||||
name: mysql-volume
|
|
||||||
labels:
|
|
||||||
app: mysql
|
|
||||||
spec:
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: 2Gi
|
|
||||||
accessModes:
|
|
||||||
- ReadWriteOnce
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: PersistentVolumeClaim
|
|
||||||
metadata:
|
|
||||||
name: mypvcinflux
|
|
||||||
spec:
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: 2Gi
|
|
||||||
accessModes:
|
|
||||||
- ReadWriteOnce
|
|
||||||
Loading…
x
Reference in New Issue
Block a user