- edited description
Make Service File Limits User-Controlled and Remove Extra Newline
Issue #27
closed
In the fix for issue , I noticed the "LimitNOFILE" and "LimitNPROC" were both hard-coded to be 65000. I do not understand the full consequences of the warning and why this exact value is required, but I do believe this should be a user-controlled value, just in case, with a default value of 65000 to avoid the mentioned warning.#25
After recently pushing some configs, I noticed an extra blank newline in solr.in.sh.epp
.
The below patch fixes both of the mentioned "issues".
diff --git a/manifests/config.pp b/manifests/config.pp
index 5f62f68..858fcbc 100644
--- a/manifests/config.pp
+++ b/manifests/config.pp
@@ -108,6 +108,8 @@ class solr::config {
solr_env => $solr::solr_env,
solr_user => $solr::solr_user,
zk_service => $solr::zk_service,
+ limit_nofile => $solr::limit_nofile,
+ limit_nproc => $solr::limit_nproc,
}),
require => File[$::solr::solr_env],
}
diff --git a/manifests/init.pp b/manifests/init.pp
index de4b47a..5aab3b2 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -79,6 +79,12 @@
# Bash style environment variables passed at the end of the solr
# server environment.
#
+# @param limit_nofile
+# Sets number of open files limit in systemd service file.
+#
+# @param limit_nproc
+# Sets number of processes limit in systemd service file.
+#
# @param cores
# An array of hashes that define a core which will be created with the
# create_resources function.
@@ -178,6 +184,8 @@ class solr (
String $solr_home = '/opt/solr/server/solr',
String $java_home = $solr::params::java_home,
Optional[Array] $solr_environment = undef,
+ Integer $limit_nofile = 65000,
+ Integer $limit_nproc = 65000,
Hash $cores = {},
Array $required_packages = $solr::params::required_packages,
Optional[Array] $zk_hosts = undef,
diff --git a/templates/solr.in.sh.epp b/templates/solr.in.sh.epp
index a5daa37..c6649f5 100644
--- a/templates/solr.in.sh.epp
+++ b/templates/solr.in.sh.epp
@@ -44,7 +44,7 @@
# By default the script will use JAVA_HOME to determine which java
# to use, but you can set a specific path for Solr to use without
# affecting other Java applications on your server/workstation.
-SOLR_JAVA_HOME=<%= $java_home %>
+SOLR_JAVA_HOME=<%= $java_home -%>
<% if $solr_java_mem { %>
# Expert: If you want finer control over memory options, specify them directly
diff --git a/templates/solr.service.epp b/templates/solr.service.epp
index 1522970..ea71856 100644
--- a/templates/solr.service.epp
+++ b/templates/solr.service.epp
@@ -5,6 +5,8 @@
String $solr_env,
String $solr_user,
Optional[String] $zk_service,
+ Integer $limit_nofile,
+ Integer $limit_nproc,
|-%>
####################################################################
#### NOTE: THIS FILE IS PUPPET CONTROLLED - ANY CHAGES WILL BE LOST
@@ -24,8 +26,8 @@ ExecStatus=<%= $solr_bin %>/solr status -noprompt
ExecReload=/bin/kill -s HUP $MAINPID
User=<%= $solr_user %>
PrivateTmp=true
-LimitNOFILE=65000
-LimitNPROC=65000
+LimitNOFILE=<%= $limit_nofile %>
+LimitNPROC=<%= $limit_nproc %>
[Install]
WantedBy=multi-user.target
Comments (8)
-
reporter -
reporter - edited description
- attached limit_set.diff
Added variable definitions when referencing the EPP template.
-
reporter - edited description
- attached limit_set.diff
-
Thank you for your submission. I will look into adding this and producing a new release.
-
-
assigned issue to
- edited description
-
assigned issue to
-
- marked as enhancement
-
- changed status to resolved
This patch has been applied in version 6.0.7. Thank you for your submission.
-
- changed status to closed
- Log in to comment