Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Friendica] Fix TZ variable & add redis session cache #11851

Merged
merged 1 commit into from
Feb 11, 2022

Conversation

nupplaphil
Copy link
Contributor

No description provided.

@github-actions
Copy link

Diff for 37fa501:
diff --git a/_bashbrew-cat b/_bashbrew-cat
index 54f3b41..7b99dd0 100644
--- a/_bashbrew-cat
+++ b/_bashbrew-cat
@@ -4,45 +4,45 @@ GitFetch: refs/heads/stable
 
 Tags: 2021.09-apache, 2021.09
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 43bc72769649584863f8a90666e3cd1465bd7758
+GitCommit: 6edd78174b1a6de7610146c092c7a316d435f527
 Directory: 2021.09/apache
 
 Tags: 2021.09-fpm
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 43bc72769649584863f8a90666e3cd1465bd7758
+GitCommit: 6edd78174b1a6de7610146c092c7a316d435f527
 Directory: 2021.09/fpm
 
 Tags: 2021.09-fpm-alpine
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 43bc72769649584863f8a90666e3cd1465bd7758
+GitCommit: 6edd78174b1a6de7610146c092c7a316d435f527
 Directory: 2021.09/fpm-alpine
 
 Tags: 2022.02-apache, apache, stable-apache, 2022.02, latest, stable
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 43bc72769649584863f8a90666e3cd1465bd7758
+GitCommit: 6edd78174b1a6de7610146c092c7a316d435f527
 Directory: 2022.02/apache
 
 Tags: 2022.02-fpm, fpm, stable-fpm
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 43bc72769649584863f8a90666e3cd1465bd7758
+GitCommit: 6edd78174b1a6de7610146c092c7a316d435f527
 Directory: 2022.02/fpm
 
 Tags: 2022.02-fpm-alpine, fpm-alpine, stable-fpm-alpine
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 43bc72769649584863f8a90666e3cd1465bd7758
+GitCommit: 6edd78174b1a6de7610146c092c7a316d435f527
 Directory: 2022.02/fpm-alpine
 
 Tags: 2022.05-dev-apache, dev-apache, 2022.05-dev, dev
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 43bc72769649584863f8a90666e3cd1465bd7758
+GitCommit: 6edd78174b1a6de7610146c092c7a316d435f527
 Directory: 2022.05-dev/apache
 
 Tags: 2022.05-dev-fpm, dev-fpm
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 43bc72769649584863f8a90666e3cd1465bd7758
+GitCommit: 6edd78174b1a6de7610146c092c7a316d435f527
 Directory: 2022.05-dev/fpm
 
 Tags: 2022.05-dev-fpm-alpine, dev-fpm-alpine
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 43bc72769649584863f8a90666e3cd1465bd7758
+GitCommit: 6edd78174b1a6de7610146c092c7a316d435f527
 Directory: 2022.05-dev/fpm-alpine
diff --git a/friendica_2021.09-fpm-alpine/entrypoint.sh b/friendica_2021.09-fpm-alpine/entrypoint.sh
index 3d324f2..bb723fb 100755
--- a/friendica_2021.09-fpm-alpine/entrypoint.sh
+++ b/friendica_2021.09-fpm-alpine/entrypoint.sh
@@ -43,6 +43,32 @@ sh /setup_msmtp.sh
 
 # just check if we execute apache or php-fpm
 if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
