You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2010/02/12 15:24:06 UTC
svn commit: r909424 - in /incubator/trafficserver/traffic/trunk: NOTICE
contrib/ contrib/install_trafficserver.sh contrib/set_trafficserver.sh
Author: zwoop
Date: Fri Feb 12 14:24:06 2010
New Revision: 909424
URL: http://svn.apache.org/viewvc?rev=909424&view=rev
Log:
TS-166: Added two contributed scripts, creating the ./contrib directory. We can lay this out differently later if necessary.
Author: Jason Giedymin
Review: Leif
Added:
incubator/trafficserver/traffic/trunk/contrib/
incubator/trafficserver/traffic/trunk/contrib/install_trafficserver.sh
incubator/trafficserver/traffic/trunk/contrib/set_trafficserver.sh
Modified:
incubator/trafficserver/traffic/trunk/NOTICE
Modified: incubator/trafficserver/traffic/trunk/NOTICE
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/trunk/NOTICE?rev=909424&r1=909423&r2=909424&view=diff
==============================================================================
--- incubator/trafficserver/traffic/trunk/NOTICE (original)
+++ incubator/trafficserver/traffic/trunk/NOTICE Fri Feb 12 14:24:06 2010
@@ -1,5 +1,5 @@
Apache Traffic Server
-Copyright 2009 The Apache Software Foundation
+Copyright 2010 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
Added: incubator/trafficserver/traffic/trunk/contrib/install_trafficserver.sh
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/trunk/contrib/install_trafficserver.sh?rev=909424&view=auto
==============================================================================
--- incubator/trafficserver/traffic/trunk/contrib/install_trafficserver.sh (added)
+++ incubator/trafficserver/traffic/trunk/contrib/install_trafficserver.sh Fri Feb 12 14:24:06 2010
@@ -0,0 +1,323 @@
+#!/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.
+#
+#
+# Quick Build/Test for TrafficServer
+# Tested on Ubuntu Karmic 9.10, EC2 Friendly with official Canonical AMIs
+# Author: Jason Giedymin
+# Desc: The intent with this script is to unify a single build script with
+# standard options for testing.
+#
+# Version Information:
+# v0.1.1a - Added Debug
+# v1.0.0 - Stable Release
+# v1.0.1 - Added sqlite dev lib.
+# v1.0.2 - EC2 Note about ephemeral storage
+# - Create ephemeral storage by mimicking on non EC2 systems.
+# v1.0.3 - Added fedora to list of supported distros
+
+# It's safe to use this in a non-ec2 environment. This directory will be
+# created if it doesn't exist. If your running this on EC2, it's best not
+# to change this location as this is the ephemeral drive setup by Amazon.
+# For non-ec2 environments, you may change this to any location you
+# desire.
+EC2_EPHEMERAL=/mnt
+PROJECT=trafficserver
+
+BRANCH=traffic/trunk
+SVN_LOC=traffic-trunk.svn
+SVN_HOME=http://svn.apache.org/repos/asf/incubator
+
+FALSE=0
+TRUE=1
+DEBUG=$FALSE
+BUILD_HOME=/usr/local
+PREFIX=--prefix=$BUILD_HOME
+BUILD_OPTIONS_DEBUG="--with-user=root --with-group=root $PREFIX --enable-debug"
+BUILD_OPTIONS="--with-user=root --with-group=root $PREFIX"
+FULL_BUILD_PATH=$EC2_EPHEMERAL/$PROJECT/$SVN_LOC
+
+SUSE="suse"
+FEDORA="fedora"
+REDHAT="redhat" # also exists on Fedora
+UBUNTU="ubuntu"
+DEBIAN="debian" # also exists on Ubuntu
+SLACKWARE="slackware"
+
+
+function killAll() {
+ killall traffic_cop
+ killall traffic_manager
+ killall traffic_server
+}
+
+function updateInstall() {
+ if [ "$DISTRIB_ID" = "$UBUNTU" ]; then
+ apt-get update
+ apt-get install -y g++ autoconf \
+ libtool \
+ libssl-dev \
+ tcl-dev \
+ libexpat1-dev \
+ libdb-dev \
+ libpcre3-dev \
+ libsqlite3-dev \
+ libdb-dev
+ apt-get install -y subversion git git-svn
+ elif [ "$DISTRIB_ID" = "$FEDORA" ]; then
+ yum -y install subversion \
+ git \
+ autoconf \
+ automake \
+ libtool \
+ gcc-c++ \
+ glibc-devel \
+ openssl-devel \
+ tcl-devel \
+ expat-devel \
+ sqlite-devel \
+ pcre \
+ pcre-devel
+ fi
+}
+
+function cleanUp() {
+ if [ -e $EC2_EPHEMERAL/$PROJECT ]; then
+ rm -R $EC2_EPHEMERAL/$PROJECT
+ fi
+
+ if [ ! -d $EC2_EPHEMERAL ]; then
+ mkdir -p $EC2_EPHEMERAL
+ cd $EC2_EPHEMERAL
+ fi
+}
+
+function svnCheckout() {
+ #----------------SVN Only------------------------------
+ svn checkout $SVN_HOME/$PROJECT/$BRANCH $FULL_BUILD_PATH
+ cd $FULL_BUILD_PATH
+ #------------------------------------------------------
+}
+
+#This is just for some dev/testing, and still in the 'works'
+function dev() {
+ #----------------Git Only------------------------------
+ git clone git://git.apache.org/trafficserver.git
+ cd $EC2_EPHEMERAL/$trafficserver
+
+ #swtich to dev build
+ git checkout -b remotes/origin/dev
+ #------------------------------------------------------
+}
+
+function rebuild() {
+ #remake, clean, uninstall first
+
+ if [ ! -d $FULL_BUILD_PATH ]; then
+ echo "Can't find $FULL_BUILD_PATH, cannot continue!";
+ exit 1;
+ fi
+
+ cd $FULL_BUILD_PATH
+ addgroup nobody
+ autoreconf -i
+
+ if [ $DEBUG = $TRUE ]; then
+ ./configure $BUILD_OPTIONS_DEBUG
+ elif [ $DEBUG = $FALSE ]; then
+ ./configure $BUILD_OPTIONS
+ fi
+
+
+ make clean
+
+ #Here is where things are dumb. We don't check for
+ #successful builds yet. Thats in the next release.
+ #This is why I call it dumb.
+ make
+ make uninstall
+ make install
+}
+
+function postMods() {
+ #Flag verbose on, we like verbose
+ if [ -e /etc/default/rcS ]; then
+ sed -i 's/VERBOSE=no/VERBOSE=yes/g' /etc/default/rcS
+ fi
+
+ #Link the script for init purposes, makes things nice
+ if [ -e $BUILD_HOME/bin/trafficserver ]; then
+ ln -s -f $BUILD_HOME/bin/trafficserver /etc/init.d/trafficserver
+ fi
+}
+
+function freshBuild() {
+ clear
+ echo "Starting TrafficServer Install (dumb) process..."
+
+ killAll
+ updateInstall
+ cleanUp
+ svnCheckout
+ rebuild
+ postMods
+
+ echo;
+ echo "TrafficServer Install (dumb) process complete."
+}
+
+function forceBuild() {
+ clear
+ echo "Starting Build Only..."
+
+ killAll
+ updateInstall
+ rebuild
+ postMods
+
+ echo "Build complete."
+}
+
+function flipDebug() {
+ if [ $DEBUG = $TRUE ]; then
+ DEBUG=$FALSE
+ elif [ $DEBUG = $FALSE ]; then
+ DEBUG=$TRUE
+ fi
+}
+
+function askUser() {
+usage;
+echo;
+
+usageLine;
+
+read -p "" RESPONSE
+
+if [ "$RESPONSE" = "freshBuild" ]; then
+ $RESPONSE;
+ exit 0;
+elif [ "$RESPONSE" = "forceBuild" ]; then
+ $RESPONSE;
+ exit 0;
+elif [ "$RESPONSE" = "flipDebug" ]; then
+ $RESPONSE;
+ askUser;
+elif [ "$RESPONSE" = "EXIT" ]; then
+ echo "Exiting NOW!"
+ exit 0;
+else
+ #usageLine;
+ askUser;
+ return 1;
+fi
+
+}
+
+function usage() {
+ clear
+ echo;
+ echo 'This script is used for doing quick builds & Tests for TrafficServer.';
+ echo;
+ displayInfo;
+ echo;
+ echo "Commands:";
+ echo 'freshBuild: Checkout from svn, build and install.';
+ echo 'forceBuild: Do a build from previous checked out source.';
+ echo 'flipDebug: Flip the current debug mode.';
+ echo 'EXIT: Exit now!';
+ echo;
+}
+
+function displayInfo() {
+ #Would like to make these editable in the next release.
+
+ echo "-----------------------------------------------------------------------"
+ echo " Current Options "
+ echo "-----------------------------------------------------------------------"
+ echo " OS: $DISTRIB_ID"
+
+ if [ $DEBUG = $TRUE ]; then
+ echo " Debug Mode: ON"
+ else
+ echo " Debug Mode: OFF"
+ fi
+
+ echo " Source checkout: $EC2_EPHEMERAL/$PROJECT"
+ echo " Branch: $BRANCH"
+ echo " SVN Server: $SVN_HOME"
+ echo " Build Options: $BUILD_OPTIONS"
+ echo "Debug Build Options: $BUILD_OPTIONS_DEBUG"
+ echo " Full Build Path: $FULL_BUILD_PATH"
+ echo "-----------------------------------------------------------------------"
+}
+
+function usageLine() {
+ echo;
+ echo "You can access the menu by calling this script or by command line."
+ echo "Menu usage and choices are: {freshBuild|forceBuild|flipDebug|EXIT}."
+ echo "Command line usage choices are: {freshBuild|forceBuild|freshDebugBuild|EXIT}."
+ echo;
+ echo "Note that the command line has a strict debug build option.";
+ echo;
+}
+
+#------------Main------------
+
+if [ -e /etc/SuSE-release ]; then
+ DISTRIB_ID=$SUSE
+elif [ -e /etc/fedora-release ]; then
+ DISTRIB_ID=$FEDORA
+elif [ -e /etc/redhat-release ]; then
+ DISTRIB_ID=$REDHAT # also exists on Fedora
+elif [ -e /etc/lsb-release ]; then
+ DISTRIB_ID=$UBUNTU
+elif [ -e /etc/debian-version ]; then
+ DISTRIB_ID=$DEBIAN # also exists on Ubuntu
+elif [ -e /etc/slackware-version ]; then
+ DISTRIB_ID=$SLACKWARE
+fi
+
+if [ $UID != 0 ] ; then
+ echo "Must have root permissions to execute."
+ exit 1
+fi
+
+displayInfo;
+
+case "$1" in
+ freshBuild)
+ $1;
+ ;;
+ forceBuild)
+ $1;
+ ;;
+ freshDebugBuild)
+ $DEBUG=$TRUE
+ freshBuild;
+ ;;
+ EXIT)
+ echo 'Exiting...';
+ exit 0;
+ ;;
+ *)
+ askUser;
+ ;;
+esac
+
+exit 0;
+
Added: incubator/trafficserver/traffic/trunk/contrib/set_trafficserver.sh
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/trunk/contrib/set_trafficserver.sh?rev=909424&view=auto
==============================================================================
--- incubator/trafficserver/traffic/trunk/contrib/set_trafficserver.sh (added)
+++ incubator/trafficserver/traffic/trunk/contrib/set_trafficserver.sh Fri Feb 12 14:24:06 2010
@@ -0,0 +1,40 @@
+#!/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.
+#
+#Basic Dev base settings script.
+#Author: Jason Giedymin
+#Version Information:
+# v1.0.0 - Initial Release
+# v1.0.1 - thread limit set to 1
+
+function recordsConfig() {
+ traffic_line -s proxy.config.reverse_proxy.enabled -v 1
+ traffic_line -s proxy.config.exec_thread.autoconfig -v 1
+ traffic_line -s proxy.config.exec_thread.autoconfig.scale -v 3.000000
+ traffic_line -s proxy.config.exec_thread.limit -v 1
+ traffic_line -s proxy.config.accept_threads -v 1
+}
+
+function start() {
+ echo "Modifying configs..."
+
+ recordsConfig
+
+ echo "Complete."
+}
+
+start