You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by el...@apache.org on 2017/01/11 21:34:25 UTC
[1/8] incubator-trafficcontrol git commit: initial commit of RPM
packaging
Repository: incubator-trafficcontrol
Updated Branches:
refs/heads/master 2169b45f9 -> 554db0f59
initial commit of RPM packaging
(cherry picked from commit abba425fafd346287bb937b31c8504c402e1f5f7)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/d40cf4b4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/d40cf4b4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/d40cf4b4
Branch: refs/heads/master
Commit: d40cf4b4e5e9f301d86ae8a9016169ec73050120
Parents: 2169b45
Author: David Neuman <da...@gmail.com>
Authored: Thu Jan 5 16:27:30 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Wed Jan 11 15:59:50 2017 +0000
----------------------------------------------------------------------
traffic_monitor/experimental/build/build_rpm.sh | 58 ++++++++
traffic_monitor/experimental/build/tm2.spec | 139 +++++++++++++++++++
.../experimental/build/traffic_monitor.init | 119 ++++++++++++++++
.../build/traffic_monitor.logrotate | 9 ++
.../experimental/conf/traffic_monitor.cfg | 19 +++
.../traffic_monitor-example-config.json | 19 ---
6 files changed, 344 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d40cf4b4/traffic_monitor/experimental/build/build_rpm.sh
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/build/build_rpm.sh b/traffic_monitor/experimental/build/build_rpm.sh
new file mode 100644
index 0000000..9ec72a3
--- /dev/null
+++ b/traffic_monitor/experimental/build/build_rpm.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+function importFunctions() {
+ local script=$(readlink -f "$0")
+ local scriptdir=$(dirname "$script")
+ export TM_DIR=$(dirname "$scriptdir")
+ export TC_DIR=$(dirname "$TM_DIR")
+ functions_sh="$TC_DIR/build/functions.sh"
+ if [[ ! -r $functions_sh ]]; then
+ echo "error: can't find $functions_sh"
+ exit 1
+ fi
+ . "$functions_sh"
+}
+
+#----------------------------------------
+function initBuildArea() {
+ echo "Initializing the build area."
+ mkdir -p "$RPMBUILD"/{SPECS,SOURCES,RPMS,SRPMS,BUILD,BUILDROOT} || { echo "Could not create $RPMBUILD: $?"; exit 1; }
+
+ # tar/gzip the source
+ local tm_dest=$(createSourceDir traffic_monitor)
+ cd "$TM_DIR" || \
+ { echo "Could not cd to $TM_DIR: $?"; exit 1; }
+ rsync -av ./ "$tm_dest"/ || \
+ { echo "Could not copy to $tm_dest: $?"; exit 1; }
+ cp "$TM_DIR"/build/*.spec "$RPMBUILD"/SPECS/. || \
+ { echo "Could not copy spec files: $?"; exit 1; }
+
+ cp -r "$TM_DIR"/ "$tm_dest" || { echo "Could not copy $TM_DIR to $tm_dest: $?"; exit 1; }
+
+ tar -czvf "$tm_dest".tgz -C "$RPMBUILD"/SOURCES $(basename $tm_dest) || { echo "Could not create tar archive $tm_dest.tgz: $?"; exit 1; }
+ cp "$TM_DIR"/build/*.spec "$RPMBUILD"/SPECS/. || { echo "Could not copy spec files: $?"; exit 1; }
+
+ echo "The build area has been initialized."
+}
+
+# ---------------------------------------
+
+importFunctions
+checkEnvironment go
+initBuildArea
+buildRpm traffic_monitor
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d40cf4b4/traffic_monitor/experimental/build/tm2.spec
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/build/tm2.spec b/traffic_monitor/experimental/build/tm2.spec
new file mode 100644
index 0000000..076b9c0
--- /dev/null
+++ b/traffic_monitor/experimental/build/tm2.spec
@@ -0,0 +1,139 @@
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+# RPM spec file for the Go version of Traffic Monitor (tm).
+#
+%define debug_package %{nil}
+Name: traffic_monitor
+Version: %{traffic_control_version}
+Release: %{build_number}
+Summary: Monitor the caches
+Packager: david_neuman2 at Cable dot Comcast dot com
+Vendor: Apache Software Foundation
+Group: Applications/Communications
+License: Apache License, Version 2.0
+URL: https://github.com/apache/incubator-trafficcontrol
+Source: %{_sourcedir}/traffic_monitor-%{traffic_control_version}.tgz
+
+%description
+Installs traffic_monitor
+
+%prep
+
+%setup
+
+%build
+export GOPATH=$(pwd)
+# Create build area with proper gopath structure
+mkdir -p src pkg bin || { echo "Could not create directories in $(pwd): $!"; exit 1; }
+
+go_get_version() {
+ local src=$1
+ local version=$2
+ (
+ cd $src && \
+ git checkout $version && \
+ go get -v \
+ )
+}
+
+# get traffic_ops client
+godir=src/github.com/apache/incubator-trafficcontrol/traffic_ops/client
+( mkdir -p "$godir" && \
+ cd "$godir" && \
+ cp -r "$TC_DIR"/traffic_ops/client/* . && \
+ go get -v \
+) || { echo "Could not build go program at $(pwd): $!"; exit 1; }
+
+#build traffic_monitor binary
+godir=src/github.com/apache/incubator-trafficcontrol/traffic_monitor/experimental/traffic_monitor
+oldpwd=$(pwd)
+( mkdir -p "$godir" && \
+ cd "$godir" && \
+ cp -r "$TC_DIR"/traffic_monitor/expiremental/* . && \
+ go get -d -v && \
+ go build -ldflags "-X main.GitRevision=`git rev-parse HEAD` -X main.BuildTimestamp=`date +'%Y-%M-%dT%H:%M:%S'`" \
+) || { echo "Could not build go program at $(pwd): $!"; exit 1; }
+
+%install
+mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor
+mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/bin
+mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/conf
+mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/backup
+mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/var/run
+mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/var/log
+mkdir -p "${RPM_BUILD_ROOT}"/etc/init.d
+mkdir -p "${RPM_BUILD_ROOT}"/etc/logrotate.d
+
+src=src/github.com/apache/incubator-trafficcontrol/traffic_monitor/expiremental
+cp -p traffic_monitor/traffic_monitor "${RPM_BUILD_ROOT}"/opt/traffic_monitor/bin/traffic_monitor
+cp "$src"/conf/traffic_ops.cfg "${RPM_BUILD_ROOT}"/opt/traffic_monitor/conf/traffic_ops.cfg
+cp "$src"/build/traffic_monitor.init "${RPM_BUILD_ROOT}"/etc/init.d/traffic_monitor
+cp "$src"/build/traffic_monitor.logrotate "${RPM_BUILD_ROOT}"/etc/logrotate.d/traffic_monitor
+
+%pre
+/usr/bin/getent group traffic_monitor >/dev/null
+
+if [ $? -ne 0 ]; then
+
+ /usr/sbin/groupadd -g 422 traffic_monitor
+fi
+
+/usr/bin/getent passwd traffic_monitor >/dev/null
+
+if [ $? -ne 0 ]; then
+
+ /usr/sbin/useradd -g traffic_monitor -u 422 -d /opt/traffic_monitor -M traffic_monitor
+
+fi
+
+/usr/bin/passwd -l traffic_monitor >/dev/null
+/usr/bin/chage -E -1 -I -1 -m 0 -M 99999 -W 7 traffic_monitor
+
+if [ -e /etc/init.d/traffic_monitor ]; then
+ /sbin/service traffic_monitor stop
+fi
+
+%post
+
+/sbin/chkconfig --add traffic_monitor
+/sbin/chkconfig traffic_monitor on
+
+%files
+%defattr(644, traffic_monitor, traffic_monitor, 755)
+%config(noreplace) /opt/traffic_monitor/conf/traffic_monitor.cfg
+%config(noreplace) /opt/traffic_monitor/conf/traffic_ops.cfg
+%config(noreplace) /etc/logrotate.d/traffic_monitor
+
+%dir /opt/traffic_monitor
+%dir /opt/traffic_monitor/bin
+%dir /opt/traffic_monitor/conf
+%dir /opt/traffic_monitor/backup
+%dir /opt/traffic_monitor/var
+%dir /opt/traffic_monitor/var/log
+%dir /opt/traffic_monitor/var/run
+
+%attr(600, traffic_monitor, traffic_monitor) /opt/traffic_monitor/conf/*
+%attr(755, traffic_monitor, traffic_monitor) /opt/traffic_monitor/bin/*
+%attr(755, traffic_monitor, traffic_monitor) /etc/init.d/traffic_monitor
+
+%preun
+# args for hooks: http://www.ibm.com/developerworks/library/l-rpm2/
+# if $1 = 0, this is an uninstallation, if $1 = 1, this is an upgrade (don't do anything)
+if [ "$1" = "0" ]; then
+ /sbin/chkconfig traffic_monitor off
+ /etc/init.d/traffic_monitor stop
+ /sbin/chkconfig --del traffic_monitor
+fi
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d40cf4b4/traffic_monitor/experimental/build/traffic_monitor.init
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/build/traffic_monitor.init b/traffic_monitor/experimental/build/traffic_monitor.init
new file mode 100644
index 0000000..76de8ca
--- /dev/null
+++ b/traffic_monitor/experimental/build/traffic_monitor.init
@@ -0,0 +1,119 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Startup script for traffic_monitor
+#
+#
+# chkconfig: 345 99 10
+# description: traffic_monitor control script
+# processname: traffic_monitor
+
+### BEGIN INIT INFO
+# Provides: traffic_monitor
+# Required-Start: $network $local_fs $syslog
+# Required-Stop: $network $local_fs $syslog
+# Default-Start: 3 4 5
+# Default-Stop: 0 1 2 6
+# Short-Description: start and stop Traffic Monitor
+# Description: Controls all traffic monitor processes at once.
+### END INIT INFO
+
+# Source function library.
+. /etc/init.d/functions
+
+# Source networking configuration.
+. /etc/sysconfig/network
+
+basepath=/opt/traffic_monitor
+binpath=bin
+runpath=var/run
+name=traffic_monitor
+prog=$basepath/$binpath/$name
+lockfile=$basepath/$runpath/$name
+options="--opsCfg /opt/traffic_monitor/conf/traffic_ops.cfg --config opt/traffic_monitor/conf/traffic_monitor.cfg"
+
+start() {
+ [ "$NETWORKING" = "no" ] && exit 1
+ [ -x $prog ] || exit 5
+
+ #Set file limits
+ # Max open files
+ OPEN_FILE_LIMIT=65536
+ ulimit -n $OPEN_FILE_LIMIT
+ if [ $? -ne 0 ]; then
+ echo -n "Failed to set open file limit to $OPEN_FILE_LIMIT"
+ exit 1
+ fi
+
+ # Start daemons.
+ echo -n $"Starting $name: "
+ daemon nohup $prog $options < /dev/null > /opt/traffic_monitor/var/log/traffic_monitor.log 2>&1 &
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch $lockfile
+ return $RETVAL
+}
+
+stop() {
+ echo -n $"Shutting down $name: "
+ killproc $prog
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && rm -f $lockfile
+ return $RETVAL
+}
+
+reload() {
+ echo -n $"Reloading $name: "
+ if [ -n "`pidofproc $prog`" ]; then
+ killproc $prog -HUP
+ else
+ failure $"Reloading $name"
+ fi
+ RETVAL=$?
+ echo
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ status $prog
+ ;;
+ restart|force-reload)
+ stop
+ start
+ ;;
+ try-restart|condrestart)
+ if status $prog > /dev/null; then
+ stop
+ start
+ fi
+ ;;
+ reload)
+ reload
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload}"
+ exit 2
+esac
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d40cf4b4/traffic_monitor/experimental/build/traffic_monitor.logrotate
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/build/traffic_monitor.logrotate b/traffic_monitor/experimental/build/traffic_monitor.logrotate
new file mode 100644
index 0000000..cf2d19b
--- /dev/null
+++ b/traffic_monitor/experimental/build/traffic_monitor.logrotate
@@ -0,0 +1,9 @@
+/opt/traffic_monitor/var/log/traffic_monitor.log {
+ compress
+ maxage 30
+ missingok
+ nomail
+ size 10M
+ rotate 5
+ copytruncate
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d40cf4b4/traffic_monitor/experimental/conf/traffic_monitor.cfg
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/conf/traffic_monitor.cfg b/traffic_monitor/experimental/conf/traffic_monitor.cfg
new file mode 100644
index 0000000..a463682
--- /dev/null
+++ b/traffic_monitor/experimental/conf/traffic_monitor.cfg
@@ -0,0 +1,19 @@
+{
+ "cache_health_polling_interval_ms": 6000,
+ "cache_stat_polling_interval_ms": 6000,
+ "monitor_config_polling_interval_ms": 5000,
+ "http_timeout_ms": 2000,
+ "peer_polling_interval_ms": 5000,
+ "max_events": 200,
+ "max_stat_history": 5,
+ "max_health_history": 5,
+ "health_flush_interval_ms": 20,
+ "stat_flush_interval_ms": 20,
+ "log_location_error": "stderr",
+ "log_location_warning": "stdout",
+ "log_location_info": "null",
+ "log_location_debug": "null",
+ "serve_read_timeout_ms": 10000,
+ "serve_write_timeout_ms": 10000,
+ "http_poll_no_sleep": false
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d40cf4b4/traffic_monitor/experimental/traffic_monitor/traffic_monitor-example-config.json
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/traffic_monitor/traffic_monitor-example-config.json b/traffic_monitor/experimental/traffic_monitor/traffic_monitor-example-config.json
deleted file mode 100644
index a463682..0000000
--- a/traffic_monitor/experimental/traffic_monitor/traffic_monitor-example-config.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "cache_health_polling_interval_ms": 6000,
- "cache_stat_polling_interval_ms": 6000,
- "monitor_config_polling_interval_ms": 5000,
- "http_timeout_ms": 2000,
- "peer_polling_interval_ms": 5000,
- "max_events": 200,
- "max_stat_history": 5,
- "max_health_history": 5,
- "health_flush_interval_ms": 20,
- "stat_flush_interval_ms": 20,
- "log_location_error": "stderr",
- "log_location_warning": "stdout",
- "log_location_info": "null",
- "log_location_debug": "null",
- "serve_read_timeout_ms": 10000,
- "serve_write_timeout_ms": 10000,
- "http_poll_no_sleep": false
-}
[6/8] incubator-trafficcontrol git commit: blindly add '/' to the
beginning of static file name
Posted by el...@apache.org.
blindly add '/' to the beginning of static file name
(cherry picked from commit 1d37e4d5572fe2829f228fa8ec3aec226c5a06a2)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/7aa859e8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/7aa859e8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/7aa859e8
Branch: refs/heads/master
Commit: 7aa859e8c054c061fc036c30fd76cf79de230664
Parents: 44109ae
Author: David Neuman <da...@gmail.com>
Authored: Tue Jan 10 12:51:34 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Wed Jan 11 16:02:17 2017 +0000
----------------------------------------------------------------------
.../experimental/traffic_monitor/srvhttp/srvhttp.go | 7 -------
1 file changed, 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/7aa859e8/traffic_monitor/experimental/traffic_monitor/srvhttp/srvhttp.go
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/traffic_monitor/srvhttp/srvhttp.go b/traffic_monitor/experimental/traffic_monitor/srvhttp/srvhttp.go
index 09a5194..c7c1362 100644
--- a/traffic_monitor/experimental/traffic_monitor/srvhttp/srvhttp.go
+++ b/traffic_monitor/experimental/traffic_monitor/srvhttp/srvhttp.go
@@ -25,7 +25,6 @@ import (
"net"
"net/http"
"net/url"
- "strings"
"sync"
"time"
@@ -145,16 +144,10 @@ func DateStr(t time.Time) string {
}
func (s *Server) handleRootFunc(staticFileDir string) (http.HandlerFunc, error) {
- if strings.HasSuffix(staticFileDir, "/") {
- return s.handleFile(staticFileDir + "index.html")
- }
return s.handleFile(staticFileDir + "/index.html")
}
func (s *Server) handleSortableFunc(staticFileDir string) (http.HandlerFunc, error) {
- if strings.HasSuffix(staticFileDir, "/") {
- return s.handleFile(staticFileDir + "sorttable.js")
- }
return s.handleFile(staticFileDir + "/sorttable.js")
}
[7/8] incubator-trafficcontrol git commit: goTM will now check if
java TM is installed before installing. If java TM is installed,
go TM will not install
Posted by el...@apache.org.
goTM will now check if java TM is installed before installing. If java TM is installed, go TM will not install
(cherry picked from commit 749624344e9dc918631d3773018b7b014bd5a4c8)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/412edb13
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/412edb13
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/412edb13
Branch: refs/heads/master
Commit: 412edb136f97481dc472f828de17631845306d5c
Parents: 7aa859e
Author: David Neuman <ne...@apache.org>
Authored: Wed Jan 11 15:17:09 2017 +0000
Committer: David Neuman <da...@gmail.com>
Committed: Wed Jan 11 16:02:23 2017 +0000
----------------------------------------------------------------------
traffic_monitor/experimental/build/traffic_monitor.spec | 9 +++++++++
1 file changed, 9 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/412edb13/traffic_monitor/experimental/build/traffic_monitor.spec
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/build/traffic_monitor.spec b/traffic_monitor/experimental/build/traffic_monitor.spec
index 2351379..dd185ce 100644
--- a/traffic_monitor/experimental/build/traffic_monitor.spec
+++ b/traffic_monitor/experimental/build/traffic_monitor.spec
@@ -111,6 +111,15 @@ if [ -e /etc/init.d/traffic_monitor ]; then
/sbin/service traffic_monitor stop
fi
+#don't install over the top of java TM. This is a workaround since yum doesn't respect the Conflicts tag.
+if [[ $(rpm -q traffic_monitor --qf "%{VERSION}-%{RELEASE}") < 1.9.0 ]]
+then
+ echo -e "\n****************\n"
+ echo "A java version of traffic_monitor is installed. Please backup/remove that version before installing the golang version of traffic_monitor."
+ echo -e "\n****************\n"
+ exit 1
+fi
+
%post
/sbin/chkconfig --add traffic_monitor
[5/8] incubator-trafficcontrol git commit: remove unncessary echo
Posted by el...@apache.org.
remove unncessary echo
(cherry picked from commit 0ab782b025ddba7470b54516b1db03d83dd49604)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/44109ae7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/44109ae7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/44109ae7
Branch: refs/heads/master
Commit: 44109ae7e4a6db8162451a84efbd314e8727d89d
Parents: c2a2d04
Author: David Neuman <da...@gmail.com>
Authored: Mon Jan 9 15:01:43 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Wed Jan 11 16:02:09 2017 +0000
----------------------------------------------------------------------
build/build.sh | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/44109ae7/build/build.sh
----------------------------------------------------------------------
diff --git a/build/build.sh b/build/build.sh
index f182f0c..ef952d8 100755
--- a/build/build.sh
+++ b/build/build.sh
@@ -21,7 +21,6 @@
# make sure we start out in traffic_control dir
topscript=$(readlink -f $0)
export TC_DIR=$(dirname $(dirname "$topscript"))
-echo $TC_DIR
[[ -n $TC_DIR ]] && cd "$TC_DIR" || { echo "Could not cd $TC_DIR"; exit 1; }
. build/functions.sh
[4/8] incubator-trafficcontrol git commit: move index.html and
sorttable.js to static dir
Posted by el...@apache.org.
move index.html and sorttable.js to static dir
(cherry picked from commit 7afbf26f95a73e0d71e28a438bf2d015a0f0bc63)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/c2a2d049
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/c2a2d049
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/c2a2d049
Branch: refs/heads/master
Commit: c2a2d04912ffc848fb62e63b2c3af4bcc7588784
Parents: fcf2642
Author: David Neuman <da...@gmail.com>
Authored: Mon Jan 9 21:40:54 2017 +0000
Committer: David Neuman <da...@gmail.com>
Committed: Wed Jan 11 16:01:49 2017 +0000
----------------------------------------------------------------------
traffic_monitor/experimental/build/traffic_monitor.spec | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c2a2d049/traffic_monitor/experimental/build/traffic_monitor.spec
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/build/traffic_monitor.spec b/traffic_monitor/experimental/build/traffic_monitor.spec
index 181394b..2351379 100644
--- a/traffic_monitor/experimental/build/traffic_monitor.spec
+++ b/traffic_monitor/experimental/build/traffic_monitor.spec
@@ -73,6 +73,7 @@ mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor
mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/bin
mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/conf
mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/backup
+mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/static
mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/var/run
mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/var/log
mkdir -p "${RPM_BUILD_ROOT}"/etc/init.d
@@ -80,8 +81,8 @@ mkdir -p "${RPM_BUILD_ROOT}"/etc/logrotate.d
src=src/github.com/apache/incubator-trafficcontrol/traffic_monitor/experimental
cp -p "$src"/traffic_monitor/traffic_monitor "${RPM_BUILD_ROOT}"/opt/traffic_monitor/bin/traffic_monitor
-cp "$src"/traffic_monitor/index.html "${RPM_BUILD_ROOT}"/opt/traffic_monitor/bin/index.html
-cp "$src"/traffic_monitor/sorttable.js "${RPM_BUILD_ROOT}"/opt/traffic_monitor/bin/sorttable.js
+cp "$src"/traffic_monitor/index.html "${RPM_BUILD_ROOT}"/opt/traffic_monitor/static/index.html
+cp "$src"/traffic_monitor/sorttable.js "${RPM_BUILD_ROOT}"/opt/traffic_monitor/static/sorttable.js
cp "$src"/conf/traffic_ops.cfg "${RPM_BUILD_ROOT}"/opt/traffic_monitor/conf/traffic_ops.cfg
cp "$src"/conf/traffic_monitor.cfg "${RPM_BUILD_ROOT}"/opt/traffic_monitor/conf/traffic_monitor.cfg
cp "$src"/build/traffic_monitor.init "${RPM_BUILD_ROOT}"/etc/init.d/traffic_monitor
@@ -125,11 +126,13 @@ fi
%dir /opt/traffic_monitor/bin
%dir /opt/traffic_monitor/conf
%dir /opt/traffic_monitor/backup
+%dir /opt/traffic_monitor/static
%dir /opt/traffic_monitor/var
%dir /opt/traffic_monitor/var/log
%dir /opt/traffic_monitor/var/run
%attr(600, traffic_monitor, traffic_monitor) /opt/traffic_monitor/conf/*
+%attr(600, traffic_monitor, traffic_monitor) /opt/traffic_monitor/static/*
%attr(755, traffic_monitor, traffic_monitor) /opt/traffic_monitor/bin/*
%attr(755, traffic_monitor, traffic_monitor) /etc/init.d/traffic_monitor
[3/8] incubator-trafficcontrol git commit: add config option for
static http and js file
Posted by el...@apache.org.
add config option for static http and js file
(cherry picked from commit 27b7bca521354b6655b1e5a10772e46deb42cced)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/fcf26424
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/fcf26424
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/fcf26424
Branch: refs/heads/master
Commit: fcf264245eeff033b8ea4062dabeaa13c5cfe81f
Parents: c544779
Author: David Neuman <da...@gmail.com>
Authored: Mon Jan 9 14:00:00 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Wed Jan 11 16:01:41 2017 +0000
----------------------------------------------------------------------
.../experimental/conf/traffic_monitor.cfg | 3 +-
.../traffic_monitor/config/config.go | 4 +++
.../traffic_monitor/manager/opsconfig.go | 2 +-
.../traffic_monitor/srvhttp/srvhttp.go | 33 +++++++++++++-------
4 files changed, 28 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/fcf26424/traffic_monitor/experimental/conf/traffic_monitor.cfg
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/conf/traffic_monitor.cfg b/traffic_monitor/experimental/conf/traffic_monitor.cfg
index a463682..f2c25a0 100644
--- a/traffic_monitor/experimental/conf/traffic_monitor.cfg
+++ b/traffic_monitor/experimental/conf/traffic_monitor.cfg
@@ -15,5 +15,6 @@
"log_location_debug": "null",
"serve_read_timeout_ms": 10000,
"serve_write_timeout_ms": 10000,
- "http_poll_no_sleep": false
+ "http_poll_no_sleep": false,
+ "static_file_dir": "/opt/traffic_monitor/static/"
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/fcf26424/traffic_monitor/experimental/traffic_monitor/config/config.go
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/traffic_monitor/config/config.go b/traffic_monitor/experimental/traffic_monitor/config/config.go
index b7bb0e2..24ba42a 100644
--- a/traffic_monitor/experimental/traffic_monitor/config/config.go
+++ b/traffic_monitor/experimental/traffic_monitor/config/config.go
@@ -35,6 +35,8 @@ const (
LogLocationStderr = "stderr"
// LogLocationNull indicates the null IO stream (/dev/null)
LogLocationNull = "null"
+ //StaticFileDir is the directory that contains static html and js files.
+ StaticFileDir = "/opt/traffic_monitor/static/"
)
// Config is the configuration for the application. It includes myriad data, such as polling intervals and log locations.
@@ -57,6 +59,7 @@ type Config struct {
ServeWriteTimeout time.Duration `json:"-"`
HealthToStatRatio uint64 `json:"health_to_stat_ratio"`
HTTPPollNoSleep bool `json:"http_poll_no_sleep"`
+ StaticFileDir string `json:"static_file_dir"`
}
// DefaultConfig is the default configuration for the application, if no configuration file is given, or if a given config setting doesn't exist in the config file.
@@ -79,6 +82,7 @@ var DefaultConfig = Config{
ServeWriteTimeout: 10 * time.Second,
HealthToStatRatio: 4,
HTTPPollNoSleep: false,
+ StaticFileDir: StaticFileDir,
}
// MarshalJSON marshals custom millisecond durations. Aliasing inspired by http://choly.ca/post/go-json-marshalling/
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/fcf26424/traffic_monitor/experimental/traffic_monitor/manager/opsconfig.go
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/traffic_monitor/manager/opsconfig.go b/traffic_monitor/experimental/traffic_monitor/manager/opsconfig.go
index 81906ed..b57a613 100644
--- a/traffic_monitor/experimental/traffic_monitor/manager/opsconfig.go
+++ b/traffic_monitor/experimental/traffic_monitor/manager/opsconfig.go
@@ -148,7 +148,7 @@ func StartOpsConfigManager(
unpolledCaches,
monitorConfig,
)
- err = httpServer.Run(endpoints, listenAddress, cfg.ServeReadTimeout, cfg.ServeWriteTimeout)
+ err = httpServer.Run(endpoints, listenAddress, cfg.ServeReadTimeout, cfg.ServeWriteTimeout, cfg.StaticFileDir)
if err != nil {
handleErr(fmt.Errorf("MonitorConfigPoller: error creating HTTP server: %s\n", err))
continue
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/fcf26424/traffic_monitor/experimental/traffic_monitor/srvhttp/srvhttp.go
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/traffic_monitor/srvhttp/srvhttp.go b/traffic_monitor/experimental/traffic_monitor/srvhttp/srvhttp.go
index 564f5b3..09a5194 100644
--- a/traffic_monitor/experimental/traffic_monitor/srvhttp/srvhttp.go
+++ b/traffic_monitor/experimental/traffic_monitor/srvhttp/srvhttp.go
@@ -21,14 +21,16 @@ package srvhttp
import (
"fmt"
- "github.com/apache/incubator-trafficcontrol/traffic_monitor/experimental/common/log"
- "github.com/hydrogen18/stoppableListener"
"io/ioutil"
"net"
"net/http"
"net/url"
+ "strings"
"sync"
"time"
+
+ "github.com/apache/incubator-trafficcontrol/traffic_monitor/experimental/common/log"
+ "github.com/hydrogen18/stoppableListener"
)
// GetCommonAPIData calculates and returns API data common to most endpoints
@@ -53,12 +55,12 @@ type Server struct {
stoppableListenerWaitGroup sync.WaitGroup
}
-func (s Server) registerEndpoints(sm *http.ServeMux, endpoints map[string]http.HandlerFunc) error {
- handleRoot, err := s.handleRootFunc()
+func (s *Server) registerEndpoints(sm *http.ServeMux, endpoints map[string]http.HandlerFunc, staticFileDir string) error {
+ handleRoot, err := s.handleRootFunc(staticFileDir)
if err != nil {
return fmt.Errorf("Error getting root endpoint: %v", err)
}
- handleSortableJs, err := s.handleSortableFunc()
+ handleSortableJs, err := s.handleSortableFunc(staticFileDir)
if err != nil {
return fmt.Errorf("Error getting sortable endpoint: %v", err)
}
@@ -76,7 +78,7 @@ func (s Server) registerEndpoints(sm *http.ServeMux, endpoints map[string]http.H
// Run runs a new HTTP service at the given addr, making data requests to the given c.
// Run may be called repeatedly, and each time, will shut down any existing service first.
// Run is NOT threadsafe, and MUST NOT be called concurrently by multiple goroutines.
-func (s Server) Run(endpoints map[string]http.HandlerFunc, addr string, readTimeout time.Duration, writeTimeout time.Duration) error {
+func (s *Server) Run(endpoints map[string]http.HandlerFunc, addr string, readTimeout time.Duration, writeTimeout time.Duration, staticFileDir string) error {
if s.stoppableListener != nil {
log.Infof("Stopping Web Server\n")
s.stoppableListener.Stop()
@@ -94,7 +96,7 @@ func (s Server) Run(endpoints map[string]http.HandlerFunc, addr string, readTime
}
sm := http.NewServeMux()
- err = s.registerEndpoints(sm, endpoints)
+ err = s.registerEndpoints(sm, endpoints, staticFileDir)
if err != nil {
return err
}
@@ -134,6 +136,7 @@ func ParametersStr(params url.Values) string {
return pp
}
+//CommonAPIDataDataFormat is a common Date format for the API
const CommonAPIDataDateFormat = "Mon Jan 02 15:04:05 UTC 2006"
// DateStr returns the given time in the format expected by Traffic Monitor 1.0 API users
@@ -141,15 +144,21 @@ func DateStr(t time.Time) string {
return t.UTC().Format(CommonAPIDataDateFormat)
}
-func (s Server) handleRootFunc() (http.HandlerFunc, error) {
- return s.handleFile("index.html")
+func (s *Server) handleRootFunc(staticFileDir string) (http.HandlerFunc, error) {
+ if strings.HasSuffix(staticFileDir, "/") {
+ return s.handleFile(staticFileDir + "index.html")
+ }
+ return s.handleFile(staticFileDir + "/index.html")
}
-func (s Server) handleSortableFunc() (http.HandlerFunc, error) {
- return s.handleFile("sorttable.js")
+func (s *Server) handleSortableFunc(staticFileDir string) (http.HandlerFunc, error) {
+ if strings.HasSuffix(staticFileDir, "/") {
+ return s.handleFile(staticFileDir + "sorttable.js")
+ }
+ return s.handleFile(staticFileDir + "/sorttable.js")
}
-func (s Server) handleFile(name string) (http.HandlerFunc, error) {
+func (s *Server) handleFile(name string) (http.HandlerFunc, error) {
bytes, err := ioutil.ReadFile(name)
if err != nil {
return nil, err
[8/8] incubator-trafficcontrol git commit: This closes #177.
Posted by el...@apache.org.
This closes #177.
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/554db0f5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/554db0f5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/554db0f5
Branch: refs/heads/master
Commit: 554db0f5964243a767f45e14e43d24e2e0c95f94
Parents: 412edb1
Author: Jeff Elsloo <je...@cable.comcast.com>
Authored: Wed Jan 11 14:34:02 2017 -0700
Committer: Jeff Elsloo <je...@cable.comcast.com>
Committed: Wed Jan 11 14:34:02 2017 -0700
----------------------------------------------------------------------
----------------------------------------------------------------------
[2/8] incubator-trafficcontrol git commit: get RPM to build correctly
Posted by el...@apache.org.
get RPM to build correctly
(cherry picked from commit 0ee3772e930cf3b9ef0147c5de8c8852ae15406e)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/c5447794
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/c5447794
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/c5447794
Branch: refs/heads/master
Commit: c5447794c9e166b3a7e4b116aa040a6d9afe17aa
Parents: d40cf4b
Author: David Neuman <da...@gmail.com>
Authored: Mon Jan 9 19:46:56 2017 +0000
Committer: David Neuman <da...@gmail.com>
Committed: Wed Jan 11 16:01:30 2017 +0000
----------------------------------------------------------------------
build/build.sh | 5 +-
traffic_monitor/experimental/build/build_rpm.sh | 13 +-
traffic_monitor/experimental/build/tm2.spec | 139 ------------------
.../experimental/build/traffic_monitor.init | 2 +-
.../experimental/build/traffic_monitor.spec | 143 +++++++++++++++++++
5 files changed, 154 insertions(+), 148 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c5447794/build/build.sh
----------------------------------------------------------------------
diff --git a/build/build.sh b/build/build.sh
index 32d47d4..f182f0c 100755
--- a/build/build.sh
+++ b/build/build.sh
@@ -21,6 +21,7 @@
# make sure we start out in traffic_control dir
topscript=$(readlink -f $0)
export TC_DIR=$(dirname $(dirname "$topscript"))
+echo $TC_DIR
[[ -n $TC_DIR ]] && cd "$TC_DIR" || { echo "Could not cd $TC_DIR"; exit 1; }
. build/functions.sh
@@ -46,8 +47,8 @@ fi
declare -a badproj
declare -a goodproj
for p in "${projects[@]}"; do
- # strip from first /
- p=${p%%/*}
+ # strip trailing /
+ p=${p%/}
bldscript="$p/build/build_rpm.sh"
if [[ ! -x $bldscript ]]; then
echo "$bldscript not found"
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c5447794/traffic_monitor/experimental/build/build_rpm.sh
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/build/build_rpm.sh b/traffic_monitor/experimental/build/build_rpm.sh
old mode 100644
new mode 100755
index 9ec72a3..12115a8
--- a/traffic_monitor/experimental/build/build_rpm.sh
+++ b/traffic_monitor/experimental/build/build_rpm.sh
@@ -18,7 +18,8 @@
function importFunctions() {
local script=$(readlink -f "$0")
local scriptdir=$(dirname "$script")
- export TM_DIR=$(dirname "$scriptdir")
+ export goTM_DIR=$(dirname "$scriptdir")
+ export TM_DIR=$(dirname "$goTM_DIR")
export TC_DIR=$(dirname "$TM_DIR")
functions_sh="$TC_DIR/build/functions.sh"
if [[ ! -r $functions_sh ]]; then
@@ -35,17 +36,17 @@ function initBuildArea() {
# tar/gzip the source
local tm_dest=$(createSourceDir traffic_monitor)
- cd "$TM_DIR" || \
- { echo "Could not cd to $TM_DIR: $?"; exit 1; }
+ cd "$goTM_DIR" || \
+ { echo "Could not cd to $goTM_DIR: $?"; exit 1; }
rsync -av ./ "$tm_dest"/ || \
{ echo "Could not copy to $tm_dest: $?"; exit 1; }
- cp "$TM_DIR"/build/*.spec "$RPMBUILD"/SPECS/. || \
+ cp "$goTM_DIR"/build/*.spec "$RPMBUILD"/SPECS/. || \
{ echo "Could not copy spec files: $?"; exit 1; }
- cp -r "$TM_DIR"/ "$tm_dest" || { echo "Could not copy $TM_DIR to $tm_dest: $?"; exit 1; }
+ cp -r "$goTM_DIR"/ "$tm_dest" || { echo "Could not copy $goTM_DIR to $tm_dest: $?"; exit 1; }
tar -czvf "$tm_dest".tgz -C "$RPMBUILD"/SOURCES $(basename $tm_dest) || { echo "Could not create tar archive $tm_dest.tgz: $?"; exit 1; }
- cp "$TM_DIR"/build/*.spec "$RPMBUILD"/SPECS/. || { echo "Could not copy spec files: $?"; exit 1; }
+ cp "$goTM_DIR"/build/*.spec "$RPMBUILD"/SPECS/. || { echo "Could not copy spec files: $?"; exit 1; }
echo "The build area has been initialized."
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c5447794/traffic_monitor/experimental/build/tm2.spec
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/build/tm2.spec b/traffic_monitor/experimental/build/tm2.spec
deleted file mode 100644
index 076b9c0..0000000
--- a/traffic_monitor/experimental/build/tm2.spec
+++ /dev/null
@@ -1,139 +0,0 @@
-#
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-# RPM spec file for the Go version of Traffic Monitor (tm).
-#
-%define debug_package %{nil}
-Name: traffic_monitor
-Version: %{traffic_control_version}
-Release: %{build_number}
-Summary: Monitor the caches
-Packager: david_neuman2 at Cable dot Comcast dot com
-Vendor: Apache Software Foundation
-Group: Applications/Communications
-License: Apache License, Version 2.0
-URL: https://github.com/apache/incubator-trafficcontrol
-Source: %{_sourcedir}/traffic_monitor-%{traffic_control_version}.tgz
-
-%description
-Installs traffic_monitor
-
-%prep
-
-%setup
-
-%build
-export GOPATH=$(pwd)
-# Create build area with proper gopath structure
-mkdir -p src pkg bin || { echo "Could not create directories in $(pwd): $!"; exit 1; }
-
-go_get_version() {
- local src=$1
- local version=$2
- (
- cd $src && \
- git checkout $version && \
- go get -v \
- )
-}
-
-# get traffic_ops client
-godir=src/github.com/apache/incubator-trafficcontrol/traffic_ops/client
-( mkdir -p "$godir" && \
- cd "$godir" && \
- cp -r "$TC_DIR"/traffic_ops/client/* . && \
- go get -v \
-) || { echo "Could not build go program at $(pwd): $!"; exit 1; }
-
-#build traffic_monitor binary
-godir=src/github.com/apache/incubator-trafficcontrol/traffic_monitor/experimental/traffic_monitor
-oldpwd=$(pwd)
-( mkdir -p "$godir" && \
- cd "$godir" && \
- cp -r "$TC_DIR"/traffic_monitor/expiremental/* . && \
- go get -d -v && \
- go build -ldflags "-X main.GitRevision=`git rev-parse HEAD` -X main.BuildTimestamp=`date +'%Y-%M-%dT%H:%M:%S'`" \
-) || { echo "Could not build go program at $(pwd): $!"; exit 1; }
-
-%install
-mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor
-mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/bin
-mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/conf
-mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/backup
-mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/var/run
-mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/var/log
-mkdir -p "${RPM_BUILD_ROOT}"/etc/init.d
-mkdir -p "${RPM_BUILD_ROOT}"/etc/logrotate.d
-
-src=src/github.com/apache/incubator-trafficcontrol/traffic_monitor/expiremental
-cp -p traffic_monitor/traffic_monitor "${RPM_BUILD_ROOT}"/opt/traffic_monitor/bin/traffic_monitor
-cp "$src"/conf/traffic_ops.cfg "${RPM_BUILD_ROOT}"/opt/traffic_monitor/conf/traffic_ops.cfg
-cp "$src"/build/traffic_monitor.init "${RPM_BUILD_ROOT}"/etc/init.d/traffic_monitor
-cp "$src"/build/traffic_monitor.logrotate "${RPM_BUILD_ROOT}"/etc/logrotate.d/traffic_monitor
-
-%pre
-/usr/bin/getent group traffic_monitor >/dev/null
-
-if [ $? -ne 0 ]; then
-
- /usr/sbin/groupadd -g 422 traffic_monitor
-fi
-
-/usr/bin/getent passwd traffic_monitor >/dev/null
-
-if [ $? -ne 0 ]; then
-
- /usr/sbin/useradd -g traffic_monitor -u 422 -d /opt/traffic_monitor -M traffic_monitor
-
-fi
-
-/usr/bin/passwd -l traffic_monitor >/dev/null
-/usr/bin/chage -E -1 -I -1 -m 0 -M 99999 -W 7 traffic_monitor
-
-if [ -e /etc/init.d/traffic_monitor ]; then
- /sbin/service traffic_monitor stop
-fi
-
-%post
-
-/sbin/chkconfig --add traffic_monitor
-/sbin/chkconfig traffic_monitor on
-
-%files
-%defattr(644, traffic_monitor, traffic_monitor, 755)
-%config(noreplace) /opt/traffic_monitor/conf/traffic_monitor.cfg
-%config(noreplace) /opt/traffic_monitor/conf/traffic_ops.cfg
-%config(noreplace) /etc/logrotate.d/traffic_monitor
-
-%dir /opt/traffic_monitor
-%dir /opt/traffic_monitor/bin
-%dir /opt/traffic_monitor/conf
-%dir /opt/traffic_monitor/backup
-%dir /opt/traffic_monitor/var
-%dir /opt/traffic_monitor/var/log
-%dir /opt/traffic_monitor/var/run
-
-%attr(600, traffic_monitor, traffic_monitor) /opt/traffic_monitor/conf/*
-%attr(755, traffic_monitor, traffic_monitor) /opt/traffic_monitor/bin/*
-%attr(755, traffic_monitor, traffic_monitor) /etc/init.d/traffic_monitor
-
-%preun
-# args for hooks: http://www.ibm.com/developerworks/library/l-rpm2/
-# if $1 = 0, this is an uninstallation, if $1 = 1, this is an upgrade (don't do anything)
-if [ "$1" = "0" ]; then
- /sbin/chkconfig traffic_monitor off
- /etc/init.d/traffic_monitor stop
- /sbin/chkconfig --del traffic_monitor
-fi
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c5447794/traffic_monitor/experimental/build/traffic_monitor.init
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/build/traffic_monitor.init b/traffic_monitor/experimental/build/traffic_monitor.init
index 76de8ca..9240ead 100644
--- a/traffic_monitor/experimental/build/traffic_monitor.init
+++ b/traffic_monitor/experimental/build/traffic_monitor.init
@@ -46,7 +46,7 @@ runpath=var/run
name=traffic_monitor
prog=$basepath/$binpath/$name
lockfile=$basepath/$runpath/$name
-options="--opsCfg /opt/traffic_monitor/conf/traffic_ops.cfg --config opt/traffic_monitor/conf/traffic_monitor.cfg"
+options="--opsCfg /opt/traffic_monitor/conf/traffic_ops.cfg --config /opt/traffic_monitor/conf/traffic_monitor.cfg"
start() {
[ "$NETWORKING" = "no" ] && exit 1
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c5447794/traffic_monitor/experimental/build/traffic_monitor.spec
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/build/traffic_monitor.spec b/traffic_monitor/experimental/build/traffic_monitor.spec
new file mode 100644
index 0000000..181394b
--- /dev/null
+++ b/traffic_monitor/experimental/build/traffic_monitor.spec
@@ -0,0 +1,143 @@
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+# RPM spec file for the Go version of Traffic Monitor (tm).
+#
+%define debug_package %{nil}
+Name: traffic_monitor
+Version: %{traffic_control_version}
+Release: %{build_number}
+Summary: Monitor the caches
+Packager: david_neuman2 at Cable dot Comcast dot com
+Vendor: Apache Software Foundation
+Group: Applications/Communications
+License: Apache License, Version 2.0
+URL: https://github.com/apache/incubator-trafficcontrol
+Source: %{_sourcedir}/traffic_monitor-%{traffic_control_version}.tgz
+
+%description
+Installs traffic_monitor
+
+%prep
+
+%setup
+
+%build
+export GOPATH=$(pwd)
+# Create build area with proper gopath structure
+mkdir -p src pkg bin || { echo "Could not create directories in $(pwd): $!"; exit 1; }
+
+go_get_version() {
+ local src=$1
+ local version=$2
+ (
+ cd $src && \
+ git checkout $version && \
+ go get -v \
+ )
+}
+
+# get traffic_ops client
+godir=src/github.com/apache/incubator-trafficcontrol/traffic_ops/client
+( mkdir -p "$godir" && \
+ cd "$godir" && \
+ cp -r "$TC_DIR"/traffic_ops/client/* . && \
+ go get -v \
+) || { echo "Could not build go program at $(pwd): $!"; exit 1; }
+
+#build traffic_monitor binary
+godir=src/github.com/apache/incubator-trafficcontrol/traffic_monitor/experimental
+oldpwd=$(pwd)
+( mkdir -p "$godir" && \
+ cd "$godir" && \
+ cp -r "$TC_DIR"/traffic_monitor/experimental/* . && \
+ cd traffic_monitor && \
+ go get -d -v && \
+ go build -ldflags "-X main.GitRevision=`git rev-parse HEAD` -X main.BuildTimestamp=`date +'%Y-%M-%dT%H:%M:%s'`" \
+) || { echo "Could not build go program at $(pwd): $!"; exit 1; }
+
+%install
+mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor
+mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/bin
+mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/conf
+mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/backup
+mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/var/run
+mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/var/log
+mkdir -p "${RPM_BUILD_ROOT}"/etc/init.d
+mkdir -p "${RPM_BUILD_ROOT}"/etc/logrotate.d
+
+src=src/github.com/apache/incubator-trafficcontrol/traffic_monitor/experimental
+cp -p "$src"/traffic_monitor/traffic_monitor "${RPM_BUILD_ROOT}"/opt/traffic_monitor/bin/traffic_monitor
+cp "$src"/traffic_monitor/index.html "${RPM_BUILD_ROOT}"/opt/traffic_monitor/bin/index.html
+cp "$src"/traffic_monitor/sorttable.js "${RPM_BUILD_ROOT}"/opt/traffic_monitor/bin/sorttable.js
+cp "$src"/conf/traffic_ops.cfg "${RPM_BUILD_ROOT}"/opt/traffic_monitor/conf/traffic_ops.cfg
+cp "$src"/conf/traffic_monitor.cfg "${RPM_BUILD_ROOT}"/opt/traffic_monitor/conf/traffic_monitor.cfg
+cp "$src"/build/traffic_monitor.init "${RPM_BUILD_ROOT}"/etc/init.d/traffic_monitor
+cp "$src"/build/traffic_monitor.logrotate "${RPM_BUILD_ROOT}"/etc/logrotate.d/traffic_monitor
+
+%pre
+/usr/bin/getent group traffic_monitor >/dev/null
+
+if [ $? -ne 0 ]; then
+
+ /usr/sbin/groupadd -g 423 traffic_monitor
+fi
+
+/usr/bin/getent passwd traffic_monitor >/dev/null
+
+if [ $? -ne 0 ]; then
+
+ /usr/sbin/useradd -g traffic_monitor -u 423 -d /opt/traffic_monitor -M traffic_monitor
+
+fi
+
+/usr/bin/passwd -l traffic_monitor >/dev/null
+/usr/bin/chage -E -1 -I -1 -m 0 -M 99999 -W 7 traffic_monitor
+
+if [ -e /etc/init.d/traffic_monitor ]; then
+ /sbin/service traffic_monitor stop
+fi
+
+%post
+
+/sbin/chkconfig --add traffic_monitor
+/sbin/chkconfig traffic_monitor on
+
+%files
+%defattr(644, traffic_monitor, traffic_monitor, 755)
+%config(noreplace) /opt/traffic_monitor/conf/traffic_monitor.cfg
+%config(noreplace) /opt/traffic_monitor/conf/traffic_ops.cfg
+%config(noreplace) /etc/logrotate.d/traffic_monitor
+
+%dir /opt/traffic_monitor
+%dir /opt/traffic_monitor/bin
+%dir /opt/traffic_monitor/conf
+%dir /opt/traffic_monitor/backup
+%dir /opt/traffic_monitor/var
+%dir /opt/traffic_monitor/var/log
+%dir /opt/traffic_monitor/var/run
+
+%attr(600, traffic_monitor, traffic_monitor) /opt/traffic_monitor/conf/*
+%attr(755, traffic_monitor, traffic_monitor) /opt/traffic_monitor/bin/*
+%attr(755, traffic_monitor, traffic_monitor) /etc/init.d/traffic_monitor
+
+%preun
+# args for hooks: http://www.ibm.com/developerworks/library/l-rpm2/
+# if $1 = 0, this is an uninstallation, if $1 = 1, this is an upgrade (don't do anything)
+if [ "$1" = "0" ]; then
+ /sbin/chkconfig traffic_monitor off
+ /etc/init.d/traffic_monitor stop
+ /sbin/chkconfig --del traffic_monitor
+fi