+  if [ -n "${REDIS_HOST+x}" ]; then
+    echo "Configuring Redis as session handler"
+    {
+      file_env REDIS_PW
+      echo 'session.save_handler = redis'
+      # check if redis host is an unix socket path
+      if [ "${REDIS_HOST:0:1}" = "/" ]; then
+        if [ -n "${REDIS_PW+x}" ]; then
+          echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\""
+        else
+          echo "session.save_path = \"unix://${REDIS_HOST}\""
+        fi
+      # check if redis password has been set
+      elif [ -n "${REDIS_PW+x}" ]; then
+          echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_PORT:=6379}?auth=${REDIS_PW}\""
+      else
+          echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_PORT:=6379}\""
+      fi
+      echo "redis.session.locking_enabled = 1"
+      echo "redis.session.lock_retries = -1"
+      # redis.session.lock_wait_time is specified in microseconds.
+      # Wait 10ms before retrying the lock rather than the default 2ms.
+      echo "redis.session.lock_wait_time = 10000"
+    } > /usr/local/etc/php/conf.d/redis-session.ini
+  fi
+
   installed_version="0.0.0.0"
   if [ -f /var/www/html/VERSION ]; then
     installed_version="$(cat /var/www/html/VERSION)"
@@ -99,7 +125,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
       if [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ] && [ -n "${MYSQL_USER+x}" ] && [ -n "${FRIENDICA_ADMIN_MAIL+x}" ] && [ -n "${FRIENDICA_URL+x}" ]; then
         echo "Installation with environment variables"
 
-        FRIENDICA_TZ=${FRIENDICA_TZ:-America/LosAngeles}
+        FRIENDICA_TZ=${FRIENDICA_TZ:-America/New_York}
         FRIENDICA_LANG=${FRIENDICA_LANG:-en}
         MYSQL_PORT=${MYSQL_PORT:-3306}
 
diff --git a/friendica_2021.09-fpm/entrypoint.sh b/friendica_2021.09-fpm/entrypoint.sh
index 3d324f2..bb723fb 100755
--- a/friendica_2021.09-fpm/entrypoint.sh
+++ b/friendica_2021.09-fpm/entrypoint.sh
@@ -43,6 +43,32 @@ sh /setup_msmtp.sh
 
 # just check if we execute apache or php-fpm
 if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
+  if [ -n "${REDIS_HOST+x}" ]; then
+    echo "Configuring Redis as session handler"
+    {
+      file_env REDIS_PW
+      echo 'session.save_handler = redis'
+      # check if redis host is an unix socket path
+      if [ "${REDIS_HOST:0:1}" = "/" ]; then
+        if [ -n "${REDIS_PW+x}" ]; then
+          echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\""
+        else
+          echo "session.save_path = \"unix://${REDIS_HOST}\""
+        fi
+      # check if redis password has been set
+      elif [ -n "${REDIS_PW+x}" ]; then
+          echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_PORT:=6379}?auth=${REDIS_PW}\""
+      else
+          echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_PORT:=6379}\""
+      fi
+      echo "redis.session.locking_enabled = 1"
+      echo "redis.session.lock_retries = -1"
+      # redis.session.lock_wait_time is specified in microseconds.
+      # Wait 10ms before retrying the lock rather than the default 2ms.
+      echo "redis.session.lock_wait_time = 10000"
+    } > /usr/local/etc/php/conf.d/redis-session.ini
+  fi
+
   installed_version="0.0.0.0"
   if [ -f /var/www/html/VERSION ]; then
     installed_version="$(cat /var/www/html/VERSION)"
@@ -99,7 +125,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
       if [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ] && [ -n "${MYSQL_USER+x}" ] && [ -n "${FRIENDICA_ADMIN_MAIL+x}" ] && [ -n "${FRIENDICA_URL+x}" ]; then
         echo "Installation with environment variables"
 
-        FRIENDICA_TZ=${FRIENDICA_TZ:-America/LosAngeles}
+        FRIENDICA_TZ=${FRIENDICA_TZ:-America/New_York}
         FRIENDICA_LANG=${FRIENDICA_LANG:-en}
         MYSQL_PORT=${MYSQL_PORT:-3306}
 
diff --git a/friendica_2021.09/entrypoint.sh b/friendica_2021.09/entrypoint.sh
index 3d324f2..bb723fb 100755
--- a/friendica_2021.09/entrypoint.sh
+++ b/friendica_2021.09/entrypoint.sh
@@ -43,6 +43,32 @@ sh /setup_msmtp.sh
 
 # just check if we execute apache or php-fpm
 if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
