Leantime / docker-leantime

Official Docker Image for Leantime https://leantime.io
GNU Affero General Public License v3.0
186 stars 83 forks source link

Optimizing the pm.max_children setting #75

Open johncadengo opened 4 months ago

johncadengo commented 4 months ago

I'm getting this warning on a vanilla Leantime docker installation:

WARNING: [pool www] server reached pm.max_children setting (5), consider raising it

How do I update this setting within docker compose?

Related issue: https://github.com/Leantime/leantime/issues/2355

rqi14 commented 1 month ago

I didn't find any way to configure it with docker-compose.yaml

You can configure it using Dockerfile

# Use leantime/leantime:latest as the base image
FROM leantime/leantime:latest

# Specify the working directory
WORKDIR /usr/local/etc/php/conf.d

# Update memory_limit in custom.ini
RUN sed -i 's/memory_limit = 1G/memory_limit = 5G/' custom.ini

# Add additional settings to custom.ini
RUN echo 'pm = dynamic' >> custom.ini \
    && echo 'pm.max_children = 50' >> custom.ini \
    && echo 'pm.start_servers = 10' >> custom.ini \
    && echo 'pm.min_spare_servers = 10' >> custom.ini \
    && echo 'pm.max_spare_servers = 20' >> custom.ini \
    && echo 'post_max_size = 50M' >> custom.ini \
    && echo 'upload_max_filesize = 50M' >> custom.ini

# The above settings in custom.ini does not seem to work. change php-fpm settings directly
RUN sed -i 's/^pm = .*/pm = dynamic/' /usr/local/etc/php-fpm.d/www.conf \
    && sed -i 's/^pm.max_children = .*/pm.max_children = 50/' /usr/local/etc/php-fpm.d/www.conf \
    && sed -i 's/^pm.start_servers = .*/pm.start_servers = 10/' /usr/local/etc/php-fpm.d/www.conf \
    && sed -i 's/^pm.min_spare_servers = .*/pm.min_spare_servers = 10/' /usr/local/etc/php-fpm.d/www.conf \
    && sed -i 's/^pm.max_spare_servers = .*/pm.max_spare_servers = 20/' /usr/local/etc/php-fpm.d/www.conf \
    && sed -i 's/^pm.max_requests = .*/pm.max_requests = 2000/' /usr/local/etc/php-fpm.d/www.conf

# Expose any necessary ports and define the entrypoint if needed