Permalink
Browse files

build rpms w/new supervisor

  • Loading branch information...
1 parent cf7a3f0 commit 72ed0342fee96309400bdb0cd487db19e1bb1917 @ezuce-admin ezuce-admin committed Jan 24, 2012
Showing with 212 additions and 212 deletions.
  1. 0 {meta → mak}/comps.xml
  2. +5 −4 mak/rpm.mk.in
  3. +0 −1 sipXacd/sipxacd.spec.in
  4. +9 −4 sipXacdStatistics/bin/Makefile.am
  5. +1 −4 sipXacdStatistics/bin/sipxacd-report-setup.in
  6. +4 −12 sipXacdStatistics/bin/sipxacd-report.in
  7. +21 −0 sipXacdStatistics/bin/sipxacd-stats-daemon.in
  8. +1 −67 sipXacdStatistics/bin/sipxacd-stats.in
  9. +4 −28 sipXacdStatistics/etc/Makefile.am
  10. +92 −0 sipXacdStatistics/etc/sipxacdstatistics.cf
  11. +0 −26 sipXacdStatistics/etc/sipxconfig-agent-process.xml.in
  12. +0 −5 sipXacdStatistics/etc/sipxconfig-report-config.in
  13. +0 −5 sipXacdStatistics/etc/sipxconfig-report-crontab.in
  14. +5 −5 sipXacdStatistics/sipxacdstatistics.spec.in
  15. +1 −0 sipXcommserverLib/sipxcommserverlib.spec.in
  16. +1 −1 sipXconfig/bin/sipxconfig.in
  17. +2 −0 sipXconfig/etc/sipxconfig.cf
  18. +1 −0 sipXconfig/etc/sipxpbx/sipxacdstats/sipxacdstats.xml
  19. +20 −9 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/acd/stats/AcdStatsConfig.java
  20. +1 −1 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/acd/stats/AcdStatsImpl.java
  21. +0 −3 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/acd/stats/historical/AcdHistoricalStats.java
  22. +14 −6 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/acd/stats/historical/AcdHistoryConfig.java
  23. +5 −0 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/acd/stats/historical/acdstatshistorical.beans.xml
  24. +1 −3 sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/acd/stats/historical/AcdReportConfigTest.java
  25. +0 −1 sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/acd/stats/historical/report-config-expected.xml
  26. +0 −1 sipXconfig/sipxconfig.spec.in
  27. +1 −1 sipXconfig/web/context/WEB-INF/admin/commserver/LocationsPage.properties
  28. +0 −3 sipXpbx/sipxpbx.spec.in
  29. +6 −3 sipXpostgres/etc/postgres.cf
  30. +0 −1 sipXpublisher/sipxpublisher.spec.in
  31. +0 −1 sipXregistry/sipxregistry.spec.in
  32. +5 −2 sipXsupervisor/bin/sipxecs-setup.in
  33. +12 −15 sipXsupervisor/etc/sipx.cf.in
