Skip to content

Commit e486fdc

Browse files
move solr monitoring into dlc script
1 parent fbe8470 commit e486fdc

File tree

5 files changed

+41
-38
lines changed

5 files changed

+41
-38
lines changed

bin/dlc

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,43 @@ echo "starting tunneled solr prod in background"
88
ssh -L 8983:ldpd-solr-prod1.cul.columbia.edu:8983 -C -N [email protected] &
99
echo $! > ./tmp/ssh_tunnel.pid
1010

11-
bin/solr_monitor.sh &
11+
# (bin/solr_monitor.sh </dev/null > /dev/tty 2>/dev/tty) &
12+
MONITOR_FILE="./tmp/shutdown_tunnel_signal"
13+
PID_FILE="./tmp/ssh_tunnel.pid"
14+
15+
if [ -f "$PID_FILE" ]; then
16+
TUNNEL_PID=$(cat "$PID_FILE")
17+
echo "Solr monitor read PID from $PID_FILE: $TUNNEL_PID"
18+
else
19+
echo "Solr monitor PID file $PID_FILE not found. Monitor exiting."
20+
exit 1
21+
fi
22+
1223

1324
echo "Running docker compose up"
14-
docker compose up
25+
docker compose up --exit-code-from dlc
26+
container_id=$(docker ps -aqf "name=dlc")
27+
exit_code=$(docker inspect $container_id --format='{{.State.ExitCode}}')
28+
29+
if [ $exit_code -ne 0 ]; then
30+
echo "Sending signal to shut down solr tunnel"
31+
echo "SHUTDOWN TUNNEL" > ./tmp/shutdown_tunnel_signal;
32+
fi
33+
34+
while true; do
35+
if [ -f "$MONITOR_FILE" ]; then
36+
echo "Signal file detected. Killing tunnel process with PID $TUNNEL_PID..."
37+
38+
if kill "$TUNNEL_PID"; then
39+
echo "Tunnel process killed successfully."
40+
else
41+
echo "Failed to kill tunnel process or process not found."
42+
fi
43+
44+
rm -f "$MONITOR_FILE"
45+
rm -f "$PID_FILE"
46+
47+
exit 0
48+
fi
49+
sleep 1
50+
done

bin/setup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ FileUtils.chdir APP_ROOT do
1818
system('bundle check') || system!('bundle install')
1919

2020
# Install JavaScript dependencies
21-
# system('bin/yarn')
21+
system!("bin/yarn")
2222

2323
# puts "\n== Copying sample files =="
2424
# unless File.exist?('config/database.yml')

bin/solr_monitor.sh

Lines changed: 0 additions & 33 deletions
This file was deleted.

config/templates/blacklight.template.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ development:
66
adapter: solr
77
timeout: 120
88
test:
9-
url: http://localhost:9983/solr/dlc
9+
url: http://localhost:9983/solr/dcv
1010
adapter: solr
1111
timeout: 120

config/templates/solr.template.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ development:
22
url: http://localhost:8983/solr/dlc
33
timeout: 120
44
test:
5-
url: http://localhost:9983/solr/dlc
5+
url: http://localhost:9983/solr/dcv
66
timeout: 120

0 commit comments

Comments
 (0)