-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
ol-docker-start.sh
executable file
·42 lines (31 loc) · 1.21 KB
/
ol-docker-start.sh
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
#!/bin/bash
# quick method to start all ol services from one script
# inside an container, bypass all upstart/services
CONFIG=conf/openlibrary-docker.yml
reindex-solr() {
server=$1
config=$2
for thing in books authors; do
psql openlibrary -t -c 'select key from thing' | sed 's/ *//' | grep "^/$thing/" \
| PYTHONPATH=$PWD xargs python openlibrary/solr/update_work.py -s $server -c $config --data-provider=legacy
done
}
echo "Starting ol services."
# TODO: why does nginx appear not necessary?
#echo "Starting nginx"
#service nginx restart
# postgres
su postgres -c "/etc/init.d/postgresql start"
# infobase
su openlibrary -c "scripts/infobase-server conf/infobase.yml 7000" &
# wait unit postgres is ready, then reindex solr
export -f reindex-solr
su openlibrary -c "until pg_isready; do sleep 5; done && reindex-solr localhost $CONFIG" &
# solr updater
su openlibrary -c "python scripts/new-solr-updater.py \
-c $CONFIG \
--state-file solr-update.offset \
--ol-url http://web/" &
# ol server, running in the foreground to avoid exiting container
su openlibrary -c "authbind --deep scripts/openlibrary-server $CONFIG \
--gunicorn --reload --workers 4 --timeout 180 --bind :80"