Skip to content

Commit

Permalink
fix(Nextcloud): improve php-fpm pm config to avoid thread exhaustion (#…
Browse files Browse the repository at this point in the history
…232)

Signed-off-by: Philip Miglinci <[email protected]>
  • Loading branch information
pmig committed Aug 6, 2023
1 parent 54c2b03 commit 9425a9b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class NextcloudConfigMap : CRUDKubernetesDependentResource<ConfigMap, Nextcloud>
}
data = mapOf(
NextcloudDeployment.CONFIG_FILE_NAME to primary.configFile,
NextcloudDeployment.NGINX_CONFIG_FILE_NAME to nginxConfigFile
NextcloudDeployment.NGINX_CONFIG_FILE_NAME to nginxConfigFile,
NextcloudDeployment.PHP_FPM_CONFIG_FILE_NAME to phpFpmConfigFile
)
}

Expand All @@ -40,6 +41,9 @@ class NextcloudConfigMap : CRUDKubernetesDependentResource<ConfigMap, Nextcloud>
private val nginxConfigFile: String
get() = resourceAsString("nginx.conf")

private val phpFpmConfigFile: String
get() = resourceAsString("zzz-glasskube-php-fpm.conf")

private val Nextcloud.configFile: String
get() = kubernetesClient.kubernetesSerialization.asJson(
NextcloudInstallConfig(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ class NextcloudDeployment : CRUDKubernetesDependentResource<Deployment, Nextclou
name = TMP_VOLUME
mountPath = TMP_DIR
}
volumeMount {
name = CONFIG_VOLUME
mountPath = PHP_FPM_CONFIG_PATH
subPath = PHP_FPM_CONFIG_FILE_NAME
}
}
},
container {
Expand Down Expand Up @@ -286,6 +291,7 @@ class NextcloudDeployment : CRUDKubernetesDependentResource<Deployment, Nextclou
companion object {
internal const val CONFIG_FILE_NAME = "config.json"
internal const val NGINX_CONFIG_FILE_NAME = "nginx.conf"
internal const val PHP_FPM_CONFIG_FILE_NAME = "zzz-glasskube-php-fpm.conf"
private const val TMP_VOLUME = "tmp"
private const val TMP_DIR = "/var/www/tmp"
private const val DATA_VOLUME = "data"
Expand All @@ -296,5 +302,7 @@ class NextcloudDeployment : CRUDKubernetesDependentResource<Deployment, Nextclou
private const val CONFIG_FILE_PATH = "$CONFIG_DIR/$CONFIG_FILE_NAME"
private const val NGINX_CONFIG_DIR = "/etc/nginx"
private const val NGINX_CONFIG_PATH = "$NGINX_CONFIG_DIR/$NGINX_CONFIG_FILE_NAME"
private const val PHP_FPM_CONFIG_DIR = "/usr/local/etc/php-fpm.d/" // php-fpm config dir is different vom php.ini config dir
private const val PHP_FPM_CONFIG_PATH = "$PHP_FPM_CONFIG_DIR/$PHP_FPM_CONFIG_FILE_NAME"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pm = dynamic
pm.max_children = 64
pm.start_servers = 8
pm.min_spare_servers = 4
pm.max_spare_servers = 12

0 comments on commit 9425a9b

Please sign in to comment.