+  if [ -n "${REDIS_HOST+x}" ]; then
+    echo "Configuring Redis as session handler"
+    {
+      file_env REDIS_PW
+      echo 'session.save_handler = redis'
+      # check if redis host is an unix socket path
+      if [ "${REDIS_HOST:0:1}" = "/" ]; then
+        if [ -n "${REDIS_PW+x}" ]; then
+          echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\""
+        else
+          echo "session.save_path = \"unix://${REDIS_HOST}\""
+        fi
+      # check if redis password has been set
+      elif [ -n "${REDIS_PW+x}" ]; then
+          echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_PORT:=6379}?auth=${REDIS_PW}\""
+      else
+          echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_PORT:=6379}\""
+      fi
+      echo "redis.session.locking_enabled = 1"
+      echo "redis.session.lock_retries = -1"
+      # redis.session.lock_wait_time is specified in microseconds.
+      # Wait 10ms before retrying the lock rather than the default 2ms.
+      echo "redis.session.lock_wait_time = 10000"
+    } > /usr/local/etc/php/conf.d/redis-session.ini
+  fi
+
   installed_version="0.0.0.0"
   if [ -f /var/www/html/VERSION ]; then
     installed_version="$(cat /var/www/html/VERSION)"
@@ -99,7 +125,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
       if [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ] && [ -n "${MYSQL_USER+x}" ] && [ -n "${FRIENDICA_ADMIN_MAIL+x}" ] && [ -n "${FRIENDICA_URL+x}" ]; then
         echo "Installation with environment variables"
 
-        FRIENDICA_TZ=${FRIENDICA_TZ:-America/LosAngeles}
+        FRIENDICA_TZ=${FRIENDICA_TZ:-America/New_York}
         FRIENDICA_LANG=${FRIENDICA_LANG:-en}
         MYSQL_PORT=${MYSQL_PORT:-3306}
 
diff --git a/friendica_dev-fpm-alpine/entrypoint.sh b/friendica_dev-fpm-alpine/entrypoint.sh
index 3d324f2..bb723fb 100755
--- a/friendica_dev-fpm-alpine/entrypoint.sh
+++ b/friendica_dev-fpm-alpine/entrypoint.sh
@@ -43,6 +43,32 @@ sh /setup_msmtp.sh
 
 # just check if we execute apache or php-fpm
 if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
+  if [ -n "${REDIS_HOST+x}" ]; then
+    echo "Configuring Redis as session handler"
+    {
+      file_env REDIS_PW
+      echo 'session.save_handler = redis'
+      # check if redis host is an unix socket path
+      if [ "${REDIS_HOST:0:1}" = "/" ]; then
+        if [ -n "${REDIS_PW+x}" ]; then
+          echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\""
+        else
+          echo "session.save_path = \"unix://${REDIS_HOST}\""
+        fi
+      # check if redis password has been set
+      elif [ -n "${REDIS_PW+x}" ]; then
+          echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_PORT:=6379}?auth=${REDIS_PW}\""
+      else
+          echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_PORT:=6379}\""
+      fi
+      echo "redis.session.locking_enabled = 1"
+      echo "redis.session.lock_retries = -1"
+      # redis.session.lock_wait_time is specified in microseconds.
+      # Wait 10ms before retrying the lock rather than the default 2ms.
+      echo "redis.session.lock_wait_time = 10000"
+    } > /usr/local/etc/php/conf.d/redis-session.ini
+  fi
+
   installed_version="0.0.0.0"
   if [ -f /var/www/html/VERSION ]; then
     installed_version="$(cat /var/www/html/VERSION)"
@@ -99,7 +125,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
       if [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ] && [ -n "${MYSQL_USER+x}" ] && [ -n "${FRIENDICA_ADMIN_MAIL+x}" ] && [ -n "${FRIENDICA_URL+x}" ]; then
         echo "Installation with environment variables"
 
