File tree Expand file tree Collapse file tree 1 file changed +55
-1
lines changed
Expand file tree Collapse file tree 1 file changed +55
-1
lines changed Original file line number Diff line number Diff line change 1- curl -sSL https://raw.githubusercontent.com/PHPSocialNetwork/travis-solr/master/travis-solr.sh | SOLR_COLLECTION=phpfastcache SOLR_VERSION=8.11.1 bash
1+ #! /bin/bash
2+
3+ set -e
4+
5+ export SOLR_PORT=8983
6+ export SOLR_HOST=127.0.0.1
7+ export SOLR_VERSION=8.11.1
8+ export SOLR_CORE=phpfastcache
9+
10+ download () {
11+ FILE=" $2 .tgz"
12+ if [ -f $FILE ];
13+ then
14+ echo " File $FILE exists."
15+ tar -zxf $FILE
16+ else
17+ echo " File $FILE does not exist. Downloading solr from $1 ..."
18+ curl -O $1
19+ tar -zxf $FILE
20+ fi
21+ echo " Downloaded!"
22+ }
23+
24+ is_solr_up (){
25+ echo " Checking if solr is up on http://localhost:$SOLR_PORT /solr/admin/cores"
26+ http_code=` echo $( curl -s -o /dev/null -w " %{http_code}" " http://localhost:$SOLR_PORT /solr/admin/cores" ) `
27+ return ` test $http_code = " 200" `
28+ }
29+
30+ wait_for_solr (){
31+ while ! is_solr_up; do
32+ sleep 3
33+ done
34+ }
35+
36+ run_solr5 () {
37+ dir_name=$1
38+ ./$dir_name /bin/solr -p $SOLR_PORT -h $SOLR_HOST
39+ wait_for_solr
40+ ./$dir_name /bin/solr create_core $SOLR_CORE -p $SOLR_PORT -h $SOLR_HOST
41+ echo " Started"
42+ }
43+
44+ download_and_run () {
45+ version=$1
46+ url=" http://archive.apache.org/dist/lucene/solr/${version} /solr-${version} .tgz"
47+ dir_name=" solr-${version} "
48+ download $url $dir_name
49+
50+ run_solr5 $dir_name
51+ }
52+
53+
54+
55+ download_and_run $SOLR_VERSION
You can’t perform that action at this time.
0 commit comments