#!/bin/bash # install.sh [target folder] SOLR_VERSION=4.6.1 JETTY_VERSION=8.1.14.v20131031 JETTY_PATH=jetty-distribution-$JETTY_VERSION # TODO: prompt for install location export ROOT=./install QUIET=0 ARGS=$() set -- $(getopt -u -o h:p:P:l:c:q -n "install.sh" -- $@) while true; do case "$1" in -h) HOST=$2; shift 2 ;; -p) PORT=$2 shift 2;; -P) PASS=$2 shift 2;; -l) LOGIN=$2 shift 2;; -c) CHARSET=$2 shift 2;; -q) QUIET=1 shift;; --) shift; break;; esac done #echo "HOST = $HOST" #echo "PORT = $PORT" #echo "PASS = $PASS" #echo "LOGIN = $LOGIN" #echo "CHARSET = $CHARSET" # get the perforce server address, login, etc. for the config file if [[ ! -n "${HOST}" ]]; then read -p "Enter the Perforce Server hostname: " HOST fi if [[ ! -n "${PORT}" ]]; then read -p "Enter the Perforce Server port: " PORT fi if [[ ! -n "${CHARSET}" ]]; then read -p "Enter the Perforce Server charset (leave empty for non-unicde servers): " CHARSET fi if [[ ! -n "${LOGIN}" ]]; then read -p "Enter the Perforce Server login: " LOGIN fi if [[ ! -n "${PASS}" ]]; then read -p "Enter the Perforce Server password: " -s PASS echo fi echo export P4CHARSET=$CHARSET # test the settings # if you do not have "p4" in the path you get a non-fatal error message RESULT=$(echo $PASS | p4 -p$HOST:$PORT -u$LOGIN login) RETVAL=$? echo $RESULT if [[ ${QUIET} == 0 && "$RETVAL" != 0 ]] ; then read -p "ERROR: Failed to log in to the specified server, continue anyway? (y/N) " CONTINUE if [ "$CONTINUE" != "y" ] ; then exit 1 fi fi if [ ${QUIET} == 0 ]; then echo echo "WARNING: this could take a long time if your depot is large" read -p "Do you want p4-search to index your depot on startup (y/N)? " SCAN else SCAN="y" fi if [ ! -d $ROOT ] ; then mkdir -p $ROOT fi if [ ! -e solr-$SOLR_VERSION.tgz ] ; then echo "Downloading solr-$SOLR_VERSION..." wget http://archive.apache.org/dist/lucene/solr/$SOLR_VERSION/solr-$SOLR_VERSION.tgz || exit 1 fi echo "Extracting solr..." tar xf solr-$SOLR_VERSION.tgz -C $ROOT || exit 1 if [ ! -e $JETTY_PATH.tar.gz ] ; then echo "Downloading $JETTY_PATH..." wget -O $JETTY_PATH.tar.gz "http://eclipse.org/downloads/download.php?file=/jetty/$JETTY_VERSION/dist/$JETTY_PATH.tar.gz&r=1" || exit 1 fi echo "Extracting jetty..." tar xf $JETTY_PATH.tar.gz -C $ROOT || exit 1 echo "Setting up solr..." # copy new schema for collection1, change the config to only do localhost cp -f ./solr-config/$SOLR_VERSION/schema.xml $ROOT/solr-$SOLR_VERSION/example/solr/collection1/conf/schema.xml || exit 1 echo "Updating control script" cat scripts/solr-control.sh | sed -e 's/JPORT=.*/JPORT=8983/' -e 's/STOP=.*/STOP=8984/' -e 's/#ROOT=ROOT_REPLACE/ROOT=${ROOT}/' -e 's/#SOLR_VERSION=SOLR_VERSION_REPLACE/SOLR_VERSION=${SOLR_VERSION}/' -e 's/#JETTY_VERSION=JETTY_VERSION_REPLACE/JETTY_VERSION=${JETTY_VERSION}/'> $ROOT/solr-$SOLR_VERSION/example/solr-control.sh && chmod +x $ROOT/solr-$SOLR_VERSION/example/solr-control.sh || exit 1 echo "Setting up p4-search..." # copy war, context.xml, etc. rm -rf $ROOT/$JETTY_PATH/webapps/* $ROOT/$JETTY_PATH/contexts/* cp p4-search*.war $ROOT/$JETTY_PATH/webapps/p4-search.war || exit 1 cp jetty/contexts/*.xml $ROOT/$JETTY_PATH/contexts || exit 1 cp scripts/p4search-control.sh $ROOT/$JETTY_PATH || exit 1 # TODO: somehow get the following into the solr jetty.xml file to lock the admin tool to local only # <New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection"> # <Set name="handlers"> # <Array type="org.eclipse.jetty.server.Handler"> # <Item> # # <!-- here begins the new stuff --> # <New class="org.eclipse.jetty.server.handler.IPAccessHandler"> # <Call name="addWhite"><Arg>127.0.0.1</Arg></Call> # # <Set name="handler"> # <New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/> # </Set> # </New> # <!-- here ends the new stuff --> SEDARGS=" " if [ "$SCAN" != "y" ] ; then SEDARGS+="-e \"s/com.perforce.search.fileScannerToken\(.*\)/\# com.perforce.search.fileScannerToken\1/\"" else SEDARGS+="-e \"s/# com.perforce.search.fileScannerToken\(.*\)/com.perforce.search.fileScannerToken\1/\"" fi SEDARGS+=" -e \"s/serverHost=.*/serverHost=$HOST/\"" SEDARGS+=" -e \"s/serverPort=.*/serverPort=$PORT/\"" SEDARGS+=" -e \"s/indexerUser=.*/indexerUser=$LOGIN/\"" SEDARGS+=" -e \"s/indexerPassword=.*/indexerPassword=$PASS/\"" UUIDGEN=$(which uuidgen) if [ "$UUIDGEN" == "" ]; then UUIDGEN=$(which dbus-uuidgen) fi TOKEN="" if [ "$UUIDGEN" != "" ]; then TOKEN=$($UUIDGEN) SEDARGS+=" -e \"s/searchEngineToken=.*/searchEngineToken=$TOKEN/\"" chmod +w scripts/search-queue.sh eval sed "s/SEARCH_TOKEN=.*/SEARCH_TOKEN=\"$TOKEN\"/" scripts/search-queue.sh > $ROOT/search-queue.sh chmod -w scripts/search-queue.sh else echo "NOTE: No UUID generator found; you must construct your own UUID token" echo "and put it in p4search.config and search-queue.sh" echo fi echo "Configuring p4-search ($SEDARGS)" eval sed $SEDARGS conf/search.config > $ROOT/$JETTY_PATH/resources/search.config if [ "$CHARSET" != "" ] ; then # append the charset to the config file echo "com.perforce.search.serverCharset=$CHARSET" >> $ROOT/$JETTY_PATH/resources/search.config fi echo "log4j.category.org.springframework=ERROR" >> $ROOT/$JETTY_PATH/resources/log4j.properties # generate the start.sh and stop.sh files ESC_ROOT="${ROOT//\//\\/}" ESC_SOLR="${SOLR_VERSION//\//\\/}" ESC_JETTY="${JETTY_PATH//\//\\/}" cat scripts/start.sh | sed -e 's/\$ROOT/'$ESC_ROOT'/' -e 's/\$SOLR_VERSION/'$ESC_SOLR'/' -e 's/\$JETTY_PATH/'$ESC_JETTY'/' > $ROOT/start.sh cat scripts/stop.sh | sed -e 's/\$ROOT/'$ESC_ROOT'/' -e 's/\$SOLR_VERSION/'$ESC_SOLR'/' -e 's/\$JETTY_PATH/'$ESC_JETTY'/' > $ROOT/stop.sh chmod +x $ROOT/start.sh $ROOT/stop.sh echo echo "To complete the installation you must install the trigger $ROOT/search-queue.sh in the server at $HOST:$PORT" echo "The trigger is required to signal to p4-search when indexing new content is required and is using the token '$TOKEN'" echo echo "You can run $ROOT/start.sh at any time to start the services and connect to http://localhost:8088 in a web browser" echo
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 19193 | Paul Allen | Upgrade Solr server to 4.6.1 | ||
#1 | 18494 | Paul Allen |
Fixed paths: search/search/... to search/... util/util/... to util/... Fixed permission bits +w for config and properties file that get touched during build/install Fixed INSTALL file and install dir (cause name clash on OS X) moved INSTALL to INSTALL.md |
||
//guest/perforce_software/p4search/main/search/search/build/install.sh | |||||
#1 | 16193 | perforce_software | Move p4search to main directory to match new branching path scheme. | ||
//guest/perforce_software/p4search/search/build/install.sh | |||||
#2 | 9007 | Doug Scheirer |
update workshop p4-search with the latest released code: * code updates - bug fixes * adding jetty + solr tarballs * script updates * updated p4java jar to latest release |
||
#1 | 8975 | Matt Attaway | Populate official version of p4-search from the original Doug Scheirer source |