-        FRIENDICA_TZ=${FRIENDICA_TZ:-America/LosAngeles}
+        FRIENDICA_TZ=${FRIENDICA_TZ:-America/New_York}
         FRIENDICA_LANG=${FRIENDICA_LANG:-en}
         MYSQL_PORT=${MYSQL_PORT:-3306}
 
diff --git a/friendica_dev-fpm/entrypoint.sh b/friendica_dev-fpm/entrypoint.sh
index 3d324f2..bb723fb 100755
--- a/friendica_dev-fpm/entrypoint.sh
+++ b/friendica_dev-fpm/entrypoint.sh
@@ -43,6 +43,32 @@ sh /setup_msmtp.sh
 
 # just check if we execute apache or php-fpm
 if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
+  if [ -n "${REDIS_HOST+x}" ]; then
+    echo "Configuring Redis as session handler"
+    {
+      file_env REDIS_PW
+      echo 'session.save_handler = redis'
+      # check if redis host is an unix socket path
+      if [ "${REDIS_HOST:0:1}" = "/" ]; then
+        if [ -n "${REDIS_PW+x}" ]; then
+          echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\""
+        else
+          echo "session.save_path = \"unix://${REDIS_HOST}\""
+        fi
+      # check if redis password has been set
+      elif [ -n "${REDIS_PW+x}" ]; then
+          echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_PORT:=6379}?auth=${REDIS_PW}\""
+      else
+          echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_PORT:=6379}\""
+      fi
+      echo "redis.session.locking_enabled = 1"
+      echo "redis.session.lock_retries = -1"
+      # redis.session.lock_wait_time is specified in microseconds.
+      # Wait 10ms before retrying the lock rather than the default 2ms.
+      echo "redis.session.lock_wait_time = 10000"
+    } > /usr/local/etc/php/conf.d/redis-session.ini
+  fi
+
   installed_version="0.0.0.0"
   if [ -f /var/www/html/VERSION ]; then
     installed_version="$(cat /var/www/html/VERSION)"
@@ -99,7 +125,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
       if [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ] && [ -n "${MYSQL_USER+x}" ] && [ -n "${FRIENDICA_ADMIN_MAIL+x}" ] && [ -n "${FRIENDICA_URL+x}" ]; then
         echo "Installation with environment variables"
 
-        FRIENDICA_TZ=${FRIENDICA_TZ:-America/LosAngeles}
+        FRIENDICA_TZ=${FRIENDICA_TZ:-America/New_York}
         FRIENDICA_LANG=${FRIENDICA_LANG:-en}
         MYSQL_PORT=${MYSQL_PORT:-3306}
 
diff --git a/friendica_dev/entrypoint.sh b/friendica_dev/entrypoint.sh
index 3d324f2..bb723fb 100755
--- a/friendica_dev/entrypoint.sh
+++ b/friendica_dev/entrypoint.sh
@@ -43,6 +43,32 @@ sh /setup_msmtp.sh
 
 # just check if we execute apache or php-fpm
 if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
+  if [ -n "${REDIS_HOST+x}" ]; then
+    echo "Configuring Redis as session handler"
+    {
+      file_env REDIS_PW
+      echo 'session.save_handler = redis'
+      # check if redis host is an unix socket path
+      if [ "${REDIS_HOST:0:1}" = "/" ]; then
+        if [ -n "${REDIS_PW+x}" ]; then
+          echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\""
+        else
+          echo "session.save_path = \"unix://${REDIS_HOST}\""
+        fi
+      # check if redis password has been set
+      elif [ -n "${REDIS_PW+x}" ]; then
+          echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_PORT:=6379}?auth=${REDIS_PW}\""
+      else
+          echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_PORT:=6379}\""
+      fi
+      echo "redis.session.locking_enabled = 1"
+      echo "redis.session.lock_retries = -1"
+      # redis.session.lock_wait_time is specified in microseconds.
+      # Wait 10ms before retrying the lock rather than the default 2ms.
+      echo "redis.session.lock_wait_time = 10000"
+    } > /usr/local/etc/php/conf.d/redis-session.ini
+  fi
+
   installed_version="0.0.0.0"
   if [ -f /var/www/html/VERSION ]; then
     installed_version="$(cat /var/www/html/VERSION)"
