From acc4939bca1f8fa23f812c6c2c574a2696691bba Mon Sep 17 00:00:00 2001 From: clarsen Date: Thu, 17 Apr 2014 11:46:45 -0400 Subject: [PATCH] Revert src/logback.xml Add logback.xml from deb package to rpm directory Move opentsdb_restart.py to tools directory Create symlinks during RPM installation Signed-off-by: Chris Larsen --- Makefile.am | 26 +++++++++-------- build-aux/rpm/init.d/opentsdb | 2 +- build-aux/rpm/logback.xml | 45 ++++++++++++++++++++++++++++++ opentsdb.spec.in | 20 +++++++++---- src/logback.xml | 14 +--------- {src => tools}/opentsdb_restart.py | 0 6 files changed, 76 insertions(+), 31 deletions(-) create mode 100644 build-aux/rpm/logback.xml rename {src => tools}/opentsdb_restart.py (100%) mode change 100755 => 100644 diff --git a/Makefile.am b/Makefile.am index 36c3e7d9a1..f1f52dde83 100644 --- a/Makefile.am +++ b/Makefile.am @@ -25,9 +25,10 @@ plugin_test_jar := plugin_test.jar builddata_SRC := src/BuildData.java BUILT_SOURCES = $(builddata_SRC) nodist_bin_SCRIPTS = tsdb -dist_noinst_SCRIPTS = src/create_table.sh src/mygnuplot.sh src/mygnuplot.bat \ - src/opentsdb.conf src/opentsdb_restart.py -dist_noinst_DATA = pom.xml.in build-aux/rpm/opentsdb.conf build-aux/rpm/init.d/opentsdb +dist_noinst_SCRIPTS = src/create_table.sh src/upgrade_1to2.sh src/mygnuplot.sh \ + src/mygnuplot.bat src/opentsdb.conf tools/opentsdb_restart.py src/logback.xml +dist_noinst_DATA = pom.xml.in build-aux/rpm/opentsdb.conf \ + build-aux/rpm/logback.xml build-aux/rpm/init.d/opentsdb tsdb_SRC := \ src/core/Aggregator.java \ src/core/Aggregators.java \ @@ -216,7 +217,7 @@ httpui_SRC := \ httpui_DEPS = src/tsd/QueryUi.gwt.xml -dist_pkgdata_DATA = src/logback.xml +#dist_pkgdata_DATA = src/logback.xml dist_static_DATA = src/tsd/static/favicon.ico EXTRA_DIST = tsdb.in $(tsdb_SRC) $(test_SRC) \ @@ -226,6 +227,7 @@ EXTRA_DIST = tsdb.in $(tsdb_SRC) $(test_SRC) \ tools/check_tsd \ tools/clean_cache.sh \ tools/tsddrain.py \ + tools/opentsdb_restart.py \ opentsdb.spec \ bootstrap build.sh build-aux/gen_build_data.sh $(builddata_SRC) @@ -265,8 +267,8 @@ printdeps: # This is kind of a hack, but I couldn't find a better way to adjust the paths # in the script before it gets installed... install-exec-hook: - script=tsdb; pkgdatadir='$(pkgdatadir)'; abs_srcdir=''; abs_builddir=''; \ - $(edit_tsdb_script) + script=tsdb; pkgdatadir='$(pkgdatadir)'; configdir='$(pkgdatadir)/etc/opentsdb'; \ + abs_srcdir=''; abs_builddir=''; $(edit_tsdb_script) cat tsdb.tmp >"$(DESTDIR)$(bindir)/tsdb" rm -f tsdb.tmp @@ -399,8 +401,11 @@ install-data-tools: $(tsdb_DEPS) $(jar) destdatatoolsdir="$(DESTDIR)$(pkgdatadir)/tools" ; \ echo " $(mkdir_p) $$destdatatoolsdir"; \ $(mkdir_p) "$$destdatatoolsdir" || exit 1; \ - echo " $(INSTALL_SCRIPT)" $(top_srcdir)/tools/* "$$destdatatoolsdir" ; \ - $(INSTALL_SCRIPT) $(top_srcdir)/tools/* "$$destdatatoolsdir" || exit 1; + tools="$$tools $(top_srcdir)/tools/*" ; \ + tools="$$tools $(top_srcdir)/src/create_table.sh" ; \ + tools="$$tools $(top_srcdir)/src/upgrade_1to2.sh" ; \ + echo " $(INSTALL_SCRIPT)" $$tools "$$destdatatoolsdir" ; \ + $(INSTALL_SCRIPT) $$tools "$$destdatatoolsdir" || exit 1; uninstall-data-tools: @$(NORMAL_UNINSTALL) @@ -413,10 +418,8 @@ install-data-bin: tsdb destdatabindir="$(DESTDIR)$(pkgdatadir)/bin" ; \ echo " $(mkdir_p) $$destdatabindir"; \ $(mkdir_p) "$$destdatabindir" || exit 1; \ - bins="$(top_srcdir)/src/create_table.sh" ; \ bins="$$bins $(top_srcdir)/src/mygnuplot.sh" ; \ bins="$$bins $(top_srcdir)/src/mygnuplot.bat" ; \ - bins="$$bins $(top_srcdir)/src/opentsdb_restart.py" ; \ bins="$$bins $(DESTDIR)$(bindir)/tsdb" ; \ echo " $(INSTALL_SCRIPT)" $$bins "$$destdatabindir" ; \ $(INSTALL_SCRIPT) $$bins "$$destdatabindir" || exit 1; @@ -440,7 +443,8 @@ install-data-etc: $(mkdir_p) "$$destdataconfdir" || exit 1; \ echo " $(mkdir_p) $$destdatainitdir"; \ $(mkdir_p) "$$destdatainitdir" || exit 1; \ - conf_files="$(top_srcdir)/build-aux/rpm/opentsdb.conf" ; \ + conf_files="$$conf_files $(top_srcdir)/build-aux/rpm/opentsdb.conf" ; \ + conf_files="$$conf_files $(top_srcdir)/build-aux/rpm/logback.xml" ; \ echo " $(INSTALL_SCRIPT)" $$conf_files "$$destdataconfdir" ; \ $(INSTALL_DATA) $$conf_files "$$destdataconfdir" || exit 1; \ init_file="$(top_srcdir)/build-aux/rpm/init.d/opentsdb" ; \ diff --git a/build-aux/rpm/init.d/opentsdb b/build-aux/rpm/init.d/opentsdb index 9e8d53d222..2d63eea23d 100644 --- a/build-aux/rpm/init.d/opentsdb +++ b/build-aux/rpm/init.d/opentsdb @@ -78,7 +78,7 @@ start() { # Set a default value for JVMARGS : ${JVMXMX:=-Xmx6000m} - : ${JVMARGS:=-DLOG_FILE_PREFIX=${LOG_FILE} -enableassertions -enablesystemassertions $JVMXMX -XX:OnOutOfMemoryError=/usr/share/opentsdb/bin/opentsdb_restart.py} + : ${JVMARGS:=-DLOG_FILE_PREFIX=${LOG_FILE} -enableassertions -enablesystemassertions $JVMXMX -XX:OnOutOfMemoryError=/usr/share/opentsdb/tools/opentsdb_restart.py} export JVMARGS if [ "`id -u -n`" == root ] ; then diff --git a/build-aux/rpm/logback.xml b/build-aux/rpm/logback.xml new file mode 100644 index 0000000000..7f0fb57694 --- /dev/null +++ b/build-aux/rpm/logback.xml @@ -0,0 +1,45 @@ + + + + + + + %d{ISO8601} %-5level [%thread] %logger{0}: %msg%n + + + + + + 1024 + + + + /var/log/opentsdb/opentsdb.log + true + + + /var/log/opentsdb/opentsdb.log.%i + 1 + 3 + + + + 128MB + + + + + %d{HH:mm:ss.SSS} %-5level [%logger{0}.%M] - %msg%n + + + + + + + + + + + + diff --git a/opentsdb.spec.in b/opentsdb.spec.in index 853d5a8e04..5435bcd56d 100644 --- a/opentsdb.spec.in +++ b/opentsdb.spec.in @@ -57,10 +57,6 @@ rm -rf %{buildroot} make install DESTDIR=%{buildroot} mkdir -p %{buildroot}/var/cache/opentsdb # TODO: Use alternatives to manage the init script and configuration. -# NOTE: Users should create symlinks to etc/init.d/opentsdb and -# etc/opentsdb/opentsdb.conf if they want to use the stock script and -# configuration. - %clean rm -rf %{buildroot} @@ -70,14 +66,26 @@ rm -rf %{buildroot} %defattr(644,root,root,755) %attr(0755,root,root) %{_bindir}/* %attr(0755,root,root) %{_datarootdir}/opentsdb/bin/*.sh -%attr(0755,root,root) %{_datarootdir}/opentsdb/bin/*.py %attr(0755,root,root) %{_datarootdir}/opentsdb/tools/* %attr(0755,root,root) %{_datarootdir}/opentsdb/etc/init.d/opentsdb +%config %{_datarootdir}/opentsdb/etc/opentsdb/opentsdb.conf +%config %{_datarootdir}/opentsdb/etc/opentsdb/logback.xml %doc %{_datarootdir}/opentsdb %{_bindir}/tsdb %dir %{_localstatedir}/cache/opentsdb - %changelog +%post + +ln -s %{_datarootdir}/opentsdb/etc/opentsdb /etc/opentsdb +ln -s %{_datarootdir}/opentsdb/etc/init.d/opentsdb /etc/init.d/opentsdb +exit 0 + +%postun + +rm -rf /etc/opentsdb +rm -rf /etc/init.d/opentsdb + +exit 0 \ No newline at end of file diff --git a/src/logback.xml b/src/logback.xml index 64a285be00..b06776504a 100644 --- a/src/logback.xml +++ b/src/logback.xml @@ -11,24 +11,12 @@ 1024 - - - ${LOG_FILE_PREFIX}opentsdb.log - - ${LOG_FILE_PREFIX}opentsdb.%d{yyyy-MM-dd-HH}.log - - - - %d{ISO8601} %-5level [%thread] %logger{0}: %msg%n - - - + - diff --git a/src/opentsdb_restart.py b/tools/opentsdb_restart.py old mode 100755 new mode 100644 similarity index 100% rename from src/opentsdb_restart.py rename to tools/opentsdb_restart.py