fix setting max connections

Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
szaimen 2022-08-22 22:45:03 +02:00
parent 20892c2d40
commit 2e1e53e9d3
3 changed files with 8 additions and 3 deletions

View file

@ -208,7 +208,7 @@ RUN set -ex; \
RUN set -ex; \
grep -q '^pm = dynamic' /usr/local/etc/php-fpm.d/www.conf; \
sed -i 's/^pm = dynamic/pm = ondemand/' /usr/local/etc/php-fpm.d/www.conf; \
sed -i 's/^pm.max_children =.*/pm.max_children = ${PHP_MAX_CHILDREN}/' /usr/local/etc/php-fpm.d/www.conf; \
sed -i 's/^pm.max_children =.*/pm.max_children = 80/' /usr/local/etc/php-fpm.d/www.conf; \
sed -i 's/^pm.start_servers =.*/pm.start_servers = 2/' /usr/local/etc/php-fpm.d/www.conf; \
sed -i 's/^pm.min_spare_servers =.*/pm.min_spare_servers = 1/' /usr/local/etc/php-fpm.d/www.conf; \
sed -i 's/^pm.max_spare_servers =.*/pm.max_spare_servers = 3/' /usr/local/etc/php-fpm.d/www.conf
@ -224,6 +224,7 @@ RUN set -ex; \
RUN set -ex; \
chown www-data:root -R /usr/src && \
chown www-data:root -R /usr/local/etc/php/conf.d && \
chown www-data:root /usr/local/etc/php-fpm.d/www.conf && \
chown www-data:root -R /var/log/supervisord/ && \
chown www-data:root -R /var/run/supervisord/ && \
rm -r /usr/src/nextcloud/apps/updatenotification

View file

@ -24,7 +24,9 @@ REDIS_CONF
echo "Setting php max children..."
MEMORY=$(mawk '/MemTotal/ {printf "%d", $2/1024}' /proc/meminfo)
PHP_MAX_CHILDREN=$((MEMORY/50))
export PHP_MAX_CHILDREN
if [ -n "$PHP_MAX_CHILDREN" ]; then
sed -i "s/^pm.max_children =.*/pm.max_children = $PHP_MAX_CHILDREN/" /usr/local/etc/php-fpm.d/www.conf
fi
# Check permissions in ncdata
touch "/mnt/ncdata/this-is-a-test-file"

View file

@ -113,7 +113,9 @@ fi
echo "Setting max connections..."
MEMORY=$(mawk '/MemTotal/ {printf "%d", $2/1024}' /proc/meminfo)
MAX_CONNECTIONS=$((MEMORY/50+3))
sed -i "s|^max_connections =.*|max_connections = $MAX_CONNECTIONS|" "/var/lib/postgresql/data/postgresql.conf"
if [ -n "$MAX_CONNECTIONS" ]; then
sed -i "s|^max_connections =.*|max_connections = $MAX_CONNECTIONS|" "/var/lib/postgresql/data/postgresql.conf"
fi
# Catch docker stop attempts
trap 'true' SIGINT SIGTERM