forked from GaborWnuk/docker-usergrid
-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.sh
46 lines (33 loc) · 986 Bytes
/
run.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
42
43
44
45
46
#!/bin/bash
#
# Based on https://github.com/tutumcloud/tutum-docker-tomcat
#
echo "Adding ROOT.war to /usergrid"
pushd /usergrid/ROOT
jar xvf ./ROOT.war
rm ROOT.war
jar -xf ./WEB-INF/lib/usergrid-config-1.0.0.jar
# make changes
if [[ ! -z "$CASSANDRA_URL" ]]; then
echo "Setting Cassandra host"
sed -i "s/cassandra.url=.*/cassandra.url=$CASSANDRA_URL/g" ./usergrid-default.properties
fi
# make jar of updated usergrid properties
jar cf usergrid-config-1.0.0.jar usergrid-default.properties
cp usergrid-config-1.0.0.jar ./WEB-INF/lib/
rm usergrid-config-1.0.0.jar usergrid-default.properties
# make war
echo "Making ROOT.war"
jar -cvf ROOT.war .
mv ROOT.war ../
cd ../
rm -R ROOT/*
rmdir ROOT
echo "Adding ROOT.war to tomcat webapps"
cp ROOT.war /usr/share/tomcat7/webapps
popd
ln -s /usr/share/tomcat7/webapps/ /etc/tomcat7/webapps
if [ ! -f ${TOMCAT_CONFIGURATION_FLAG} ]; then
/usergrid/create_tomcat_admin_user.sh
fi
exec /usr/share/tomcat7/bin/catalina.sh run