File renamed without changes.
View
@@ -12,6 +12,7 @@ RPM_DIST = @RPM_DIST@
# trick lets you create centos compatible repos from any other distro
CREATEREPO_OPTS_centos = @BACKWARD_COMPATIBLE_CREATEREPO_OPTS_FOR_CENTOS@
+CREATEREPO_OPTS = -g $(SRC)/mak/comps.xml $(CREATEREPO_OPTS_$(DISTRO_OS))
MOCK_RESULTS_DIR = @RPM_DIST_DIR@/$(DISTRO_RESULTS_DIR)/$(DISTRO_ARCH)
MOCK_SRPM_DIR = @RPM_DIST_DIR@/$(DISTRO_RESULTS_DIR)/source
MOCK_OPTS = \
@@ -82,13 +83,13 @@ help.{1|2}.rpm-by-mock = Called automatically as part of rpm process after srpm
$(MOCK_SRPM_DIR)/$($(PROJ)_SRPM)
find $(MOCK_RESULTS_DIR) -name '*.src.rpm' -exec rm {} \;
# generate repo AFTER build because then it's usable as a repo to feed to next build or other systems.
- cd $(MOCK_RESULTS_DIR); createrepo $(CREATEREPO_OPTS_$(DISTRO_OS)) .
+ cd $(MOCK_RESULTS_DIR); createrepo $(CREATEREPO_OPTS) .
help.repo-chroot-init = Clear mock chroot for $(DISTRO). Requied before first build and useful when you suspect caching is the result of a build error.
repo-chroot-init : repo-create repo-webserver
mock $(MOCK_OPTS) --scrub=all
test -d $(MOCK_RESULTS_DIR) || mkdir -p $(MOCK_RESULTS_DIR)
- cd $(MOCK_RESULTS_DIR); createrepo $(CREATEREPO_OPTS_$(DISTRO_OS)) .
+ cd $(MOCK_RESULTS_DIR); createrepo $(CREATEREPO_OPTS) .
mock $(MOCK_OPTS) --init
help.{1|2}.check-rpm = Install the project rpm in the mock environment to test install. This does not install all rpms generated by a project, just the main one. You can install then pretty easily though with command 'mock -r $(MOCK_TARGET_PLATFORM) --install package-name'
@@ -114,7 +115,7 @@ repo-webserver :
help.repo-src = Assemble source rpms into @RPM_DIST_DIR@/$(DISTRO_RESULTS_DIR)/source
repo-src :
for f in $(shell $(SRC)/mak/list-obsolete-rpms $(MOCK_SRPM_DIR)); do rm $$f; done
- cd $(MOCK_SRPM_DIR); createrepo $(CREATEREPO_OPTS_$(DISTRO_OS)) .
+ cd $(MOCK_SRPM_DIR); createrepo $(CREATEREPO_OPTS) .
help.repo-check = Installs sipXecs in chroot. Tip, run repo-chroot-init first for more thourugh test of all dependencies.
repo-check : repo-webserver
@@ -127,7 +128,7 @@ repo-remove-dups:
help.repo-create = run createrepo in $(MOCK_RESULTS_DIR)
repo-create:
test -d $(MOCK_RESULTS_DIR) || mkdir -p $(MOCK_RESULTS_DIR)
- cd $(MOCK_RESULTS_DIR); createrepo $(CREATEREPO_OPTS_$(DISTRO_OS)) .
+ cd $(MOCK_RESULTS_DIR); createrepo $(CREATEREPO_OPTS) .
help.repo-update = If you rebuild local rpms, repo will not automatically replace previously installed versions. This call will force up update to all packages at once.
repo-update :
View
@@ -27,7 +27,6 @@ Obsoletes: %name-devel
Requires: sipxcommserverlib >= %version
Requires: sipxcalllib >= %version
-Requires: sipxpbx >= %version
Requires: boost
Prefix: %_prefix
@@ -2,17 +2,22 @@ include $(top_srcdir)/config/utility.am
EXTRA_DIST = \
$(bin_SCRIPTS:=.in) \
- $(setupbin_SCRIPTS:=.in)
+ $(setupbin_SCRIPTS:=.in) \
+ $(initd_SCRIPTS:=.in)
-setupbindir = @SIPX_LIBEXECDIR@/setup.d
+setupbindir = @SIPX_LIBEXECDIR@
setupbin_SCRIPTS = \
sipxacd-report-setup
+initddir = @SIPX_SERVICEDIR@
+initd_SCRIPTS = \
+ sipxacd-stats-daemon
+
bin_SCRIPTS = \
sipxacd-stats \
sipxacd-report
-$(setupbin_SCRIPTS) $(bin_SCRIPTS) : % : %.in Makefile
+$(initd_SCRIPTS) $(setupbin_SCRIPTS) $(bin_SCRIPTS) : % : %.in Makefile
@$(call SearchAndReplace, $<, $@)
-CLEANFILES = $(setupbin_SCRIPTS) $(bin_SCRIPTS)
+CLEANFILES = $(setupbin_SCRIPTS) $(bin_SCRIPTS) $(initd_SCRIPTS)
@@ -6,13 +6,10 @@
: ${ConfDir:=@SIPX_CONFDIR@}
: ${DbVersion:=2}
: ${DbPatchDir:=${ConfDir}/report}
-: ${DbPatchLog:=${LogDir}/sipacdreportpatch.log}
+: ${DbPatchLog:=@SIPX_LOGDIR@/sipacdreportpatch.log}
Database=SIPXACD_HISTORY
-#Creates database if not found
-@bindir@/sipxacd-report --setup
-
# How to add a database patch:
#
# Add a file containing SQL statements in the sipXproxy/etc/database directory.
@@ -45,12 +45,6 @@ def parse(args)
exit
end
- opts.on_tail("--setup", "Configure postgres to allow connection and create database") do
- setuppg
- createdb
- exit
- end
-
opts.on_tail("--disable", "Disable production of the sipxconfig-report") do
disablereport
exit
@@ -83,12 +77,6 @@ def parse(args)
`#perl -pi -e 's/^(CONFIG_SERVER_REPORT\s*=\s*")ENABLED"/\1DISABLED"/' @SIPX_CONFDIR@/sipxconfig-report-config`
end
- def setuppg
- if ! system('@bindir@/pgpatch.sh')
- raise "could not patch postgres setup"
- end
- end
-
end
opts.parse!(args)
options
@@ -130,6 +118,10 @@ pid.close
configUrls = Array.new(CONFIG_SERVER_AGENT_URL.split(";"))
locationFqdns = Array.new(LOCATION_FQDN.split(";"))
+# check db schema is updated
+createdb
+system("@SIPX_LIBEXECDIR@/sipxacd-report-setup")
+
configUrls.length.times do |i|
importer = Reports::Importer.new
begin
@@ -0,0 +1,21 @@
+#!/usr/bin/ruby
+ENV['GEM_PATH'] = '/opt/sipx-main/lib/ruby/gems/1.8:/usr/lib/ruby/gems/1.8:/var/lib/gems/1.8'
+
+require 'rubygems'
+require 'daemons'
+require 'etc'
+
+uid = Etc.getpwnam('@SIPXPBXUSER@').uid
+gid = Etc.getgrnam('@SIPXPBXGROUP@').gid
+
+unless Process.euid == uid && Process.egid == gid
+ Process.initgroups('@SIPXPBXUSER@', gid)
+ Process::GID.change_privilege(gid)
+ Process::UID.change_privilege(uid)
+end
+
+Daemons.run('@SIPX_BINDIR@/sipxacd-stats',
+ :app_name => 'sipxacd-stats',
+ :dir_mode => :normal,
+ :dir => '@SIPX_RUNDIR@',
+ :log_output => true)
@@ -5,74 +5,8 @@
# NOTE: Keep this at top of file, see XCF-1096. Debian Etch looks in /var/lib/gems/1.8
ENV['GEM_PATH'] = '@GEM_LOCAL_LIB_DIR@:/usr/lib/ruby/gems/1.8:/var/lib/gems/1.8'
-require 'tempfile'
-require 'optparse'
-require 'ostruct'
-
-def load_config_properties
- load ('@SIPX_CONFDIR@/config-agent.properties')
-end
-
-def parse(args)
- options = OpenStruct.new
-
- opts = OptionParser.new do |opts|
- opts.banner = "Usage: sipxconfig-agent [--conftest | --stop]"
-
- opts.separator ""
- opts.separator "Specific options:"
-
- opts.on_tail("-c", "--configtest", "Run tests on configuration") do
- if ! defined? CONFIG_SERVER_AGENT_PORT
- raise "Missing items 'CONFIG_SERVER_AGENT_PORT' in config-agent.properties"
- end
- exit
- end
-
- opts.on_tail("-s", "--stop", "Stop the ConfigAgent") do
- print "Stopping @SIPX_RUNDIR@/sipxconfig-agent.pid "
- if File.exist?('@SIPX_RUNDIR@/sipxconfig-agent.pid')
- pid=File.read('@SIPX_RUNDIR@/sipxconfig-agent.pid').to_i
- if pid
- begin
- Process.kill("TERM", pid)
- 20.times do
- print "."
- $stdout.flush
- sleep 1
- Process.kill(0, pid)
- end
- # ESRCH means "No such process": success
- rescue Errno::ESRCH
- puts " Success"
- File.delete('@SIPX_RUNDIR@/sipxconfig-agent.pid')
- # other errors could indicate permissions, etc
- rescue
- puts " Failed, error #{$!}"
- # reached end of loop
- else
- puts " Failed to stop"
- end
- end
- else
- puts "Success (Not started)"
- end
- exit
- end
-
- end
- opts.parse!(args)
- options
-end
-
-load_config_properties
-parse(ARGV)
-
require 'rubygems'
require 'main'
-pid=File.open('@SIPX_RUNDIR@/sipxconfig-agent.pid', 'w')
-pid.puts Process.pid
-pid.close
-
+load('@SIPX_CONFDIR@/config-agent.properties')
main('@SIPX_LOGDIR@/sipxacd_events.log', CONFIG_SERVER_AGENT_PORT)
@@ -1,36 +1,12 @@
include $(top_srcdir)/config/utility.am
-EXTRA_DIST = \
- $(proc_DATA:=.in) \
- $(cfg_DATA:=.in) \
- $(rpt_DATA) \
- $(cron_FILES:=.in)
-
-cron_FILES = sipxconfig-report-crontab
-if IS_RPMBUILD
-# Target is not normally run, also, you may have to add sipx user to
-# /etc/cron.d/cron.allow file
-crondir = $(CRON_D)
-cron_SCRIPTS = $(cron_FILES)
-else
-noinst_SCRIPTS = $(cron_FILES)
-endif
-
-procdir = $(SIPX_DATADIR)/process.d
-proc_DATA = \
- sipxconfig-agent-process.xml
-
-cfgdir = $(SIPX_CONFDIR)
-cfg_DATA = \
- sipxconfig-report-config
-
rptdir = $(SIPX_CONFDIR)/report
-rpt_DATA = \
+dist_rpt_DATA = \
schema.sql \
enable_upgrades.sql \
location_fqdn.sql
-$(cron_FILES) $(cfg_DATA) $(proc_DATA) : % : %.in Makefile
- @$(call SearchAndReplace, $<, $@)
+cfinputsdir = $(SIPX_CFINPUTS)/plugin.d
+dist_cfinputs_DATA = \
+ sipxacdstatistics.cf
-CLEANFILES = $(cron_FILES) $(cfg_DATA) $(proc_DATA)
@@ -0,0 +1,92 @@
+# Copyright (C) 2012 eZuce Inc., certain elements licensed under a Contributor Agreement.
+# Contributors retain copyright to elements licensed under a Contributor Agreement.
+# Licensed to the User under the AGPL license.
+
+#
+# sipxacdstatistics configuration and process management
+#
+bundle agent sipxacdstatistics {
+ methods:
+ sipxacdstatistics::
+ "any" usebundle => "sipxacdstatistics_config";
+ "any" usebundle => "sipxacdstatistics_setup";
+ any::
+ "any" usebundle => "sipxacdstatistics_running";
+}
+
+bundle agent sipxacdstatistics_config {
+ vars:
+ any::
+ "agent[CONFIG_SERVER_AGENT_PORT]" string => "$(sipx.CONFIG_SERVER_AGENT_PORT)";
+
+ files:
+ any::
+ "$(sipx.SIPX_CONFDIR)/sipxconfig-report-config"
+ create => "true",
+ perms => m("644"),
+ edit_line => sipxacdstatistics_report_config,
+ action => track("$(this.promiser)");
+
+ "$(sipx.SIPX_CONFDIR)/config-agent.properties"
+ create => "true",
+ perms => m("644"),
+ edit_line => set_variable_values("sipxacdstatistics_config.agent"),
+ classes => if_repaired("restart_sipxacdstatistics"),
+ action => track("$(this.promiser)");
+}
+
+bundle edit_line sipxacdstatistics_report_config {
+ insert_lines:
+ "$(sipx.SIPX_CFDATA)/$(sipx.location_id)/sipxconfig-report-config.part"
+ insert_type => "file";
+ "LOCATION_FQDN=\"$(sys.fqhost);\"";
+
+ delete_lines:
+ ".*";
+}
+
+bundle agent sipxacdstatistics_setup {
+ vars:
+ # script uses few resources so even every minute would be reasonable
+ # time should be less than one-half the time window sipxconfig-agent keeps
+ # around with is currently 90 minutes (although for the first 1000 events, it doesn't
+ # matter and sipxconfig-agent will keep at least that many)
+ "cron" string => "*/30 * * * * $(sipx.SIPXPBXUSER) $(sipx.SIPX_BINDIR)/sipxconfig-report > /dev/null";
+ "cron_id" string => ".*/sipxconfig-report .*"; #regex
+
+ methods:
+ !src.sipxacdstatistics::
+ "any" usebundle => rh_chkconfig_status("sipxacdstatistics on");
+ "any" usebundle => add_crontab("$(cron_id)","$(cron)");
+
+ !src.!sipxacdstatistics::
+ "any" usebundle => rh_chkconfig_status("sipxacdstatistics off");
+ "any" usebundle => remove_crontab("$(cron_id)");
+}
+
+bundle agent sipxacdstatistics_running {
+ vars:
+ any::
+ "service_command" string => "$(sipx.SIPX_BINDIR)/sipxacd-stats";
+
+ methods:
+ any::
+ "any" usebundle => find_sipxservice_by_command("$(service_command)","sipxacdstatistics_running");
+
+ commands:
+ sipxacdstatistics_running.!sipxacdstatistics::
+ "$(sipx.SIPX_SERVICEDIR)/sipxacdstatistics"
+ args => "stop",
+ action => track("sipxacdstatistics_stop");
+
+ !sipxacdstatistics_running.sipxacdstatistics::
+ "$(sipx.SIPX_SERVICEDIR)/sipxacdstatistics"
+ args => "start",
+ action => track("sipxacdstatistics_start");
+
+ restart_sipxacdstatistics::
+ "$(sipx.SIPX_SERVICEDIR)/sipxacdstatistics"
+ args => "restart",
+ action => track("sipxacdstatistics_restart");
+}
+
@@ -1,26 +0,0 @@
-<?xml version='1.0' encoding='iso-8859-1' standalone='yes'?>
-<sipXecs-process xmlns='http://www.sipfoundry.org/sipX/schema/xml/sipXecs-process-01-00'>
- <name>ConfigAgent</name>
- <version>@VERSION@</version>
- <commands>
- <configtest>
- <execute>@SIPX_BINDIR@/sipxconfig-agent</execute>
- <parameter>--configtest</parameter>
- </configtest>
- <start>
- <execute>@SIPX_BINDIR@/sipxconfig-agent</execute>
- </start>
- <stop>
- <execute>@SIPX_BINDIR@/sipxconfig-agent</execute>
- <parameter>--stop</parameter>
- </stop>
- </commands>
- <status>
- <pid>@SIPX_RUNDIR@/sipxconfig-agent.pid</pid>
- <log>@SIPX_LOGDIR@/sipxconfig-agent.log</log>
- </status>
- <resources>
- <osconfig>@SIPX_CONFDIR@/domain-config</osconfig>
- <file>@SIPX_CONFDIR@/config-agent.properties</file>
- </resources>
-</sipXecs-process>
@@ -1,5 +0,0 @@
-CONFIG_SERVER_REPORT = 'ENABLED'
-CONFIG_SERVER_AGENT_URL = 'http://localhost:8120'
-DB_NAME = 'SIPXACD_HISTORY'
-DB_URI = "dbi:Pg:#{DB_NAME}:localhost"
-DB_USER = '@POSTGRESQL_USER@'
@@ -1,5 +0,0 @@
-# script uses few resources so even every minute would be reasonable
-# time should be less than one-half the time window sipxconfig-agent keeps
-# around with is currently 90 minutes (although for the first 1000 events, it doesn't
-# matter and sipxconfig-agent will keep at least that many)
-*/30 * * * * @SIPXPBXUSER@ @SIPX_BINDIR@/sipxconfig-report > /dev/null
Oops, something went wrong.

0 comments on commit 72ed034

Please sign in to comment.