Filippo Giunchedi has submitted this change and it was merged.
Change subject: cassandra: ship systemd service file
......................................................................
cassandra: ship systemd service file
first step towards merging the multi-instance patch
Bug: T108306
Change-Id: Id95b5315ea5927e00397e85a06d1cd55516fdd44
---
A modules/cassandra/files/cassandra-tmpfiles.conf
A modules/cassandra/files/cassandra.in.sh
M modules/cassandra/manifests/init.pp
M modules/cassandra/templates/cassandra-env.sh.erb
A modules/cassandra/templates/initscripts/cassandra.systemd.erb
5 files changed, 70 insertions(+), 10 deletions(-)
Approvals:
Filippo Giunchedi: Verified; Looks good to me, approved
Mobrovac: Looks good to me, but someone else must approve
Alexandros Kosiaris: Looks good to me, but someone else must approve
diff --git a/modules/cassandra/files/cassandra-tmpfiles.conf
b/modules/cassandra/files/cassandra-tmpfiles.conf
new file mode 100644
index 0000000..6d49b10
--- /dev/null
+++ b/modules/cassandra/files/cassandra-tmpfiles.conf
@@ -0,0 +1,2 @@
+# this file is owned by puppet
+d /var/run/cassandra 0755 cassandra cassandra
diff --git a/modules/cassandra/files/cassandra.in.sh
b/modules/cassandra/files/cassandra.in.sh
new file mode 100644
index 0000000..b0f2624
--- /dev/null
+++ b/modules/cassandra/files/cassandra.in.sh
@@ -0,0 +1,28 @@
+# this file is similar to the stock /usr/share/cassandra/cassandra.in.sh
+# but we are not setting CASSANDRA_CONF here, it'll be overridden
+CASSANDRA_HOME=/usr/share/cassandra
+
+# The java classpath (required)
+if [ -n "$CLASSPATH" ]; then
+ CLASSPATH=$CLASSPATH:$CASSANDRA_CONF
+else
+ CLASSPATH=$CASSANDRA_CONF
+fi
+
+for jar in /usr/share/cassandra/lib/*.jar; do
+ CLASSPATH=$CLASSPATH:$jar
+done
+
+for jar in /usr/share/cassandra/*.jar; do
+ CLASSPATH=$CLASSPATH:$jar
+done
+
+CLASSPATH="$CLASSPATH:$EXTRA_CLASSPATH"
+
+
+# set JVM javaagent opts to avoid warnings/errors
+if [ "$JVM_VENDOR" != "OpenJDK" -o "$JVM_VERSION" \> "1.6.0" ] \
+ || [ "$JVM_VERSION" = "1.6.0" -a "$JVM_PATCH_VERSION" -ge 23 ]
+then
+ JAVA_AGENT="$JAVA_AGENT -javaagent:$CASSANDRA_HOME/lib/jamm-0.3.0.jar"
+fi
diff --git a/modules/cassandra/manifests/init.pp
b/modules/cassandra/manifests/init.pp
index 13bb3ca..2840d30 100644
--- a/modules/cassandra/manifests/init.pp
+++ b/modules/cassandra/manifests/init.pp
@@ -472,20 +472,34 @@
ensure => 'absent',
}
- service { 'cassandra':
- ensure => 'running',
- enable => true,
- hasstatus => true,
- hasrestart => true,
- # This module does not subscribe to its config files,
- # as we would like to manage service restarts manually.
- require => [
+ file { '/etc/cassandra.in.sh':
+ ensure => present,
+ source => "puppet:///modules/${module_name}/cassandra.in.sh",
+ owner => 'cassandra',
+ group => 'cassandra',
+ mode => '0444',
+ require => Package['cassandra'],
+ }
+
+ file { '/etc/tmpfiles.d/cassandra.conf':
+ ensure => present,
+ source => "puppet:///modules/${module_name}/cassandra-tmpfiles.conf",
+ owner => 'cassandra',
+ group => 'cassandra',
+ mode => '0444',
+ require => Package['cassandra'],
+ }
+
+ base::service_unit { 'cassandra':
+ ensure => present,
+ template_name => 'cassandra',
+ systemd => true,
+ refresh => false,
+ require => [
File[$data_file_directories],
File['/etc/cassandra/cassandra-env.sh'],
File['/etc/cassandra/cassandra.yaml'],
File['/etc/cassandra/cassandra-rackdc.properties'],
- File['/etc/cassandra/cassandra-topology.properties'],
- File['/etc/cassandra/cassandra-topology.yaml'],
],
}
}
diff --git a/modules/cassandra/templates/cassandra-env.sh.erb
b/modules/cassandra/templates/cassandra-env.sh.erb
index b182f3c..70e1a8b 100644
--- a/modules/cassandra/templates/cassandra-env.sh.erb
+++ b/modules/cassandra/templates/cassandra-env.sh.erb
@@ -252,6 +252,9 @@
JVM_OPTS="$JVM_OPTS -XX:NumberOfGCLogFiles=10"
JVM_OPTS="$JVM_OPTS -XX:GCLogFileSize=10M"
+# used by cassandra-metrics-collector to report metrics for this instance
+JVM_OPTS="$JVM_OPTS -Dcassandra.instance-id=<%= @hostname %>"
+
# Configure the following for JEMallocAllocator and if jemalloc is not
available in the system
# library path (Example: /usr/local/lib/). Usually "make install" will do the
right thing.
# export LD_LIBRARY_PATH=<JEMALLOC_HOME>/lib/
diff --git a/modules/cassandra/templates/initscripts/cassandra.systemd.erb
b/modules/cassandra/templates/initscripts/cassandra.systemd.erb
new file mode 100644
index 0000000..0f88b3d
--- /dev/null
+++ b/modules/cassandra/templates/initscripts/cassandra.systemd.erb
@@ -0,0 +1,13 @@
+[Unit]
+Description=distributed storage system for structured data
+After=network.target
+
+[Service]
+User=cassandra
+PIDFile=/var/run/cassandra/cassandra.pid
+LimitNOFILE=100000
+LimitMEMLOCK=infinity
+Environment="CASSANDRA_INCLUDE=/etc/cassandra.in.sh"
+Environment="CASSANDRA_CONF=/etc/cassandra"
+Environment="CASSANDRA_INSTANCE=<%= @hostname %>"
+ExecStart=/usr/sbin/cassandra -p /var/run/cassandra/cassandra.pid
--
To view, visit https://gerrit.wikimedia.org/r/242548
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id95b5315ea5927e00397e85a06d1cd55516fdd44
Gerrit-PatchSet: 4
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Filippo Giunchedi <[email protected]>
Gerrit-Reviewer: Alexandros Kosiaris <[email protected]>
Gerrit-Reviewer: Eevans <[email protected]>
Gerrit-Reviewer: Faidon Liambotis <[email protected]>
Gerrit-Reviewer: Filippo Giunchedi <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>
Gerrit-Reviewer: Mobrovac <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits