first commit
This commit is contained in:
34
create.sh
Executable file
34
create.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#! /bin/bash
|
||||
#
|
||||
|
||||
set -o allexport;
|
||||
source .env;
|
||||
set +o allexport
|
||||
|
||||
volume_path=/home/$USER/.docker-data/volumes/$PREFIX-web/_data
|
||||
volume_dest_path=$PWD/volume
|
||||
|
||||
docker volume create $PREFIX-web;
|
||||
docker volume create $PREFIX-db;
|
||||
docker network create $PREFIX;
|
||||
docker network connect $PREFIX traefik;
|
||||
|
||||
sudo -u $USER mkdir -p $volume_dest_path;
|
||||
/usr/bin/bindfs --force-user=$USER --force-group=$USER --create-for-user=www-data --create-for-group=www-data $volume_path $volume_dest_path;
|
||||
|
||||
sudo -u $USER wp core download --locale=$WP_LOCALE --version=$WP_VERSION --path=$volume_dest_path;
|
||||
sudo -u $USER wp config create --skip-check --dbname=$PREFIX --dbuser=$DB_USER --dbpass=$DB_USER_PASSWORD --dbhost=127.0.0.1 --path=$volume_dest_path --extra-php <<PHP
|
||||
define( 'DB_PORT', 3306);
|
||||
PHP
|
||||
docker run -d --name $PREFIX-db-tmp --volume $PREFIX-db:/var/lib/mysql -p 3306:3306 -e MYSQL_DATABASE=$PREFIX -e MYSQL_PASSWORD=$DB_USER_PASSWORD -e MYSQL_ROOT_PASSWORD=$DB_ROOT_PASSWORD -e MYSQL_USER=$DB_USER mariadb:10.1 --default-authentication-plugin=mysql_native_password;
|
||||
while ! mysqladmin ping -h localhost -P 3306 --protocol=tcp -u user -puser --silent; do
|
||||
sleep 1;
|
||||
done
|
||||
sudo -u $USER wp core install --path=$volume_dest_path --url=https://www.$PREFIX.localhost --title=$PREFIX --admin_user=admin --admin_password=admin --admin_email=no@mail.com --skip-email;
|
||||
#sudo -u $USER wp theme install twentyseventeen --activate --path=$volume_dest_path;
|
||||
docker stop $PREFIX-db-tmp;
|
||||
docker rm $PREFIX-db-tmp;
|
||||
sudo -u $USER wp config create --force --skip-check --dbname=$PREFIX --dbuser=$DB_USER --dbpass=$DB_USER_PASSWORD --dbhost=$PREFIX-db --path=$volume_dest_path --extra-php <<PHP
|
||||
if (isset(\$_SERVER['HTTP_X_FORWARDED_PROTO']) && \$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') \$_SERVER['HTTPS']='on';
|
||||
PHP
|
||||
umount $volume_dest_path
|
||||
47
docker-compose.yml
Normal file
47
docker-compose.yml
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
networks:
|
||||
default:
|
||||
external:
|
||||
name: ${PREFIX}
|
||||
|
||||
services:
|
||||
adminer:
|
||||
container_name: ${PREFIX}-adminer
|
||||
image: adminer:4.7.2-standalone
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.http.routers.${PREFIX}-adminer.entrypoints=https
|
||||
- traefik.http.routers.${PREFIX}-adminer.rule=Host(`adminer.${PREFIX}.localhost`)
|
||||
- traefik.http.routers.${PREFIX}-adminer.tls=true
|
||||
- traefik.http.services.${PREFIX}-adminer.loadbalancer.server.port=8080
|
||||
db:
|
||||
command: --default-authentication-plugin=mysql_native_password
|
||||
container_name: ${PREFIX}-db
|
||||
environment:
|
||||
MYSQL_DATABASE: ${PREFIX}
|
||||
MYSQL_PASSWORD: ${DB_USER_PASSWORD}
|
||||
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
|
||||
MYSQL_USER: ${DB_USER}
|
||||
hostname: ${PREFIX}-db
|
||||
image: mariadb:10.4.6-bionic
|
||||
volumes:
|
||||
- db:/var/lib/mysql
|
||||
web:
|
||||
container_name: ${PREFIX}-web
|
||||
image: wp-php7.3:dev
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.http.routers.${PREFIX}-web.entrypoints=https
|
||||
- traefik.http.routers.${PREFIX}-web.rule=Host(`www.${PREFIX}.localhost`)
|
||||
- traefik.http.routers.${PREFIX}-web.tls=true
|
||||
- traefik.http.services.${PREFIX}-web.loadbalancer.server.port=80
|
||||
volumes:
|
||||
- web:/var/www/html
|
||||
|
||||
version: "3.4"
|
||||
|
||||
volumes:
|
||||
db:
|
||||
name: ${PREFIX}-db
|
||||
web:
|
||||
name: ${PREFIX}-web
|
||||
19
mnt.sh
Executable file
19
mnt.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#! /bin/bash
|
||||
#
|
||||
|
||||
set -o allexport;
|
||||
source ./.env;
|
||||
set +o allexport
|
||||
|
||||
volume_path=/home/$USER/.docker-data/volumes
|
||||
# volume_path=/var/lib/docker/volumes
|
||||
|
||||
volume_src_path=$volume_path/$PREFIX-web/_data
|
||||
volume_dest_path=$PWD/volume
|
||||
|
||||
|
||||
if [ -d ./volume ]; then
|
||||
if [ ! "$(ls -A ./volume)" ]; then
|
||||
/usr/bin/bindfs --force-user=$USER --force-group=$USER --create-for-user=www-data --create-for-group=www-data $volume_src_path $volume_dest_path
|
||||
fi
|
||||
fi
|
||||
12
old/purge.sh
Executable file
12
old/purge.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#! /bin/bash
|
||||
#
|
||||
|
||||
docker-compose stop
|
||||
docker stop wp2020-db-tmp
|
||||
docker network disconnect wp2020 traefik
|
||||
docker network rm wp2020
|
||||
docker volume rm wp2020-db
|
||||
docker volume rm wp2020-web
|
||||
umount volume
|
||||
docker rm wp2020-db-tmp
|
||||
rm volume -r
|
||||
17
old/restart.sh
Executable file
17
old/restart.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#! /bin/bash
|
||||
#
|
||||
|
||||
set -o allexport;
|
||||
source .env;
|
||||
set +o allexport
|
||||
|
||||
user=jeankri
|
||||
volume_name=$PREFIX-web
|
||||
volume_path=/home/$user/.docker-data/volumes
|
||||
# volume_path=/var/lib/docker/volumes
|
||||
|
||||
volume_src_path=$volume_path/$volume_name/_data
|
||||
volume_dest_path=$PWD/volume
|
||||
|
||||
sudo -u $user docker-compose restart;
|
||||
/usr/bin/bindfs --force-user=$user --force-group=$user --create-for-user=www-data --create-for-group=www-data $volume_src_path $volume_dest_path
|
||||
16
purge.sh
Executable file
16
purge.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#! /bin/bash
|
||||
#
|
||||
|
||||
set -o allexport;
|
||||
source .env;
|
||||
set +o allexport
|
||||
docker-compose stop
|
||||
|
||||
docker stop $PREFIX-db-tmp
|
||||
docker network disconnect $PREFIX traefik
|
||||
docker network rm $PREFIX
|
||||
docker volume rm $PREFIX-db
|
||||
docker volume rm $PREFIX-web
|
||||
umount volume
|
||||
docker rm $PREFIX-db-tmp
|
||||
rm volume -r
|
||||
Reference in New Issue
Block a user