@@ -99,7 +125,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
       if [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ] && [ -n "${MYSQL_USER+x}" ] && [ -n "${FRIENDICA_ADMIN_MAIL+x}" ] && [ -n "${FRIENDICA_URL+x}" ]; then
         echo "Installation with environment variables"
 
-        FRIENDICA_TZ=${FRIENDICA_TZ:-America/LosAngeles}
+        FRIENDICA_TZ=${FRIENDICA_TZ:-America/New_York}
         FRIENDICA_LANG=${FRIENDICA_LANG:-en}
         MYSQL_PORT=${MYSQL_PORT:-3306}
 
diff --git a/friendica_stable-fpm-alpine/entrypoint.sh b/friendica_stable-fpm-alpine/entrypoint.sh
index 3d324f2..bb723fb 100755
--- a/friendica_stable-fpm-alpine/entrypoint.sh
+++ b/friendica_stable-fpm-alpine/entrypoint.sh
@@ -43,6 +43,32 @@ sh /setup_msmtp.sh
 
 # just check if we execute apache or php-fpm
 if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
+  if [ -n "${REDIS_HOST+x}" ]; then
+    echo "Configuring Redis as session handler"
+    {
+      file_env REDIS_PW
+      echo 'session.save_handler = redis'
+      # check if redis host is an unix socket path
+      if [ "${REDIS_HOST:0:1}" = "/" ]; then
+        if [ -n "${REDIS_PW+x}" ]; then
+          echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\""
+        else
+          echo "session.save_path = \"unix://${REDIS_HOST}\""
+        fi
+      # check if redis password has been set
+      elif [ -n "${REDIS_PW+x}" ]; then
+          echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_PORT:=6379}?auth=${REDIS_PW}\""
+      else
+          echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_PORT:=6379}\""
+      fi
+      echo "redis.session.locking_enabled = 1"
+      echo "redis.session.lock_retries = -1"
+      # redis.session.lock_wait_time is specified in microseconds.
+      # Wait 10ms before retrying the lock rather than the default 2ms.
+      echo "redis.session.lock_wait_time = 10000"
+    } > /usr/local/etc/php/conf.d/redis-session.ini
+  fi
+
   installed_version="0.0.0.0"
   if [ -f /var/www/html/VERSION ]; then
     installed_version="$(cat /var/www/html/VERSION)"
@@ -99,7 +125,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
       if [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ] && [ -n "${MYSQL_USER+x}" ] && [ -n "${FRIENDICA_ADMIN_MAIL+x}" ] && [ -n "${FRIENDICA_URL+x}" ]; then
         echo "Installation with environment variables"
 
-        FRIENDICA_TZ=${FRIENDICA_TZ:-America/LosAngeles}
+        FRIENDICA_TZ=${FRIENDICA_TZ:-America/New_York}
         FRIENDICA_LANG=${FRIENDICA_LANG:-en}
         MYSQL_PORT=${MYSQL_PORT:-3306}
 
diff --git a/friendica_stable-fpm/entrypoint.sh b/friendica_stable-fpm/entrypoint.sh
index 3d324f2..bb723fb 100755
--- a/friendica_stable-fpm/entrypoint.sh
+++ b/friendica_stable-fpm/entrypoint.sh
@@ -43,6 +43,32 @@ sh /setup_msmtp.sh
 
 # just check if we execute apache or php-fpm
 if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
