-
Notifications
You must be signed in to change notification settings - Fork 0
/
load-data
executable file
·80 lines (62 loc) · 2.3 KB
/
load-data
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
#
# Configure a Solr demo and then run solr in the foreground
set -euo pipefail
if [[ "${VERBOSE:-}" = "yes" ]]; then
set -x
fi
. /opt/docker-solr/scripts/run-initdb
# change to argument passed in through docker-compose.yml
CORE=${1:-awesometothecore}
CORE_DIR="${SOLR_HOME:-/opt/solr/server/solr}/${CORE}"
if [ -d "$CORE_DIR" ]; then
echo "$CORE_DIR exists; skipping core creation"
else
# start the solr for the first time to create the core directory and files on
# disk
start-local-solr
echo "Creating $CORE"
/opt/solr/bin/solr create -c "$CORE"
stop-local-solr
# copy config files in place
echo "Copy config files"
cp /opt/solr/managed-schema ${CORE_DIR}/conf/managed-schema
#cp /opt/solr/web.xml /opt/solr/server/solr-webapp/webapp/WEB-INF/web.xml
# start it up again with the new config files in place
start-local-solr
sleep 5 # to allow time for the solr serve to get up and running
/opt/solr/bin/post -c $CORE -commit yes /opt/solr/datafile.json
# stop solr again
stop-local-solr
# check the core_dir exists; otherwise the detecting above will fail after stop/start
if [ ! -d "$CORE_DIR" ]; then
echo "Missing $CORE_DIR"
exit 1
fi
fi
echo "Restart Solr with edited config files and data loaded!"
echo "Let's rock this thing!"
cat << "EOF"
_ ,-, _
,--, /: :\/': :`\/: :\
|`; ' `,' `.; `: |
| | | ' | |.
| R | O | C | K ||
| :. | : | : | : | \
\__/: :.. : :.. | :.. | )
`---',\___/,\___/ /'
`==._ .. . /'
`-::-'
EOF
#cd /opt/solr/server/etc
## get the local IP (docker container) to use in the self-signed SSL cert
#theIP=$(ip route get 1 | sed -n 's/^.*src \([0-9.]*\) .*$/\1/p')
#echo "Set up a local SSL cert"
#keytool -genkeypair -alias solr-ssl -keyalg RSA -keysize 2048 \
# -keypass HuckFinFan -storepass HuckFinFan \
# -validity 9999 -keystore /opt/solr/server/etc/solr-ssl.keystore.jks \
# -ext SAN=DNS:localhost,IP:127.0.0.1,IP:$theIP \
# -dname "CN=localhost, OU=Scholars' Lab, O=University of Virginia, L=Charlottesville, ST=VA, C=US"
#
#cp /opt/solr/solr.in.sh /opt/solr/bin/solr.in.sh
exec solr -f