-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·54 lines (39 loc) · 1.48 KB
/
Copy pathrun.sh
File metadata and controls
executable file
·54 lines (39 loc) · 1.48 KB
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
#!/bin/bash
prepare-pubby () {
set -e
pushd /pubby-prep > /dev/null
unzip -q pubby*.zip
cd pubby*
#enable Jetty service
sed -i 's/NO_START=1/NO_START=0/' /etc/default/jetty8
sed -i 's/#JETTY_HOST=.*$/JETTY_HOST="0.0.0.0"/' /etc/default/jetty8
sed -i 's/#AUTHBIND=.*$/AUTHBIND=yes/' /etc/default/jetty8
[ -z ${PORT+x} ] || sed -i "s/#JETTY_PORT=.*\$/JETTY_PORT=$PORT/" /etc/default/jetty8
echo 'generating Pubby configuration according to template and environment variables:'
env | grep -P '(STORE_SPARQL_ENDPOINT_URL)|(STORE_MAIN_GRAPH)|(PROJECT_NAME)|(PROJECT_HOMEPAGE)|(INDEX_RESOURCE)|(DATASET_BASE)|(WEB_BASE)|(PORT)'
python3 /pubby-prep/make-pubby-conf.py /pubby-prep/config.ttl.template webapp/WEB-INF/config.ttl
chmod a+r webapp/WEB-INF/config.ttl
echo 'deploying configured pubby as root context webapp for Jetty'
rm -rf /var/lib/jetty8/webapps/root/
cp -r webapp/ /var/lib/jetty8/webapps/root/
popd > /dev/null
set +o errexit
}
# allowing for clean shutdown of background jobs
cleanup () {
echo "stopping jetty..."
service jetty8 stop
[[ -n $tailpid ]] && kill -TERM "$tailpid"
exit 0
}
echo "preparing pubby web context"
prepare-pubby
trap 'cleanup' INT TERM
echo "starting jetty..."
# hiding output from start script for now, as it reports a failure although the server is starting o.k.
service jetty8 start > /dev/null
touch /var/log/jetty8/out.log
echo "starting to tail logs..."
tail -fn10000 /var/log/jetty8/*.log &
tailpid=$!
wait $tailpid