mirror of
https://github.com/10h30/ols-docker-env.git
synced 2026-05-12 15:21:24 +09:00
added new bins, changed the regex for domain bins, added some dev bins
This commit is contained in:
Executable
+24
@@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# create random password
|
||||||
|
|
||||||
|
if [ -z "$1" ]
|
||||||
|
then
|
||||||
|
echo "Missing arguments, exit"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
PASSWDDBnoQoutes="$(openssl rand -base64 12)"
|
||||||
|
PASSWDDB="'$PASSWDDBnoQoutes'"
|
||||||
|
SITE=$1
|
||||||
|
|
||||||
|
MAINDB="${SITE}_db"
|
||||||
|
echo Database: $MAINDB
|
||||||
|
echo Username: $MAINDB
|
||||||
|
echo Password: $PASSWDDBnoQoutes
|
||||||
|
any="'%'"
|
||||||
|
|
||||||
|
docker-compose exec mysql su -c 'apk add mysql-client'
|
||||||
|
docker-compose exec mysql su -c 'mysql -uroot -ppassword -e "CREATE DATABASE '${MAINDB}' /*\!40100 DEFAULT CHARACTER SET utf8 */;"'
|
||||||
|
docker-compose exec mysql su -c 'mysql -uroot -ppassword -e "CREATE USER '${MAINDB}'@${any} IDENTIFIED BY '${PASSWDDB}';"'
|
||||||
|
docker-compose exec mysql su -c 'mysql -uroot -ppassword -e "GRANT ALL PRIVILEGES ON '${MAINDB}'.* TO '${MAINDB}'@${any};"'
|
||||||
|
docker-compose exec mysql su -c "mysql -uroot -ppassword -e 'FLUSH PRIVILEGES;'"
|
||||||
Executable
+4
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
docker-compose exec litespeed su -s /bin/bash lsadm -c "cd /usr/local/lsws/conf && addDomainCtl.sh $1"
|
||||||
|
[ ! -d "./sites/$1" ] && mkdir -p ./sites/$1/{html,logs}
|
||||||
|
|
||||||
@@ -1,5 +1,19 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
domain=${1//\./\\.}
|
||||||
|
#replace . with \.
|
||||||
|
#so example.com becomes example\.com, this is because in regex . is used for matching any character
|
||||||
|
#so the regex would match on example.com and example7com, because . matches on "7"
|
||||||
|
#httpd_conf=`cat httpd_config.conf`
|
||||||
|
check=$(perl -0777 -ne 'print $1 if /(^ member '$domain' \{.*[^}]*})/m' httpd_config.conf)
|
||||||
|
#check=$(perl -0777 -le "print $1 if /(^ member $domain \{.*[^}]*})/m" httpd_config.conf)
|
||||||
|
if [ ! -z "$check" ]; then
|
||||||
|
echo "# It appears the domain already exist, therefor we won\'t add it. Check the httpd_config.conf if you believe this is a mistake"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "# Domain has been added"
|
||||||
|
fi
|
||||||
|
|
||||||
perl -0777 -p -i -e 's/(vhTemplate centralConfigLog \{[^}]+)\}*(^.*listeners.*$)/\1$2
|
perl -0777 -p -i -e 's/(vhTemplate centralConfigLog \{[^}]+)\}*(^.*listeners.*$)/\1$2
|
||||||
member '$1' {
|
member '$1' {
|
||||||
vhDomain '$1'
|
vhDomain '$1'
|
||||||
|
|||||||
@@ -3,7 +3,16 @@ domain=${1//\./\\.}
|
|||||||
#replace . with \.
|
#replace . with \.
|
||||||
#so example.com becomes example\.com, this is because in regex . is used for matching any character
|
#so example.com becomes example\.com, this is because in regex . is used for matching any character
|
||||||
#so the regex would match on example.com and example7com, because . matches on "7"
|
#so the regex would match on example.com and example7com, because . matches on "7"
|
||||||
perl -0777 -p -i.bak -e "s/(vhtemplate centralConfigLog \{[^}]+)*(^.*member "$domain" \{.*[^}]*})/\1#thislinewillbedeletedj98311/gmi" httpd_config.conf
|
|
||||||
|
check=$(perl -0777 -ne 'print $1 if /(^ member '$domain' \{.*[^}]*})/m' httpd_config.conf)
|
||||||
|
if [ ! -z "$check" ]; then
|
||||||
|
echo "# Domain has been removed"
|
||||||
|
else
|
||||||
|
echo "# We couldn't find the domain you wanted to remove, is it already removed?. Check the httpd_config.conf if you believe this is a mistake"
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
perl -0777 -p -i.bak -e "s/(^ member $domain \{.*[^}]*})/#thislinewillbedeletedj98311/gmi" httpd_config.conf
|
||||||
perl -i -ne '/#thislinewillbedeletedj98311/ or print' httpd_config.conf
|
perl -i -ne '/#thislinewillbedeletedj98311/ or print' httpd_config.conf
|
||||||
#aboves replaces the matched group with a string and random numbers, then second command searches for that string and deletes the line
|
#aboves replaces the matched group with a string and random numbers, then second command searches for that string and deletes the line
|
||||||
#if anyone can figure out how to do above in oneline, feel free to let us know
|
#if anyone can figure out how to do above in oneline, feel free to let us know
|
||||||
|
|||||||
Executable
+2
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
git ls-files -v|grep '^S'
|
||||||
Executable
+2
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
find conf -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && pwd && git ls-files -z ${pwd} | xargs -0 git update-index --no-skip-worktree" \;
|
||||||
Executable
+3
@@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
find conf -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && pwd && git ls-files -z ${pwd} | xargs -0 git update-index --skip-worktree" \;
|
||||||
|
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
cd /var/www/vhosts/$1/html
|
||||||
|
if [ ! -f "./wp-config.php" ]; then
|
||||||
|
# su -s /bin/bash www-data -c
|
||||||
|
COUNTER=0
|
||||||
|
until [ "$(curl -v mysql:3306 2>&1 | grep native)" ];
|
||||||
|
do
|
||||||
|
echo "Counter: ${COUNTER}"
|
||||||
|
COUNTER=$((COUNTER+1))
|
||||||
|
if [ ${COUNTER} = 10 ]; then
|
||||||
|
echo '--- MySQL is starting, please wait... ---'
|
||||||
|
elif [ ${COUNTER} = 100 ]; then
|
||||||
|
echo '--- MySQL is timeout, exit! ---'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
wp core download \
|
||||||
|
--allow-root \
|
||||||
|
--force
|
||||||
|
first_www_uid=$(stat -c "%u" /var/www/vhosts/localhost)
|
||||||
|
first_www_gid=$(stat -c "%g" /var/www/vhosts/localhost)
|
||||||
|
chown $first_www_uid:$first_www_gid /var/www/vhosts/localhost -R
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
www_uid=$(stat -c "%u" /var/www/vhosts/localhost)
|
||||||
|
if [ ${www_uid} -eq 0 ]; then
|
||||||
|
#echo "./sites/localhost is owned by root, auto changing ownership of ./sites/localhost to uid 1000"
|
||||||
|
chown 1000:1000 /var/www/vhosts/localhost -R
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "WordPress installation finished."
|
||||||
|
exec "$@"
|
||||||
|
|
||||||
Reference in New Issue
Block a user