+  if [ -n "${REDIS_HOST+x}" ]; then
+    echo "Configuring Redis as session handler"
+    {
+      file_env REDIS_PW
+      echo 'session.save_handler = redis'
+      # check if redis host is an unix socket path
+      if [ "${REDIS_HOST:0:1}" = "/" ]; then
+        if [ -n "${REDIS_PW+x}" ]; then
+          echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\""
+        else
+          echo "session.save_path = \"unix://${REDIS_HOST}\""
+        fi
+      # check if redis password has been set
+      elif [ -n "${REDIS_PW+x}" ]; then
+          echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_PORT:=6379}?auth=${REDIS_PW}\""
+      else
+          echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_PORT:=6379}\""
+      fi
+      echo "redis.session.locking_enabled = 1"
+      echo "redis.session.lock_retries = -1"
+      # redis.session.lock_wait_time is specified in microseconds.
+      # Wait 10ms before retrying the lock rather than the default 2ms.
+      echo "redis.session.lock_wait_time = 10000"
+    } > /usr/local/etc/php/conf.d/redis-session.ini
+  fi
+
   installed_version="0.0.0.0"
   if [ -f /var/www/html/VERSION ]; then
     installed_version="$(cat /var/www/html/VERSION)"
@@ -99,7 +125,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
       if [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ] && [ -n "${MYSQL_USER+x}" ] && [ -n "${FRIENDICA_ADMIN_MAIL+x}" ] && [ -n "${FRIENDICA_URL+x}" ]; then
         echo "Installation with environment variables"
 
-        FRIENDICA_TZ=${FRIENDICA_TZ:-America/LosAngeles}
+        FRIENDICA_TZ=${FRIENDICA_TZ:-America/New_York}
         FRIENDICA_LANG=${FRIENDICA_LANG:-en}
         MYSQL_PORT=${MYSQL_PORT:-3306}
 
diff --git a/friendica_stable/entrypoint.sh b/friendica_stable/entrypoint.sh
index 3d324f2..bb723fb 100755
--- a/friendica_stable/entrypoint.sh
+++ b/friendica_stable/entrypoint.sh
@@ -43,6 +43,32 @@ sh /setup_msmtp.sh
 
 # just check if we execute apache or php-fpm
 if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
+  if [ -n "${REDIS_HOST+x}" ]; then
+    echo "Configuring Redis as session handler"
+    {
+      file_env REDIS_PW
+      echo 'session.save_handler = redis'
+      # check if redis host is an unix socket path
+      if [ "${REDIS_HOST:0:1}" = "/" ]; then
+        if [ -n "${REDIS_PW+x}" ]; then
+          echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\""
+        else
+          echo "session.save_path = \"unix://${REDIS_HOST}\""
+        fi
+      # check if redis password has been set
+      elif [ -n "${REDIS_PW+x}" ]; then
+          echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_PORT:=6379}?auth=${REDIS_PW}\""
+      else
+          echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_PORT:=6379}\""
+      fi
+      echo "redis.session.locking_enabled = 1"
+      echo "redis.session.lock_retries = -1"
+      # redis.session.lock_wait_time is specified in microseconds.
+      # Wait 10ms before retrying the lock rather than the default 2ms.
+      echo "redis.session.lock_wait_time = 10000"
+    } > /usr/local/etc/php/conf.d/redis-session.ini
+  fi
+
   installed_version="0.0.0.0"
   if [ -f /var/www/html/VERSION ]; then
     installed_version="$(cat /var/www/html/VERSION)"
@@ -99,7 +125,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
       if [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ] && [ -n "${MYSQL_USER+x}" ] && [ -n "${FRIENDICA_ADMIN_MAIL+x}" ] && [ -n "${FRIENDICA_URL+x}" ]; then
         echo "Installation with environment variables"
 
-        FRIENDICA_TZ=${FRIENDICA_TZ:-America/LosAngeles}
+        FRIENDICA_TZ=${FRIENDICA_TZ:-America/New_York}
         FRIENDICA_LANG=${FRIENDICA_LANG:-en}
         MYSQL_PORT=${MYSQL_PORT:-3306}

Relevant Maintainers:

@yosifkit yosifkit merged commit 4fede7d into docker-library:master Feb 11, 2022
@nupplaphil nupplaphil deleted the friendica branch February 11, 2022 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants