-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·48 lines (39 loc) · 1.46 KB
/
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
47
48
#!/bin/sh
set -e
# Load secrets as environment variables
for secret in /run/secrets/env_*; do
# Pattern matches with no results are treated as string literals.
# Verify that the file actually exists.
[ -f "$secret" ] || continue
set -a
. $secret
set +a
done
export SESSION_COOKIE_DOMAIN=$PUBLIC_HOST
export PUBLIC_URL=${PUBLIC_PROTOCOL}://${PUBLIC_HOST}
export GEOSERVER_PROXY_URL=${PUBLIC_URL}/geoserver/
# If the data directory doesn't exist, copy the one embedded in the WAR.
[ ! -e $GEOSERVER_DATA_DIR/global.xml ] && cp -r $WEBAPPS_DIR/geoserver/data/* /var/lib/geoserver/data/
# Remove the data directory embedded in the WAR.
rm -rf $WEBAPPS_DIR/geoserver/data
# Copy in the default styles.
mkdir -p $GEOSERVER_DATA_DIR/styles
cp /tmp/styles/* $GEOSERVER_DATA_DIR/styles/
# Copy in the geonode workspace.
mkdir -p $GEOSERVER_DATA_DIR/workspaces
cp -R /tmp/workspaces/* $GEOSERVER_DATA_DIR/workspaces/
touch $GEOSERVER_DATA_DIR/geofence/geofence-datasource-ovr.properties
touch $GEOSERVER_DATA_DIR/geofence/geofence.properties
# Process params
PARAMS=""
for i do # loop over $@
if [ "$i" = "--shell" ]; then
# Override the exec config and run a shell
PARAMS="$PARAMS --exec /bin/bash"
fi
done
cd /opt
# Resolve the template for the config file so that paths are correct
./consul-template -template "config.hcl:config-new.hcl" -once
# Resolve the rest of the templates and run tomcat
./consul-template -config config-new.hcl -once $PARAMS