forked from wiktorn/Overpass-API
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-entrypoint.sh
executable file
·36 lines (32 loc) · 1.28 KB
/
docker-entrypoint.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
#!/bin/bash
set -eo pipefail
shopt -s nullglob
OVERPASS_META=${OVERPASS_META:-no}
OVERPASS_MODE=${OVERPASS_MODE:-clone}
OVERPASS_COMPRESSION=${OVERPASS_COMPRESSION:-gz}
if [ ! -d /db/db ] ; then
if [ "$OVERPASS_MODE" = "clone" ]; then
if [[ "$OVERPASS_META" == "attic" ]] ; then
META="--keep-attic"
else
META="--meta=$OVERPASS_META"
fi
mkdir -p /db/db \
&& /app/bin/download_clone.sh --db-dir=/db/db --source=http://dev.overpass-api.de/api_drolbr/ $META \
&& cp -r /app/etc/rules /db/db \
&& chown -R overpass:overpass /db \
&& echo "Overpass ready, you can start your container with docker start"
exit
fi
if [ "$OVERPASS_MODE" = "init" ]; then
lftp -c "get -c \"$OVERPASS_PLANET_URL\" -o /db/planet; exit" \
&& /app/bin/init_osm3s.sh /db/planet /db/db /app "--meta=$OVERPASS_META" "--compression-method=$OVERPASS_COMPRESSION" \
&& echo $OVERPASS_PLANET_SEQUENCE_ID > /db/db/replicate_id \
&& rm /db/planet \
&& cp -r /app/etc/rules /db/db \
&& chown -R overpass:overpass /db \
&& echo "Overpass ready, you can start your container with docker start"
exit
fi
fi
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf