Use docker compose instead of docker-compose

modified:   README.md
	modified:   bin/acme.sh
	modified:   bin/appinstall.sh
	modified:   bin/database.sh
	modified:   bin/demosite.sh
	modified:   bin/domain.sh
	modified:   bin/webadmin.sh
This commit is contained in:
Cold-Egg
2022-10-26 20:44:37 +08:00
parent aeafac6022
commit 1a6a67579a
7 changed files with 35 additions and 35 deletions
+7 -7
View File
@@ -19,9 +19,9 @@ Clone this repository or copy the files from this repository into a new folder:
``` ```
git clone https://github.com/litespeedtech/ols-docker-env.git git clone https://github.com/litespeedtech/ols-docker-env.git
``` ```
Open a terminal, `cd` to the folder in which `docker-compose.yml` is saved, and run: Open a terminal, `cd` to the folder in which `docker compose.yml` is saved, and run:
``` ```
docker-compose up docker compose up
``` ```
Note: If you wish to run a single web server container, please see the [usage method here](https://github.com/litespeedtech/ols-dockerfiles#usage). Note: If you wish to run a single web server container, please see the [usage method here](https://github.com/litespeedtech/ols-dockerfiles#usage).
@@ -79,21 +79,21 @@ Cloned project
### Starting a Container ### Starting a Container
Start the container with the `up` or `start` methods: Start the container with the `up` or `start` methods:
``` ```
docker-compose up docker compose up
``` ```
You can run with daemon mode, like so: You can run with daemon mode, like so:
``` ```
docker-compose up -d docker compose up -d
``` ```
The container is now built and running. The container is now built and running.
### Stopping a Container ### Stopping a Container
``` ```
docker-compose stop docker compose stop
``` ```
### Removing Containers ### Removing Containers
To stop and remove all containers, use the `down` command: To stop and remove all containers, use the `down` command:
``` ```
docker-compose down docker compose down
``` ```
### Setting the WebAdmin Password ### Setting the WebAdmin Password
We strongly recommend you set your personal password right away. We strongly recommend you set your personal password right away.
@@ -186,7 +186,7 @@ RUN apt-get update && apt-get install lsphp80-pspell -y
``` ```
4. Build and start it with command: 4. Build and start it with command:
``` ```
docker-compose up --build docker compose up --build
``` ```
## Support & Feedback ## Support & Feedback
+15 -15
View File
@@ -87,7 +87,7 @@ email_filter(){
cert_hook(){ cert_hook(){
echo '[Start] Adding ACME hook' echo '[Start] Adding ACME hook'
docker-compose exec ${CONT_NAME} su -s /bin/bash -c "certhookctl.sh" docker compose exec ${CONT_NAME} su -s /bin/bash -c "certhookctl.sh"
echo '[End] Adding ACME hook' echo '[End] Adding ACME hook'
} }
@@ -122,12 +122,12 @@ domain_verify(){
install_acme(){ install_acme(){
echo '[Start] Install ACME' echo '[Start] Install ACME'
if [ "${1}" = 'true' ]; then if [ "${1}" = 'true' ]; then
docker-compose exec litespeed su -c "cd; wget ${ACME_SRC}; chmod 755 acme.sh; \ docker compose exec litespeed su -c "cd; wget ${ACME_SRC}; chmod 755 acme.sh; \
./acme.sh --install --cert-home ~/.acme.sh/certs; \ ./acme.sh --install --cert-home ~/.acme.sh/certs; \
rm ~/acme.sh" rm ~/acme.sh"
elif [ "${2}" != '' ]; then elif [ "${2}" != '' ]; then
email_filter "${2}" email_filter "${2}"
docker-compose exec litespeed su -c "cd; wget ${ACME_SRC}; chmod 755 acme.sh; \ docker compose exec litespeed su -c "cd; wget ${ACME_SRC}; chmod 755 acme.sh; \
./acme.sh --install --cert-home ~/.acme.sh/certs --accountemail ${2}; \ ./acme.sh --install --cert-home ~/.acme.sh/certs --accountemail ${2}; \
rm ~/acme.sh" rm ~/acme.sh"
else else
@@ -139,14 +139,14 @@ install_acme(){
uninstall_acme(){ uninstall_acme(){
echo '[Start] Uninstall ACME' echo '[Start] Uninstall ACME'
docker-compose exec ${CONT_NAME} su -c "~/.acme.sh/acme.sh --uninstall" docker compose exec ${CONT_NAME} su -c "~/.acme.sh/acme.sh --uninstall"
echo '[End] Uninstall ACME' echo '[End] Uninstall ACME'
exit 0 exit 0
} }
check_acme(){ check_acme(){
echo '[Start] Checking ACME' echo '[Start] Checking ACME'
docker-compose exec ${CONT_NAME} su -c "test -f /root/.acme.sh/acme.sh" docker compose exec ${CONT_NAME} su -c "test -f /root/.acme.sh/acme.sh"
if [ ${?} != 0 ]; then if [ ${?} != 0 ]; then
install_acme "${NO_EMAIL}" "${EMAIL}" install_acme "${NO_EMAIL}" "${EMAIL}"
cert_hook cert_hook
@@ -156,7 +156,7 @@ check_acme(){
} }
lsws_restart(){ lsws_restart(){
docker-compose exec ${CONT_NAME} su -c '/usr/local/lsws/bin/lswsctrl restart >/dev/null' docker compose exec ${CONT_NAME} su -c '/usr/local/lsws/bin/lswsctrl restart >/dev/null'
} }
doc_root_verify(){ doc_root_verify(){
@@ -165,7 +165,7 @@ doc_root_verify(){
else else
DOC_PATH="${DOC_ROOT}" DOC_PATH="${DOC_ROOT}"
fi fi
docker-compose exec ${CONT_NAME} su -c "[ -e ${DOC_PATH} ]" docker compose exec ${CONT_NAME} su -c "[ -e ${DOC_PATH} ]"
if [ ${?} -eq 0 ]; then if [ ${?} -eq 0 ]; then
echo -e "[O] The document root folder \033[32m${DOC_PATH}\033[0m does exist." echo -e "[O] The document root folder \033[32m${DOC_PATH}\033[0m does exist."
else else
@@ -177,9 +177,9 @@ doc_root_verify(){
install_cert(){ install_cert(){
echo '[Start] Apply Lets Encrypt Certificate' echo '[Start] Apply Lets Encrypt Certificate'
if [ ${TYPE} = 1 ]; then if [ ${TYPE} = 1 ]; then
docker-compose exec ${CONT_NAME} su -c "/root/.acme.sh/acme.sh --issue -d ${1} -w ${DOC_PATH}" docker compose exec ${CONT_NAME} su -c "/root/.acme.sh/acme.sh --issue -d ${1} -w ${DOC_PATH}"
elif [ ${TYPE} = 2 ]; then elif [ ${TYPE} = 2 ]; then
docker-compose exec ${CONT_NAME} su -c "/root/.acme.sh/acme.sh --issue -d ${1} -d www.${1} -w ${DOC_PATH}" docker compose exec ${CONT_NAME} su -c "/root/.acme.sh/acme.sh --issue -d ${1} -d www.${1} -w ${DOC_PATH}"
else else
echo 'unknown Type!' echo 'unknown Type!'
exit 2 exit 2
@@ -190,9 +190,9 @@ install_cert(){
renew_acme(){ renew_acme(){
echo '[Start] Renew ACME' echo '[Start] Renew ACME'
if [ "${FORCE}" = 'true' ]; then if [ "${FORCE}" = 'true' ]; then
docker-compose exec ${CONT_NAME} su -c "~/.acme.sh/acme.sh --renew --domain ${1} --force" docker compose exec ${CONT_NAME} su -c "~/.acme.sh/acme.sh --renew --domain ${1} --force"
else else
docker-compose exec ${CONT_NAME} su -c "~/.acme.sh/acme.sh --renew --domain ${1}" docker compose exec ${CONT_NAME} su -c "~/.acme.sh/acme.sh --renew --domain ${1}"
fi fi
echo '[End] Renew ACME' echo '[End] Renew ACME'
lsws_restart lsws_restart
@@ -201,9 +201,9 @@ renew_acme(){
renew_all_acme(){ renew_all_acme(){
echo '[Start] Renew all ACME' echo '[Start] Renew all ACME'
if [ "${FORCE}" = 'true' ]; then if [ "${FORCE}" = 'true' ]; then
docker-compose exec ${CONT_NAME} su -c "~/.acme.sh/acme.sh --renew-all --force" docker compose exec ${CONT_NAME} su -c "~/.acme.sh/acme.sh --renew-all --force"
else else
docker-compose exec ${CONT_NAME} su -c "~/.acme.sh/acme.sh --renew-all" docker compose exec ${CONT_NAME} su -c "~/.acme.sh/acme.sh --renew-all"
fi fi
echo '[End] Renew all ACME' echo '[End] Renew all ACME'
lsws_restart lsws_restart
@@ -211,14 +211,14 @@ renew_all_acme(){
revoke(){ revoke(){
echo '[Start] Revoke a domain' echo '[Start] Revoke a domain'
docker-compose exec ${CONT_NAME} su -c "~/.acme.sh/acme.sh --revoke --domain ${1}" docker compose exec ${CONT_NAME} su -c "~/.acme.sh/acme.sh --revoke --domain ${1}"
echo '[End] Revoke a domain' echo '[End] Revoke a domain'
lsws_restart lsws_restart
} }
remove(){ remove(){
echo '[Start] Remove a domain' echo '[Start] Remove a domain'
docker-compose exec ${CONT_NAME} su -c "~/.acme.sh/acme.sh --remove --domain ${1}" docker compose exec ${CONT_NAME} su -c "~/.acme.sh/acme.sh --remove --domain ${1}"
echo '[End] Remove a domain' echo '[End] Remove a domain'
lsws_restart lsws_restart
} }
+1 -1
View File
@@ -27,7 +27,7 @@ check_input(){
} }
app_download(){ app_download(){
docker-compose exec litespeed su -c "appinstallctl.sh --app ${1} --domain ${2}" docker compose exec litespeed su -c "appinstallctl.sh --app ${1} --domain ${2}"
bash bin/webadmin.sh -r bash bin/webadmin.sh -r
exit 0 exit 0
} }
+3 -3
View File
@@ -79,7 +79,7 @@ EOT
} }
check_db_access(){ check_db_access(){
docker-compose exec -T mysql su -c "mysql -uroot -p${MYSQL_ROOT_PASSWORD} -e 'status'" >/dev/null 2>&1 docker compose exec -T mysql su -c "mysql -uroot -p${MYSQL_ROOT_PASSWORD} -e 'status'" >/dev/null 2>&1
if [ ${?} != 0 ]; then if [ ${?} != 0 ]; then
echo '[X] DB access failed, please check!' echo '[X] DB access failed, please check!'
exit 1 exit 1
@@ -87,7 +87,7 @@ check_db_access(){
} }
check_db_exist(){ check_db_exist(){
docker-compose exec -T mysql su -c "test -e /var/lib/mysql/${1}" docker compose exec -T mysql su -c "test -e /var/lib/mysql/${1}"
if [ ${?} = 0 ]; then if [ ${?} = 0 ]; then
echo "Database ${1} already exist, skip DB creation!" echo "Database ${1} already exist, skip DB creation!"
exit 0 exit 0
@@ -95,7 +95,7 @@ check_db_exist(){
} }
db_setup(){ db_setup(){
docker-compose exec -T mysql su -c 'mysql -uroot -p${MYSQL_ROOT_PASSWORD} \ docker compose exec -T mysql su -c 'mysql -uroot -p${MYSQL_ROOT_PASSWORD} \
-e "CREATE DATABASE '${SQL_DB}';" \ -e "CREATE DATABASE '${SQL_DB}';" \
-e "GRANT ALL PRIVILEGES ON '${SQL_DB}'.* TO '${SQL_USER}'@'${ANY}' IDENTIFIED BY '${SQL_PASS}';" \ -e "GRANT ALL PRIVILEGES ON '${SQL_DB}'.* TO '${SQL_USER}'@'${ANY}' IDENTIFIED BY '${SQL_PASS}';" \
-e "FLUSH PRIVILEGES;"' -e "FLUSH PRIVILEGES;"'
+1 -1
View File
@@ -71,7 +71,7 @@ EOT
} }
app_download(){ app_download(){
docker-compose exec -T ${CONT_NAME} su -c "appinstallctl.sh --app ${1} --domain ${2}" docker compose exec -T ${CONT_NAME} su -c "appinstallctl.sh --app ${1} --domain ${2}"
} }
lsws_restart(){ lsws_restart(){
+2 -2
View File
@@ -27,7 +27,7 @@ check_input(){
add_domain(){ add_domain(){
check_input ${1} check_input ${1}
docker-compose exec ${CONT_NAME} su -s /bin/bash lsadm -c "cd /usr/local/lsws/conf && domainctl.sh --add ${1}" docker compose exec ${CONT_NAME} su -s /bin/bash lsadm -c "cd /usr/local/lsws/conf && domainctl.sh --add ${1}"
if [ ! -d "./sites/${1}" ]; then if [ ! -d "./sites/${1}" ]; then
mkdir -p ./sites/${1}/{html,logs,certs} mkdir -p ./sites/${1}/{html,logs,certs}
fi fi
@@ -36,7 +36,7 @@ add_domain(){
del_domain(){ del_domain(){
check_input ${1} check_input ${1}
docker-compose exec ${CONT_NAME} su -s /bin/bash lsadm -c "cd /usr/local/lsws/conf && domainctl.sh --del ${1}" docker compose exec ${CONT_NAME} su -s /bin/bash lsadm -c "cd /usr/local/lsws/conf && domainctl.sh --del ${1}"
bash bin/webadmin.sh -r bash bin/webadmin.sh -r
} }
+6 -6
View File
@@ -33,20 +33,20 @@ check_input(){
} }
lsws_restart(){ lsws_restart(){
docker-compose exec -T ${CONT_NAME} su -c '/usr/local/lsws/bin/lswsctrl restart >/dev/null' docker compose exec -T ${CONT_NAME} su -c '/usr/local/lsws/bin/lswsctrl restart >/dev/null'
} }
apply_serial(){ apply_serial(){
docker-compose exec ${CONT_NAME} su -c "serialctl.sh --serial ${1}" docker compose exec ${CONT_NAME} su -c "serialctl.sh --serial ${1}"
lsws_restart lsws_restart
} }
mod_secure(){ mod_secure(){
if [ "${1}" = 'enable' ] || [ "${1}" = 'Enable' ]; then if [ "${1}" = 'enable' ] || [ "${1}" = 'Enable' ]; then
docker-compose exec ${CONT_NAME} su -s /bin/bash root -c "owaspctl.sh --enable" docker compose exec ${CONT_NAME} su -s /bin/bash root -c "owaspctl.sh --enable"
lsws_restart lsws_restart
elif [ "${1}" = 'disable' ] || [ "${1}" = 'Disable' ]; then elif [ "${1}" = 'disable' ] || [ "${1}" = 'Disable' ]; then
docker-compose exec ${CONT_NAME} su -s /bin/bash root -c "owaspctl.sh --disable" docker compose exec ${CONT_NAME} su -s /bin/bash root -c "owaspctl.sh --disable"
lsws_restart lsws_restart
else else
help_message help_message
@@ -55,13 +55,13 @@ mod_secure(){
ls_upgrade(){ ls_upgrade(){
echo 'Upgrade web server to latest stable version.' echo 'Upgrade web server to latest stable version.'
docker-compose exec ${CONT_NAME} su -c '/usr/local/lsws/admin/misc/lsup.sh 2>/dev/null' docker compose exec ${CONT_NAME} su -c '/usr/local/lsws/admin/misc/lsup.sh 2>/dev/null'
} }
set_web_admin(){ set_web_admin(){
echo 'Update web admin password.' echo 'Update web admin password.'
local LSADPATH='/usr/local/lsws/admin' local LSADPATH='/usr/local/lsws/admin'
docker-compose exec ${CONT_NAME} su -s /bin/bash lsadm -c \ docker compose exec ${CONT_NAME} su -s /bin/bash lsadm -c \
'if [ -e /usr/local/lsws/admin/fcgi-bin/admin_php ]; then \ 'if [ -e /usr/local/lsws/admin/fcgi-bin/admin_php ]; then \
echo "admin:$('${LSADPATH}'/fcgi-bin/admin_php -q '${LSADPATH}'/misc/htpasswd.php '${1}')" > '${LSADPATH}'/conf/htpasswd; \ echo "admin:$('${LSADPATH}'/fcgi-bin/admin_php -q '${LSADPATH}'/misc/htpasswd.php '${1}')" > '${LSADPATH}'/conf/htpasswd; \
else echo "admin:$('${LSADPATH}'/fcgi-bin/admin_php5 -q '${LSADPATH}'/misc/htpasswd.php '${1}')" > '${LSADPATH}'/conf/htpasswd; \ else echo "admin:$('${LSADPATH}'/fcgi-bin/admin_php5 -q '${LSADPATH}'/misc/htpasswd.php '${1}')" > '${LSADPATH}'/conf/htpasswd; \