From b8df5887cae0aea8bc8e7fce1e94978f07260d33 Mon Sep 17 00:00:00 2001 From: ma-04 <120931948+ma-04@users.noreply.github.com> Date: Fri, 20 Jun 2025 09:28:03 +0600 Subject: [PATCH 1/7] fix(ols): Fix OLS permission issue caused by binding to uid 1000 --- openlitespeed/Dockerfile | 13 ++++++++++--- openlitespeed/build.sh | 2 +- openlitespeed/entrypoint.sh | 22 ++++++++++++++++++++-- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/openlitespeed/Dockerfile b/openlitespeed/Dockerfile index cfee7a3..0ca2a43 100644 --- a/openlitespeed/Dockerfile +++ b/openlitespeed/Dockerfile @@ -11,7 +11,7 @@ ARG TARGETPLATFORM # Install necessary packages RUN apt-get update && apt-get install -y --no-install-recommends \ wget curl cron less tzdata gnupg2 ca-certificates procps libatomic1 \ - msmtp git \ + msmtp git mysql-client \ && rm -rf /var/lib/apt/lists/* # Download and install OpenLiteSpeed @@ -48,8 +48,8 @@ RUN wget -qO /usr/local/bin/composer https://getcomposer.org/download/latest-sta && chmod +x /usr/local/bin/wp \ && echo "alias wp='wp --allow-root'" >> /root/.bashrc -# Set up www-data user -RUN usermod -u 1000 www-data +# Clearing Group ID 1000 for later use +RUN groupmod -g 999 lsadm # Create necessary directories RUN mkdir -p /var/www/html/public /var/www/html/logs \ @@ -78,6 +78,13 @@ RUN chown -R lsadm:lsadm /usr/local/lsws \ COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh +# TEmp +RUN chown -R lsadm:lsadm /usr/local/lsws +RUN chmod 777 /usr/local/lsws/bin/ +RUN chown -R www-data:www-data /usr/local/lsws/conf/ + + EXPOSE 80 +#USER www-data ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/openlitespeed/build.sh b/openlitespeed/build.sh index bb3f834..dedc5ec 100644 --- a/openlitespeed/build.sh +++ b/openlitespeed/build.sh @@ -3,7 +3,7 @@ # Set variables DOCKER_HUB_USERNAME="meghsh" IMAGE_NAME="openlitespeed" -OLS_VERSION="1.8.1" +OLS_VERSION="1.8.3" # Ensure BuildKit is enabled export DOCKER_BUILDKIT=1 diff --git a/openlitespeed/entrypoint.sh b/openlitespeed/entrypoint.sh index 6a0796b..916f8e4 100644 --- a/openlitespeed/entrypoint.sh +++ b/openlitespeed/entrypoint.sh @@ -1,11 +1,29 @@ #!/bin/bash set -e +echo "www-data UID is: $(id -u www-data) and GID $(id -g www-data)" + + +# Check and set PGID and PUID +if [ -z "$PGID" ] || [ -z "$PUID" ]; then + echo "PGID or PUID not set, using defaults." + PGID=1000 + PUID=1000 +fi +echo "setting UID to $PGID and GUID $PUID" + +groupmod -g $PGID www-data +usermod -u $PUID www-data + +# echo "www-data group ID is: $(id -u www-data) and $(id -g www-data)" +# echo "$(whoami) group ID is: $(id -u) and $(id -g)" + # Ensure correct permissions chown -R www-data:www-data /var/www/html chown -R lsadm:lsadm /usr/local/lsws -find /var/www/html -type d -exec chmod 755 {} \; -find /var/www/html -type f -exec chmod 644 {} \; +# find /var/www/html -type d -exec chmod 755 {} \; +# find /var/www/html -type f -exec chmod 644 {} \; + # Start OpenLiteSpeed echo "Starting OpenLiteSpeed..." From 0449bb13694a71fbb1dc94da9d5c041f79d491f9 Mon Sep 17 00:00:00 2001 From: ma-04 <120931948+ma-04@users.noreply.github.com> Date: Fri, 20 Jun 2025 09:51:54 +0600 Subject: [PATCH 2/7] chore: remove unnecessary context --- openlitespeed/Dockerfile | 6 ------ 1 file changed, 6 deletions(-) diff --git a/openlitespeed/Dockerfile b/openlitespeed/Dockerfile index 0ca2a43..acccf03 100644 --- a/openlitespeed/Dockerfile +++ b/openlitespeed/Dockerfile @@ -78,13 +78,7 @@ RUN chown -R lsadm:lsadm /usr/local/lsws \ COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh -# TEmp -RUN chown -R lsadm:lsadm /usr/local/lsws -RUN chmod 777 /usr/local/lsws/bin/ -RUN chown -R www-data:www-data /usr/local/lsws/conf/ - EXPOSE 80 -#USER www-data ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file From bb71de337efe91e152408a8620cfd2c7382e4f18 Mon Sep 17 00:00:00 2001 From: ma-04 <120931948+ma-04@users.noreply.github.com> Date: Fri, 20 Jun 2025 09:52:51 +0600 Subject: [PATCH 3/7] chore: remove other PR commits --- openlitespeed/entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlitespeed/entrypoint.sh b/openlitespeed/entrypoint.sh index 916f8e4..3b6d312 100644 --- a/openlitespeed/entrypoint.sh +++ b/openlitespeed/entrypoint.sh @@ -21,8 +21,8 @@ usermod -u $PUID www-data # Ensure correct permissions chown -R www-data:www-data /var/www/html chown -R lsadm:lsadm /usr/local/lsws -# find /var/www/html -type d -exec chmod 755 {} \; -# find /var/www/html -type f -exec chmod 644 {} \; +find /var/www/html -type d -exec chmod 755 {} \; +find /var/www/html -type f -exec chmod 644 {} \; # Start OpenLiteSpeed From f251662ffcdc4c5ee020d12afbc937ce9f964e9a Mon Sep 17 00:00:00 2001 From: ma-04 <120931948+ma-04@users.noreply.github.com> Date: Fri, 20 Jun 2025 09:53:36 +0600 Subject: [PATCH 4/7] chore: remove misc comments --- openlitespeed/entrypoint.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/openlitespeed/entrypoint.sh b/openlitespeed/entrypoint.sh index 3b6d312..c7d0f66 100644 --- a/openlitespeed/entrypoint.sh +++ b/openlitespeed/entrypoint.sh @@ -3,7 +3,6 @@ set -e echo "www-data UID is: $(id -u www-data) and GID $(id -g www-data)" - # Check and set PGID and PUID if [ -z "$PGID" ] || [ -z "$PUID" ]; then echo "PGID or PUID not set, using defaults." @@ -15,16 +14,12 @@ echo "setting UID to $PGID and GUID $PUID" groupmod -g $PGID www-data usermod -u $PUID www-data -# echo "www-data group ID is: $(id -u www-data) and $(id -g www-data)" -# echo "$(whoami) group ID is: $(id -u) and $(id -g)" - # Ensure correct permissions chown -R www-data:www-data /var/www/html chown -R lsadm:lsadm /usr/local/lsws find /var/www/html -type d -exec chmod 755 {} \; find /var/www/html -type f -exec chmod 644 {} \; - # Start OpenLiteSpeed echo "Starting OpenLiteSpeed..." if ! /usr/local/lsws/bin/lswsctrl start; then From 85d30a2da2af8ddbc39ea064e0a03be1f616d11c Mon Sep 17 00:00:00 2001 From: ma-04 <120931948+ma-04@users.noreply.github.com> Date: Mon, 23 Jun 2025 11:15:58 +0600 Subject: [PATCH 5/7] chore: Separate uid/gid check --- openlitespeed/entrypoint.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/openlitespeed/entrypoint.sh b/openlitespeed/entrypoint.sh index c7d0f66..0fbab23 100644 --- a/openlitespeed/entrypoint.sh +++ b/openlitespeed/entrypoint.sh @@ -3,12 +3,17 @@ set -e echo "www-data UID is: $(id -u www-data) and GID $(id -g www-data)" -# Check and set PGID and PUID -if [ -z "$PGID" ] || [ -z "$PUID" ]; then - echo "PGID or PUID not set, using defaults." +# Check and set PGID and PUID separately +if [ -z "$PGID" ]; then + echo "PGID not set, using default." PGID=1000 +fi + +if [ -z "$PUID" ]; then + echo "PUID not set, using default." PUID=1000 fi + echo "setting UID to $PGID and GUID $PUID" groupmod -g $PGID www-data From a378e2555f3ae90fb8955c689d6084674a34b895 Mon Sep 17 00:00:00 2001 From: ma-04 <120931948+ma-04@users.noreply.github.com> Date: Mon, 23 Jun 2025 11:43:31 +0600 Subject: [PATCH 6/7] chore: fix typo --- openlitespeed/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlitespeed/entrypoint.sh b/openlitespeed/entrypoint.sh index 0fbab23..bf76f14 100644 --- a/openlitespeed/entrypoint.sh +++ b/openlitespeed/entrypoint.sh @@ -14,7 +14,7 @@ if [ -z "$PUID" ]; then PUID=1000 fi -echo "setting UID to $PGID and GUID $PUID" +echo "setting GID to $PGID and UID to $PUID" groupmod -g $PGID www-data usermod -u $PUID www-data From d47bcde1e0a5cf88f15f6d81e8b17dd78c468f62 Mon Sep 17 00:00:00 2001 From: ma-04 <120931948+ma-04@users.noreply.github.com> Date: Thu, 17 Jul 2025 15:43:52 +0600 Subject: [PATCH 7/7] chore: remove extra line --- openlitespeed/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/openlitespeed/Dockerfile b/openlitespeed/Dockerfile index acccf03..1e78678 100644 --- a/openlitespeed/Dockerfile +++ b/openlitespeed/Dockerfile @@ -78,7 +78,6 @@ RUN chown -R lsadm:lsadm /usr/local/lsws \ COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh - EXPOSE 80 ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file