mirror of
				https://github.com/nextcloud/all-in-one.git
				synced 2025-10-31 03:01:27 +08:00 
			
		
		
		
	Merge pull request #3666 from nextcloud/enh/noid/fix-some-values
This commit is contained in:
		
						commit
						2635354137
					
				
					 3 changed files with 15 additions and 29 deletions
				
			
		|  | @ -195,10 +195,10 @@ RUN set -ex; \ | ||||||
|     \ |     \ | ||||||
|     grep -q '^pm = dynamic' /usr/local/etc/php-fpm.d/www.conf; \ |     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 = dynamic/pm = ondemand/' /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; \ | # Sync this with max db connections | ||||||
|     sed -i 's/^pm.start_servers =.*/pm.start_servers = 2/' /usr/local/etc/php-fpm.d/www.conf; \ | # We don't actually expect so many children but don't want to limit it artificially because people will report issues otherwise. | ||||||
|     sed -i 's/^pm.min_spare_servers =.*/pm.min_spare_servers = 1/' /usr/local/etc/php-fpm.d/www.conf; \ | # Also children will usually be terminated again after the process is done due to the ondemand setting | ||||||
|     sed -i 's/^pm.max_spare_servers =.*/pm.max_spare_servers = 3/' /usr/local/etc/php-fpm.d/www.conf; \ |     sed -i 's/^pm.max_children =.*/pm.max_children = 5000/' /usr/local/etc/php-fpm.d/www.conf; \ | ||||||
|     sed -i 's|access.log = /proc/self/fd/2|access.log = /proc/self/fd/1|' /usr/local/etc/php-fpm.d/docker.conf; \ |     sed -i 's|access.log = /proc/self/fd/2|access.log = /proc/self/fd/1|' /usr/local/etc/php-fpm.d/docker.conf; \ | ||||||
|     \ |     \ | ||||||
|     rm -rf /tmp/nextcloud-aio && \ |     rm -rf /tmp/nextcloud-aio && \ | ||||||
|  |  | ||||||
|  | @ -30,18 +30,6 @@ redis.session.lock_retries = -1 | ||||||
| redis.session.lock_wait_time = 10000 | redis.session.lock_wait_time = 10000 | ||||||
| REDIS_CONF | REDIS_CONF | ||||||
| 
 | 
 | ||||||
| echo "Setting php max children..." |  | ||||||
| MEMORY=$(awk '/MemTotal/ {printf "%d", $2/1024}' /proc/meminfo) |  | ||||||
| PHP_MAX_CHILDREN=$((MEMORY/50)) |  | ||||||
| # 100 is the default, we do not want to go lower than this |  | ||||||
| if [ "$PHP_MAX_CHILDREN" -lt 100 ]; then |  | ||||||
|     PHP_MAX_CHILDREN=100 |  | ||||||
| fi |  | ||||||
| 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 |  | ||||||
|     sed -i "s/^;pm.process_idle_timeout =.*/pm.process_idle_timeout = 3s/" /usr/local/etc/php-fpm.d/www.conf |  | ||||||
| fi |  | ||||||
| 
 |  | ||||||
| # Check permissions in ncdata | # Check permissions in ncdata | ||||||
| touch "$NEXTCLOUD_DATA_DIR/this-is-a-test-file" &>/dev/null | touch "$NEXTCLOUD_DATA_DIR/this-is-a-test-file" &>/dev/null | ||||||
| if ! [ -f "$NEXTCLOUD_DATA_DIR/this-is-a-test-file" ]; then | if ! [ -f "$NEXTCLOUD_DATA_DIR/this-is-a-test-file" ]; then | ||||||
|  |  | ||||||
|  | @ -148,24 +148,22 @@ fi | ||||||
| 
 | 
 | ||||||
| # Modify postgresql.conf | # Modify postgresql.conf | ||||||
| if [ -f "/var/lib/postgresql/data/postgresql.conf" ]; then | if [ -f "/var/lib/postgresql/data/postgresql.conf" ]; then | ||||||
|     echo "Setting max connections..." |     echo "Setting postgres values..." | ||||||
|     MEMORY=$(awk '/MemTotal/ {printf "%d", $2/1024}' /proc/meminfo) | 
 | ||||||
|     MAX_CONNECTIONS=$((MEMORY/50+3)) |     # 5000 connections is apparently the highest possible value with postgres so set it to that so that we don't run into a limit here. | ||||||
|     if [ -n "$MAX_CONNECTIONS" ]; then |     # We don't actually expect so many connections but don't want to limit it artificially because people will report issues otherwise | ||||||
|         # 100 is the default, we do not want to go lower than this |     # Also connections should usually be closed again after the process is done | ||||||
|         if [ "$MAX_CONNECTIONS" -lt 100 ]; then |     # If we should actually exceed this limit, it is definitely a bug in Nextcloud server or some of its apps that does not close connections correctly and not a bug in AIO | ||||||
|             MAX_CONNECTIONS=100 |     sed -i "s|^max_connections =.*|max_connections = 5000|" "/var/lib/postgresql/data/postgresql.conf" | ||||||
|         fi |  | ||||||
|         sed -i "s|^max_connections =.*|max_connections = $MAX_CONNECTIONS|" "/var/lib/postgresql/data/postgresql.conf" |  | ||||||
|     fi |  | ||||||
| 
 | 
 | ||||||
|     # Do not log checkpoints |     # Do not log checkpoints | ||||||
|     if grep -q "#log_checkpoints" /var/lib/postgresql/data/postgresql.conf; then |     if grep -q "#log_checkpoints" /var/lib/postgresql/data/postgresql.conf; then | ||||||
|         sed -i 's|#log_checkpoints.*|log_checkpoints = off|' /var/lib/postgresql/data/postgresql.conf |         sed -i 's|#log_checkpoints.*|log_checkpoints = off|' /var/lib/postgresql/data/postgresql.conf | ||||||
|     fi |     fi | ||||||
|     # Close idling connections automatically after 3s which does not seem to happen automatically so that we run into max_connections limits | 
 | ||||||
|     if grep -q "#idle_session_timeout" /var/lib/postgresql/data/postgresql.conf; then |     # Closing idling connections automatically seems to break any logic so was reverted again to default where it is disabled | ||||||
|         sed -i 's|#idle_session_timeout.*|idle_session_timeout = 3000|' /var/lib/postgresql/data/postgresql.conf |     if grep -q "^idle_session_timeout" /var/lib/postgresql/data/postgresql.conf; then | ||||||
|  |         sed -i 's|^idle_session_timeout.*|#idle_session_timeout|' /var/lib/postgresql/data/postgresql.conf | ||||||
|     fi |     fi | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue