Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F63791848
init-hbp-solr-home
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, May 22, 12:30
Size
1 KB
Mime Type
text/x-shellscript
Expires
Fri, May 24, 12:30 (2 d)
Engine
blob
Format
Raw Data
Handle
17819853
Attached To
rHBPLUCENESOLRDOCKER HBP Lucene/Solr Docker
init-hbp-solr-home
View Options
#!/bin/bash
#
# A helper script to initialise a custom SOLR_HOME.
# For example:
#
# mkdir mysolrhome
# sudo chown 8983:8983 mysolrhome
# docker run -it -v $PWD/mysolrhome:/mysolrhome -e SOLR_HOME=/mysolrhome -e INIT_SOLR_HOME=yes hbp-solr
#
set
-e
if
[[
"$VERBOSE"
=
"yes"
]]
;
then
set
-x
fi
# Normally SOLR_HOME is not set, and Solr will use /opt/solr/server/solr/
# If it's not set, then this script has no relevance.
if
[[
-z
$SOLR_HOME
]]
;
then
exit
fi
# require an explicit opt-in. Without this, you can use the SOLR_HOME and
# volumes, and configure it from the command-line or a docker-entrypoint-initdb.d
# script
if
[[
"$INIT_SOLR_HOME"
!
=
"yes"
]]
;
then
exit
fi
# check the directory exists.
if
[
! -d
"$SOLR_HOME"
]
;
then
echo
"SOLR_HOME $SOLR_HOME does not exist"
exit
1
fi
# check for existing Solr
if
[
-f
"$SOLR_HOME/solr.xml"
]
;
then
exit
fi
# refuse to use non-empty directories, which are likely a misconfiguration
if
[
"$(find "
$SOLR_HOME
" -mindepth 1 ! -name lost+found | wc -l)"
!
=
'0'
]
;
then
echo
"SOLR_HOME directory $SOLR_HOME is not empty; refusing to create a solr home."
exit
1
fi
# populate with default solr home contents
echo
"copying solr home contents to $SOLR_HOME"
cp -R /opt/hbp-lucene-solr/server/solr/*
"$SOLR_HOME"
Event Timeline
Log In to Comment