From bcc99b274f4d9010e3c34b1df070b67df0100b04 Mon Sep 17 00:00:00 2001 From: Takuya ASADA Date: Tue, 1 Dec 2015 23:27:22 +0900 Subject: [PATCH 1/3] dist: drop dist/common/scripts/jmx_run, use scripts/scylla-jmx --- dist/common/scripts/jmx_run | 5 ----- dist/common/sysconfig/scylla-jmx | 9 ++++++++- dist/redhat/scylla-jmx.spec.in | 4 ++-- dist/redhat/systemd/scylla-jmx.service | 2 +- dist/ubuntu/debian/rules | 2 +- dist/ubuntu/debian/scylla-jmx.init | 3 +-- dist/ubuntu/debian/scylla-jmx.upstart | 3 +-- scripts/scylla-jmx | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) delete mode 100755 dist/common/scripts/jmx_run diff --git a/dist/common/scripts/jmx_run b/dist/common/scripts/jmx_run deleted file mode 100755 index 1970488..0000000 --- a/dist/common/scripts/jmx_run +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -e - -args="-Djava.net.preferIPv4Stack=true -Dcom.sun.management.jmxremote.port=$JMX_LOCAL_PORT -Dcom.sun.management.jmxremote.rmi.port=$JMX_LOCAL_PORT -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false" - -exec java $args -jar /usr/lib/scylla/jmx/urchin-mbean-1.0.jar diff --git a/dist/common/sysconfig/scylla-jmx b/dist/common/sysconfig/scylla-jmx index 810a72c..07cf22b 100644 --- a/dist/common/sysconfig/scylla-jmx +++ b/dist/common/sysconfig/scylla-jmx @@ -1 +1,8 @@ -JMX_LOCAL_PORT=7199 +# The jmx port to open +JMX_PORT=7199 + +# The API port to connect to +API_PORT=10000 + +# The API address to connect to +ADDR=127.0.0.1 diff --git a/dist/redhat/scylla-jmx.spec.in b/dist/redhat/scylla-jmx.spec.in index 71c1749..f86ab1e 100644 --- a/dist/redhat/scylla-jmx.spec.in +++ b/dist/redhat/scylla-jmx.spec.in @@ -33,7 +33,7 @@ install -m644 dist/redhat/systemd/scylla-jmx.service $RPM_BUILD_ROOT%{_unitdir}/ install -d -m755 $RPM_BUILD_ROOT%{_prefix}/lib/scylla install -d -m755 $RPM_BUILD_ROOT%{_prefix}/lib/scylla/jmx install -m644 target/urchin-mbean-1.0.jar $RPM_BUILD_ROOT%{_prefix}/lib/scylla/jmx/ -install -m755 dist/common/scripts/* $RPM_BUILD_ROOT%{_prefix}/lib/scylla/jmx +install -m755 scripts/scylla-jmx $RPM_BUILD_ROOT%{_prefix}/lib/scylla/jmx %pre /usr/sbin/groupadd scylla 2> /dev/null || : @@ -66,7 +66,7 @@ rm -rf $RPM_BUILD_ROOT %{_sysconfdir}/sysconfig/scylla-jmx %{_unitdir}/scylla-jmx.service -%{_prefix}/lib/scylla/jmx/jmx_run +%{_prefix}/lib/scylla/jmx/scylla-jmx %{_prefix}/lib/scylla/jmx/urchin-mbean-1.0.jar %changelog diff --git a/dist/redhat/systemd/scylla-jmx.service b/dist/redhat/systemd/scylla-jmx.service index fa6291f..3b7a496 100644 --- a/dist/redhat/systemd/scylla-jmx.service +++ b/dist/redhat/systemd/scylla-jmx.service @@ -8,7 +8,7 @@ Type=simple EnvironmentFile=/etc/sysconfig/scylla-jmx User=scylla Group=scylla -ExecStart=/usr/lib/scylla/jmx/jmx_run +ExecStart=/usr/lib/scylla/jmx/scylla-jmx -jp $JMX_PORT -p $API_PORT -a $ADDR -l /usr/lib/scylla/jmx KillMode=process Restart=always diff --git a/dist/ubuntu/debian/rules b/dist/ubuntu/debian/rules index e040fab..43273fb 100755 --- a/dist/ubuntu/debian/rules +++ b/dist/ubuntu/debian/rules @@ -20,7 +20,7 @@ override_dh_auto_install: cp $(CURDIR)/NOTICE $(DOC) mkdir -p $(DEST) - cp $(CURDIR)/dist/common/scripts/* $(DEST) + cp $(CURDIR)/scripts/scylla-jmx $(DEST) cp $(CURDIR)/target/urchin-mbean-1.0.jar $(DEST) %: diff --git a/dist/ubuntu/debian/scylla-jmx.init b/dist/ubuntu/debian/scylla-jmx.init index 66c94c7..ebac99e 100644 --- a/dist/ubuntu/debian/scylla-jmx.init +++ b/dist/ubuntu/debian/scylla-jmx.init @@ -20,7 +20,6 @@ DESC="Scylla JMX server" NAME=scylla-jmx SCYLLA_JMX=scylla-jmx -DAEMON=/usr/lib/scylla/jmx/jmx_run PIDFILE=/var/run/scylla-jmx.pid SCRIPTNAME=/etc/init.d/$NAME @@ -30,7 +29,7 @@ SCRIPTNAME=/etc/init.d/$NAME # Read configuration variable file if it is present [ -r /etc/default/$NAME ] && . /etc/default/$NAME -export JMX_LOCAL_PORT +DAEMON=/usr/lib/scylla/jmx/scylla-jmx -jp $JMX_PORT -p $API_PORT -a $ADDR -l /usr/lib/scylla/jmx # Define LSB log_* functions. . /lib/lsb/init-functions diff --git a/dist/ubuntu/debian/scylla-jmx.upstart b/dist/ubuntu/debian/scylla-jmx.upstart index 929c468..39f6a96 100644 --- a/dist/ubuntu/debian/scylla-jmx.upstart +++ b/dist/ubuntu/debian/scylla-jmx.upstart @@ -13,6 +13,5 @@ console log script . /etc/default/scylla-jmx - export JMX_LOCAL_PORT - exec /usr/lib/scylla/jmx/jmx_run + exec /usr/lib/scylla/jmx/scylla-jmx -jp $JMX_PORT -p $API_PORT -a $ADDR -l /usr/lib/scylla/jmx end script diff --git a/scripts/scylla-jmx b/scripts/scylla-jmx index 5e489b7..f43481a 100755 --- a/scripts/scylla-jmx +++ b/scripts/scylla-jmx @@ -62,4 +62,4 @@ do esac done -java -Dapiaddress=$API_ADDR -Dapiport=$API_PORT -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=$JMX_PORT -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -jar $LOCATION/urchin-mbean-1.0.jar +exec java -Dapiaddress=$API_ADDR -Dapiport=$API_PORT -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=$JMX_PORT -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -jar $LOCATION/urchin-mbean-1.0.jar From bdc7f3fb570c597976e1fcb2c0a91885ac4e9bdc Mon Sep 17 00:00:00 2001 From: Takuya ASADA Date: Wed, 2 Dec 2015 01:26:13 +0900 Subject: [PATCH 2/3] dist: export SCYLLA_HOME, SCYLLA_CONF --- dist/common/sysconfig/scylla-jmx | 6 ++++++ dist/ubuntu/debian/scylla-jmx.init | 1 + dist/ubuntu/debian/scylla-jmx.upstart | 1 + 3 files changed, 8 insertions(+) diff --git a/dist/common/sysconfig/scylla-jmx b/dist/common/sysconfig/scylla-jmx index 07cf22b..321c873 100644 --- a/dist/common/sysconfig/scylla-jmx +++ b/dist/common/sysconfig/scylla-jmx @@ -6,3 +6,9 @@ API_PORT=10000 # The API address to connect to ADDR=127.0.0.1 + +# scylla home dir +SCYLLA_HOME=/var/lib/scylla + +# scylla config dir +SCYLLA_CONF=/etc/scylla diff --git a/dist/ubuntu/debian/scylla-jmx.init b/dist/ubuntu/debian/scylla-jmx.init index ebac99e..62e144d 100644 --- a/dist/ubuntu/debian/scylla-jmx.init +++ b/dist/ubuntu/debian/scylla-jmx.init @@ -29,6 +29,7 @@ SCRIPTNAME=/etc/init.d/$NAME # Read configuration variable file if it is present [ -r /etc/default/$NAME ] && . /etc/default/$NAME +export SCYLLA_HOME SCYLLA_CONF DAEMON=/usr/lib/scylla/jmx/scylla-jmx -jp $JMX_PORT -p $API_PORT -a $ADDR -l /usr/lib/scylla/jmx # Define LSB log_* functions. diff --git a/dist/ubuntu/debian/scylla-jmx.upstart b/dist/ubuntu/debian/scylla-jmx.upstart index 39f6a96..6546851 100644 --- a/dist/ubuntu/debian/scylla-jmx.upstart +++ b/dist/ubuntu/debian/scylla-jmx.upstart @@ -13,5 +13,6 @@ console log script . /etc/default/scylla-jmx + export SCYLLA_HOME SCYLLA_CONF exec /usr/lib/scylla/jmx/scylla-jmx -jp $JMX_PORT -p $API_PORT -a $ADDR -l /usr/lib/scylla/jmx end script From 18674d67b0e12d75374dab101b698f92996b105e Mon Sep 17 00:00:00 2001 From: Takuya ASADA Date: Wed, 2 Dec 2015 01:27:47 +0900 Subject: [PATCH 3/3] dist: do not overwirte sysconfig file on 'yum update' --- dist/redhat/scylla-jmx.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/redhat/scylla-jmx.spec.in b/dist/redhat/scylla-jmx.spec.in index f86ab1e..3717e63 100644 --- a/dist/redhat/scylla-jmx.spec.in +++ b/dist/redhat/scylla-jmx.spec.in @@ -64,7 +64,7 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) -%{_sysconfdir}/sysconfig/scylla-jmx +%config(noreplace) %{_sysconfdir}/sysconfig/scylla-jmx %{_unitdir}/scylla-jmx.service %{_prefix}/lib/scylla/jmx/scylla-jmx %{_prefix}/lib/scylla/jmx/urchin-mbean-1.0.jar