-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-entrypoint.sh.in
executable file
·155 lines (145 loc) · 3.42 KB
/
docker-entrypoint.sh.in
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#!/bin/bash
set -e
if [ -r "$POSTGRES_PASSWORD_FILE" ]; then
POSTGRES_PASSWORD=$(cat ${POSTGRES_PASSWORD_FILE})
fi
if [ -r "$TRIP_SIGNING_KEY_FILE" ];then
TRIP_SIGNING_KEY=$(cat ${TRIP_SIGNING_KEY_FILE})
fi
if [ -r "$TRIP_RESOURCE_SIGNING_KEY_FILE" ];then
TRIP_RESOURCE_SIGNING_KEY=$(cat ${TRIP_RESOURCE_SIGNING_KEY_FILE})
fi
umask 0026
cat > trip-server.yaml <<EOF
app:
json:
indent:
level: 0
gpx:
allowInvalidXsd: false
autoQuit:
timeOut: 0
token:
expiresIn: 43200
renewWithin: 21600
resourceToken:
expiresIn: 86400
maxItinerarySearchRadius: 50000
averageFlatSpeedKph: 4
jwt:
EOF
echo " signingKey: \"${TRIP_SIGNING_KEY}\"" >> trip-server.yaml
echo " resourceSigningKey: \"${TRIP_RESOURCE_SIGNING_KEY}\"" >> trip-server.yaml
if [ "$CONFIGURE_TILE_SERVER" == "yes" ];
then
cat >>trip-server.yaml <<EOF
tile:
cache:
maxAge: 0
providers:
- cache: false
prune: false
# see http://wiki.openstreetmap.org/wiki/Tile_usage_policy"
userAgentInfo: (mailto:support@fdsd.co.uk)
refererInfo: https://www.fdsd.co.uk/trip/about.html
options:
protocol: "http:"
host: map
port: "80"
path: /tile/{z}/{x}/{y}.png
method: GET
mapLayer:
name: Switch2OSM
type: xyz
minZoom: 0
maxZoom: 19
tileAttributions:
- text: "Map data © "
- text: OpenStreetMap
link: http://openstreetmap.org
- text: " contributors, "
- text: CC-BY-SA
link: http://creativecommons.org/licenses/by-sa/2.0/
EOF
else
cat >>trip-server.yaml <<EOF
tile:
cache:
maxAge: 0
providers_READ_TILE_USAGE_POLICY_BELOW_AND_SET_USER_AGENT_AND_REFERRER_INFO_BEFORE_USING:
- help: " see http://wiki.openstreetmap.org/wiki/Tile_usage_policy"
userAgentInfo: (mailto:your.contact@email.address)
refererInfo: http://link_to_deployed_application_information
options:
protocol: "http:"
host: tile.openstreetmap.org
port: "80"
path: /{z}/{x}/{y}.png
method: GET
mapLayer:
name: OSM Mapnik
type: xyz
tileAttributions:
- text: "Map data © "
- text: OpenStreetMap
link: http://openstreetmap.org
- text: " contributors, "
- text: CC-BY-SA
link: http://creativecommons.org/licenses/by-sa/2.0/
EOF
fi
cat >>trip-server.yaml <<EOF
db:
EOF
echo " uri: postgresql://trip:${POSTGRES_PASSWORD}@postgis/trip" >>trip-server.yaml
cat >>trip-server.yaml <<EOF
poolSize: 10
poolIdleTimeout: 10000
connectionTimeoutMillis: 0
elevation:
tileCacheMs: 60000
datasetDir: /elevation-data
elevation-remote-disabled:
provider:
userAgentInfo: (mailto:your.contact@email.address)
refererInfo: http://link_to_deployed_application_information
options:
protocol: "http:"
host: localhost
port: "8082"
path: /api/v1/lookup
method: POST
staticFiles:
allow: true
debug: false
log:
level: info
validation:
headers:
contentType:
warn: true
reporting:
metrics:
tile:
count:
frequency: 100
EOF
# When running a development environment
if [ -f /webapp/package.json ]
then
DIR=$(pwd)
cd /webapp
yarn
cd /app-server
if [ ! -L /webapp/app ]
then
if [ -e app ]
then
rm -rf app
fi
ln -s /webapp/app
fi
cd "$DIR"
fi
trip-server --upgrade
exec "$@"