From 58c5497dcc350ae91676308dc35467ab4b6cf467 Mon Sep 17 00:00:00 2001 From: Panayiotis Savva Date: Sat, 12 Mar 2022 11:16:32 +0200 Subject: [PATCH 1/8] fix unix --- .gitattributes | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1c544d8 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,20 @@ +# +# Configure line ending normalisation for this repository. +# See http://schacon.github.io/git/gitattributes.html for more information. +# +# Also each developer should configure the old style normalisation on her workstation +# (see http://timclem.wordpress.com/2012/03/01/mind-the-end-of-your-line/): +# +# Windows user should use: git config --global core.autocrlf = true +# Unix/Linux users should use: git config --global core.autocrlf = input +# + +# Auto detect text files and perform LF normalization +* text=auto + +*.txt text +*.xml text diff=xml +# Shell scripts require LF +*.sh text eol=lf +# Batch scripts require CRLF +*.bat text eol=crlf From 268eb44035e4c831fe9fb8c53b24af27dafbec98 Mon Sep 17 00:00:00 2001 From: Travis Tran Date: Fri, 3 Jun 2022 00:23:54 +0700 Subject: [PATCH 2/8] add ssl renwal --- bin/acme.sh | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/bin/acme.sh b/bin/acme.sh index f0650c0..1ea4247 100755 --- a/bin/acme.sh +++ b/bin/acme.sh @@ -8,6 +8,9 @@ TYPE=0 CONT_NAME='litespeed' ACME_SRC='https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh' EPACE=' ' +RENEW='' +RENEW_ALL='' +FORCE='' echow(){ FLAG=${1} @@ -172,6 +175,30 @@ install_cert(){ echo '[End] Apply Lets Encrypt Certificate' } +renew_acme(){ + echo '[Start] Renew ACME' + if [ "${FORCE}" = 'true' ]; then + docker-compose exec ${CONT_NAME} su -c "~/.acme.sh/acme.sh --renew --domain ${1} --force" + else + docker-compose exec ${CONT_NAME} su -c "~/.acme.sh/acme.sh --renew --domain ${1}" + fi + echo '[End] Renew ACME' + lsws_restart + exit 0 +} + +renew_all_acme(){ + echo '[Start] Renew all ACME' + if [ "${FORCE}" = 'true' ]; then + docker-compose exec ${CONT_NAME} su -c "~/.acme.sh/acme.sh --renew-all --force" + else + docker-compose exec ${CONT_NAME} su -c "~/.acme.sh/acme.sh --renew-all" + fi + echo '[End] Renew all ACME' + lsws_restart + exit 0 +} + main(){ check_acme domain_filter ${DOMAIN} @@ -198,7 +225,18 @@ while [ ! -z "${1}" ]; do -[uU] | --uninstall ) UNINSTALL=true uninstall_acme - ;; + ;; + -[fF] | --force ) + FORCE=true + ;; + -[r] | --renew ) + RENEW_=true + renew_acme ${DOMAIN} + ;; + -[R] | --renew-all ) + RENEW_ALL=true + renew_all_acme + ;; -[eE] | --email ) shift check_input "${1}" EMAIL="${1}" From 70e7048ad4f70cba47947ebaa5f20a42a7213db7 Mon Sep 17 00:00:00 2001 From: Travis Tran Date: Fri, 3 Jun 2022 00:27:37 +0700 Subject: [PATCH 3/8] default turn off docker logger to prevent unnecessary logs --- docker-compose.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 9818264..db777a4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,6 +2,8 @@ version: '3' services: mysql: image: mariadb:10.5.9 + logging: + driver: none command: --max_allowed_packet=256M volumes: - "./data/db:/var/lib/mysql:delegated" @@ -15,6 +17,8 @@ services: restart: always litespeed: image: litespeedtech/openlitespeed:${OLS_VERSION}-${PHP_VERSION} + logging: + driver: none env_file: - .env volumes: @@ -34,6 +38,8 @@ services: TZ: ${TimeZone} phpmyadmin: image: bitnami/phpmyadmin:5.0.2-debian-10-r72 + logging: + driver: none ports: - 8080:80 - 8443:443 From 577a60d0757e924bfefe274be21cfe68e9f46526 Mon Sep 17 00:00:00 2001 From: Travis Tran Date: Sun, 5 Jun 2022 22:37:44 +0700 Subject: [PATCH 4/8] allow dynamic -f parameter --- bin/acme.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/bin/acme.sh b/bin/acme.sh index 1ea4247..ecf07b4 100755 --- a/bin/acme.sh +++ b/bin/acme.sh @@ -34,6 +34,12 @@ help_message(){ echo -e "\033[1m Only for the First time\033[0m" echow '--install --email [EMAIL_ADDR]' echo "${EPACE}${EPACE}Will install ACME with the Email provided" + echow '-r, --renew' + echo "${EPACE}${EPACE}Renew a specific domain with -D or --domain parameter if posibile. To force renew, use -f parameter." + echow '-R, --renew-all' + echo "${EPACE}${EPACE}Renew all domains if possible. To force renew, use -f parameter." + echow '-f, -F, --force' + echo "${EPACE}${EPACE}Force renew for a specific domain or all domains." exit 0 ;; "3") @@ -184,7 +190,6 @@ renew_acme(){ fi echo '[End] Renew ACME' lsws_restart - exit 0 } renew_all_acme(){ @@ -196,10 +201,17 @@ renew_all_acme(){ fi echo '[End] Renew all ACME' lsws_restart - exit 0 } main(){ + if [ "${RENEW_ALL}" = 'true' ]; then + renew_all_acme + exit 0 + elif [ "${RENEW}" = 'true' ]; then + renew_acme ${DOMAIN} + exit 0 + fi + check_acme domain_filter ${DOMAIN} www_domain ${DOMAIN} @@ -230,12 +242,10 @@ while [ ! -z "${1}" ]; do FORCE=true ;; -[r] | --renew ) - RENEW_=true - renew_acme ${DOMAIN} + RENEW=true ;; -[R] | --renew-all ) RENEW_ALL=true - renew_all_acme ;; -[eE] | --email ) shift check_input "${1}" From 2943f6c8c3a4d9008d190a7fd8d32958030fb001 Mon Sep 17 00:00:00 2001 From: Travis Tran Date: Wed, 8 Jun 2022 16:54:20 +0700 Subject: [PATCH 5/8] add revoke and remove function --- bin/acme.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/bin/acme.sh b/bin/acme.sh index ecf07b4..dc9a549 100755 --- a/bin/acme.sh +++ b/bin/acme.sh @@ -11,6 +11,8 @@ EPACE=' ' RENEW='' RENEW_ALL='' FORCE='' +REVOKE='' +REMOVE='' echow(){ FLAG=${1} @@ -40,6 +42,10 @@ help_message(){ echo "${EPACE}${EPACE}Renew all domains if possible. To force renew, use -f parameter." echow '-f, -F, --force' echo "${EPACE}${EPACE}Force renew for a specific domain or all domains." + echow '-v, --revoke' + echo "${EPACE}${EPACE}Revoke a domain." + echow '-V, --remove' + echo "${EPACE}${EPACE}Remove a domain." exit 0 ;; "3") @@ -203,6 +209,20 @@ renew_all_acme(){ lsws_restart } +revoke(){ + echo '[Start] Revoke a domain' + docker-compose exec ${CONT_NAME} su -c "~/.acme.sh/acme.sh --revoke --domain ${1}" + echo '[End] Revoke a domain' + lsws_restart +} + +remove(){ + echo '[Start] Remove a domain' + docker-compose exec ${CONT_NAME} su -c "~/.acme.sh/acme.sh --remove --domain ${1}" + echo '[End] Remove a domain' + lsws_restart +} + main(){ if [ "${RENEW_ALL}" = 'true' ]; then renew_all_acme @@ -210,6 +230,12 @@ main(){ elif [ "${RENEW}" = 'true' ]; then renew_acme ${DOMAIN} exit 0 + elif [ "${REVOKE}" = 'true' ]; then + revoke ${DOMAIN} + exit 0 + elif [ "${REMOVE}" = 'true' ]; then + remove ${DOMAIN} + exit 0 fi check_acme @@ -247,6 +273,12 @@ while [ ! -z "${1}" ]; do -[R] | --renew-all ) RENEW_ALL=true ;; + -[v] | --revoke ) + REVOKE=true + ;; + -[V] | --remove ) + REMOVE=true + ;; -[eE] | --email ) shift check_input "${1}" EMAIL="${1}" From d4b29af45188f049f9ccc3444be6f3a8cc70614e Mon Sep 17 00:00:00 2001 From: tynanbe Date: Tue, 26 Jul 2022 13:39:11 -0500 Subject: [PATCH 6/8] Don't publish MySQL port --- docker-compose.yml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index db777a4..6593490 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,8 +7,6 @@ services: command: --max_allowed_packet=256M volumes: - "./data/db:/var/lib/mysql:delegated" - ports: - - "3306:3306" environment: MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} MYSQL_DATABASE: ${MYSQL_DATABASE} @@ -22,12 +20,12 @@ services: env_file: - .env volumes: - - ./lsws/conf:/usr/local/lsws/conf - - ./lsws/admin-conf:/usr/local/lsws/admin/conf - - ./bin/container:/usr/local/bin - - ./sites:/var/www/vhosts/ - - ./acme:/root/.acme.sh/ - - ./logs:/usr/local/lsws/logs/ + - ./lsws/conf:/usr/local/lsws/conf + - ./lsws/admin-conf:/usr/local/lsws/admin/conf + - ./bin/container:/usr/local/bin + - ./sites:/var/www/vhosts/ + - ./acme:/root/.acme.sh/ + - ./logs:/usr/local/lsws/logs/ ports: - 80:80 - 443:443 @@ -44,5 +42,5 @@ services: - 8080:80 - 8443:443 environment: - DATABASE_HOST: mysql - restart: always + DATABASE_HOST: mysql + restart: always From f52a09ade844d9be8494827ee39f040aea0a404b Mon Sep 17 00:00:00 2001 From: Ulrich Dyhr Ottosen Date: Tue, 2 Aug 2022 20:29:52 +0200 Subject: [PATCH 7/8] Added network section to ensure all containers are on same network, this helps laravel applications to migrate --- docker-compose.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 6593490..88ac96d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,6 +13,8 @@ services: MYSQL_USER: ${MYSQL_USER} MYSQL_PASSWORD: ${MYSQL_PASSWORD} restart: always + networks: + - default litespeed: image: litespeedtech/openlitespeed:${OLS_VERSION}-${PHP_VERSION} logging: @@ -34,6 +36,8 @@ services: restart: always environment: TZ: ${TimeZone} + networks: + - default phpmyadmin: image: bitnami/phpmyadmin:5.0.2-debian-10-r72 logging: @@ -44,3 +48,8 @@ services: environment: DATABASE_HOST: mysql restart: always + networks: + - default +networks: + default: + driver: bridge \ No newline at end of file From 1e980ee5baf9f0042ebabffd0c5bcf8c42f6806f Mon Sep 17 00:00:00 2001 From: Ulrich Dyhr Ottosen Date: Tue, 2 Aug 2022 20:53:50 +0200 Subject: [PATCH 8/8] updated PHP to version 8.1.x --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 1df78c8..77a79e1 100644 --- a/.env +++ b/.env @@ -1,6 +1,6 @@ TimeZone=America/New_York OLS_VERSION=1.7.15 -PHP_VERSION=lsphp80 +PHP_VERSION=lsphp81 MYSQL_DATABASE=wordpress MYSQL_ROOT_PASSWORD=password MYSQL_USER=wordpress