-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathstartup.sh
executable file
·496 lines (424 loc) · 19.8 KB
/
startup.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
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
#!/usr/bin/env bash
set -e
#
# To see the logs this script generated during the startup use
# sudo journalctl -u google-startup-scripts.service
#
################ Input variables. Only DATA_DIR is required
if [[ -z "${DATA_DIR}" ]]; then
echo "Must set DATA_DIR before running this script"
exit 1
fi
# DEBUG (true/false) . Set to any non-empty string except "false" to run in debug mode:
# - disable https
# - do not detach from docker-compose until ctrl+C (stop all)
# - print all logs
if [[ "${DEBUG}" = "false" ]]; then
DEBUG=""
fi
# Optional location of the temporary files.
: "${TEMP_DIR:=}"
# Domain of this service
: "${SOPHOX_HOST:=sophox.org}"
# Sophox GIT repository clone - directory, git url, git branch
# Set REPO_URL to "-" to prevent automatic git clone
: "${REPO_DIR:=${DATA_DIR}/git-repo}"
: "${REPO_URL:=https://github.com/Sophox/sophox.git}"
: "${REPO_BRANCH:=main}"
# Which OSM dump file to download, what to save it as, and the optional URL of the md5 hash (use '-' to skip)
: "${IS_FULL_PLANET:=false}"
: "${OSM_FILE:=belize-latest.osm.pbf}"
: "${OSM_FILE_REGION:=central-america}"
: "${OSM_FILE_URL:=http://download.geofabrik.de/${OSM_FILE_REGION}/${OSM_FILE}}"
: "${OSM_FILE_MD5_URL:=${OSM_FILE_URL}.md5}"
# IS_FULL_PLANET (true/false) optimizes node storage. Set to "false" or empty for smaller imports.
# Defaults to "false"
if [[ "${IS_FULL_PLANET}" = "false" ]]; then
IS_FULL_PLANET=""
fi
# number of days to go back from today to backfill after the dump file
: "${SHAPES_BACKFILL_DAYS:=7}"
# Optionally override maximum memory (e.g. this is needed when testing on a Mac without `free` util)
: "${MAX_MEMORY_MB:=}"
# Percentage (integer) of the total memory to be used by Sophox, e.g. 80 for 80% of the total RAM
# This param is not used if MAX_MEMORY_MB is set.
: "${TOTAL_MEMORY_PRCNT:=30}"
# Number of hours (1hr per file) to download at once from the Wikipedia pageviews statistics service
# This number also affects how far back from "now" it will back-fill
#
: "${PAGEVIEW_HR_FILES:=24}"
# To disable any of these, set it to an empty value
: "${ENABLE_IMPORT_OSM2PGSQL=true}"
: "${ENABLE_IMPORT_OSM2RDF=true}"
: "${ENABLE_IMPORT_PAGEVIEWS=true}"
: "${ENABLE_SVC_PROXY=true}"
: "${ENABLE_SVC_GUI=true}"
: "${ENABLE_SVC_MISC=true}"
: "${ENABLE_UPDATE_METADATA=true}"
: "${ENABLE_UPDATE_OSM2PGSQL=true}"
: "${ENABLE_UPDATE_OSM2RDF=true}"
: "${ENABLE_UPDATE_PAGEVIEWS=true}"
: "${ENABLE_UPDATE_USAGESTATS=true}"
: "${ENABLE_UPDATE_MAINTAIN=true}"
: "${ENABLE_UPDATE_RELLOC=true}"
# If DEBUG env is not set, run docker compose in the detached (service) mode
DETACH_DOCKER_COMPOSE=$( [[ "${DEBUG}" == "" ]] && echo "true" || echo "" )
############## NO USER-SERVICEABLE VARIABLES BEYOND THIS POINT :)
# Print parameters:
echo "DATA_DIR='${DATA_DIR}'"
echo "TEMP_DIR='${TEMP_DIR}'"
echo "SOPHOX_HOST='${SOPHOX_HOST}'"
echo "REPO_DIR='${REPO_DIR}'"
echo "REPO_URL='${REPO_URL}'"
echo "REPO_BRANCH='${REPO_BRANCH}'"
echo "OSM_FILE='${OSM_FILE}'"
echo "OSM_FILE_URL='${OSM_FILE_URL}'"
echo "OSM_FILE_MD5_URL='${OSM_FILE_MD5_URL}'"
echo "SHAPES_BACKFILL_DAYS='${SHAPES_BACKFILL_DAYS}'"
echo "TOTAL_MEMORY_PRCNT='${TOTAL_MEMORY_PRCNT}'"
echo "IS_FULL_PLANET='${IS_FULL_PLANET}'"
echo "DEBUG='${DEBUG}'"
############## Ensure required utilities are installed
function is_installed {
if ! command -v "$1" &> /dev/null; then
echo "$1 could not be found, aborting"
exit 1
fi
}
is_installed docker
is_installed curl
############## Setup internal vars
# RUN_PROD_MODE will become "true" once all the imports are done
RUN_PROD_MODE=
STATUS_DIR=${DATA_DIR}/status
mkdir -p "${STATUS_DIR}"
ACME_FILE=${DATA_DIR}/acme.json
POSTGRES_PASSWORD_FILE=${DATA_DIR}/postgres_password
POSTGRES_DATA_DIR=${DATA_DIR}/postgres
# Ideally download should go to the temp, but it might not fit together with Blazegraph in 375GB
# DOWNLOAD_DIR=${TEMP_DIR:-$DATA_DIR}/download
DOWNLOAD_DIR=${DATA_DIR}/download
OSM_PGSQL_DATA_DIR=${DATA_DIR}/osm-pgsql
OSM_RDF_DATA_DIR=${DATA_DIR}/osm-rdf
OSM_TTLS_DIR=${DATA_DIR}/osm-rdf-ttls
BLAZEGRAPH_URL=http://blazegraph:9999/bigdata/namespace/wdq/sparql
WB_CONCEPT_URI="http://wiki.openstreetmap.org"
BLAZEGRAPH_IMAGE=openjdk:8-jdk
# If DEBUG env is not set, run docker compose in the detached (service) mode
DETACH_DOCKER_COMPOSE=$( [[ "${DEBUG}" == "" ]] && echo "true" || echo "" )
# Do not use https redirect and Let's Encrypt certs when debugging
TRAEFIK_FILE=$( [[ "${DEBUG}" == "" ]] && echo "${REPO_DIR}/docker/traefik.toml" || echo "${REPO_DIR}/docker/traefik.debug.toml" )
TRAEFIK_HOST=$( [[ "${DEBUG}" == "" ]] && echo "0.0.0.0" || echo "127.0.0.1" )
# Get total system memory, reducing it by some optional percentage, in MB
if [[ -z "${MAX_MEMORY_MB}" ]]; then
# TODO: support Mac
TOTAL_MEMORY_KB=$(free | awk '/^Mem:/{print $2}')
MAX_MEMORY_MB=$(( TOTAL_MEMORY_KB * TOTAL_MEMORY_PRCNT / 100 / 1024 ))
fi
echo "MAX_MEMORY_MB='${MAX_MEMORY_MB}'"
# WORKERS = 1..4, per each ~25GB of the total
OSM_RDF_WORKERS=$(( MAX_MEMORY_MB / 25000 + 1 ))
OSM_RDF_WORKERS=$(( OSM_RDF_WORKERS < 1 ? 1 : ( OSM_RDF_WORKERS > 4 ? 4 : OSM_RDF_WORKERS ) ))
# MEM = 40000 MB ~~ max statements = 10000 / workers count
OSM_RDF_MAX_STMTS=$(( MAX_MEMORY_MB / 4 / OSM_RDF_WORKERS ))
# Blazegraph - full should be maxed at 16g, partial can be maxed at 2g
if [[ -n "${IS_FULL_PLANET}" ]]; then
echo "### Optimizing for full planet import"
MEM_BLAZEGRAPH_MB=$(( 1024 * 12 ))
else
echo "### Optimizing for a small OSM file import"
MEM_BLAZEGRAPH_MB=$(( 1024 * 3 / 2 ))
fi
MEM_BLAZEGRAPH_MB=$(( MAX_MEMORY_MB / 2 > MEM_BLAZEGRAPH_MB ? MEM_BLAZEGRAPH_MB : MAX_MEMORY_MB / 2 ))
# In case there is a local SSD, use it as the temp storage, otherwise use data dir.
OSM_PGSQL_TEMP_DIR=$( [[ "${TEMP_DIR}" == "" ]] && echo "${OSM_PGSQL_DATA_DIR}" || echo "${TEMP_DIR}/osm-pgsql-tmp" )
OSM_RDF_TEMP_DIR=$( [[ "${TEMP_DIR}" == "" ]] && echo "${OSM_RDF_DATA_DIR}" || echo "${TEMP_DIR}/osm-rdf-tmp" )
# Use local SSD for faster Blazegraph import - will be moved to data dir after the import
BLAZEGRAPH_TEMP_DIR="${TEMP_DIR:-$DATA_DIR}/blazegraph-data"
BLAZEGRAPH_DATA_DIR="${DATA_DIR}/blazegraph-data"
if [[ "${BLAZEGRAPH_TEMP_DIR}" != "${BLAZEGRAPH_DATA_DIR}" \
&& -f "${STATUS_DIR}/osm-rdf.imported" \
&& -f "${BLAZEGRAPH_DATA_DIR}/osmdata.jnl" ]]; then
echo "Using Blazegraph data at ${BLAZEGRAPH_DATA_DIR}/osmdata.jnl"
BLAZEGRAPH_TEMP_DIR="${BLAZEGRAPH_DATA_DIR}"
fi
#
# ##################### Clone/update GIT repo
#
if [[ "${REPO_URL}" = "-" ]]; then
echo "REPO_URL is not set, skipping git clone/update"
else
if [[ ! -d "${REPO_DIR}" ]]; then
echo "########### Cloning git repo ${REPO_URL} #${REPO_BRANCH} to ${REPO_DIR}"
git clone -b "${REPO_BRANCH}" --recurse-submodules -j4 "${REPO_URL}" "${REPO_DIR}"
fi
if [[ ! -d "${REPO_DIR}/.git" ]]; then
echo "ERROR: ${REPO_DIR} has no .git directory"
exit 1
fi
cd "${REPO_DIR}"
if git diff-files --quiet; then
echo "git pull and submodule update from ${REPO_URL} in ${REPO_DIR}"
set -x
git pull
git submodule update --init --recursive
{ set +x; } 2>/dev/null
else
echo "git repo ${REPO_DIR} has local changes, update skipped"
git status
fi
fi
#
# ##################### Initialize needed files if they do not exist
#
# File for the Let's encrypt certificate
if [[ ! -f "${ACME_FILE}" ]]; then
echo "########### Creating ${ACME_FILE}"
touch "${ACME_FILE}"
chmod 600 "${ACME_FILE}"
fi
# Generate a random Postgres password
if [[ ! -f "${POSTGRES_PASSWORD_FILE}" ]]; then
echo "########### Creating ${POSTGRES_PASSWORD_FILE}"
openssl rand -base64 15 | head -c 12 > "${POSTGRES_PASSWORD_FILE}"
chmod 400 "${POSTGRES_PASSWORD_FILE}"
fi
POSTGRES_PASSWORD=$(<"${POSTGRES_PASSWORD_FILE}")
export POSTGRES_PASSWORD
#
# ##################### Download OSM data
#
# Download the latest OpenStreetMap data if it doesn't exist.
# Interrupted downloads are continued.
# TODO curl bug returns FTP transient problem if file already exists.
# See https://github.com/curl/curl/issues/2464
mkdir -p "${DOWNLOAD_DIR}"
FLAG_DOWNLOADED="${STATUS_DIR}/osm_data.downloaded"
if [[ ! -f "${FLAG_DOWNLOADED}" ]]; then
echo "########### Downloading ${OSM_FILE}"
# md5 file should be downloaded before the much slower data file to reduce chances of a race condition
if [[ "${OSM_FILE_MD5_URL}" != "-" ]]; then
curl --fail --silent --show-error --location --compressed \
"${OSM_FILE_MD5_URL}" \
--output "${DOWNLOAD_DIR}/${OSM_FILE}.md5"
fi
set -x
curl --fail --silent --show-error --location --compressed \
"${OSM_FILE_URL}" \
--output "${DOWNLOAD_DIR}/${OSM_FILE}"
{ set +x; } 2>/dev/null
if [[ "${OSM_FILE_MD5_URL}" != "-" ]]; then
pushd "${DOWNLOAD_DIR}" > /dev/null
echo "########### Validating ${OSM_FILE} md5 hash"
if which md5sum; then
set -x
md5sum --check "${DOWNLOAD_DIR}/${OSM_FILE}.md5"
{ set +x; } 2>/dev/null
else
echo "WARNING: You do not have md5sum installed, unable to verify md5 hash"
fi
popd > /dev/null
fi
touch "${FLAG_DOWNLOADED}"
fi
# Create a state file with the sync start time. The state file is generated for N weeks prior to now
# in order not to miss any data changes. Since the planet dump is weekly and we generate this
# file when we download the planet-latest.osm.pbf file, we should not miss any changes.
mkdir -p "${OSM_PGSQL_DATA_DIR}"
if [[ ! -f "${OSM_PGSQL_DATA_DIR}/state.txt" ]]; then
echo "########### Initializing ${OSM_PGSQL_DATA_DIR} state files ###########"
cp "${REPO_DIR}/docker/osmosis_configuration.txt" "${OSM_PGSQL_DATA_DIR}/configuration.txt"
touch "${OSM_PGSQL_DATA_DIR}/download.lock"
# Current date minus N days
start_date=$(( $(date +%s) - SHAPES_BACKFILL_DAYS*24*60*60 ))
if [[ "$(uname -s)" = "Darwin" ]]; then
start_date_fmt=$(date -u -r "${start_date}" +"%Y-%m-%dT00:00:00Z")
else
start_date_fmt=$(date --utc --date="@${start_date}" +"%Y-%m-%dT00:00:00Z")
fi
set -x
curl --fail --silent --show-error --location --compressed \
"https://replicate-sequences.osm.mazdermind.de/?${start_date_fmt}" \
--output "${OSM_PGSQL_DATA_DIR}/state.txt"
{ set +x; } 2>/dev/null
fi
#
# ##################### DB functions
#
function wait_for {
# first param is the container name
# the rest of params is a single command plus parameters to test if the service is ready
local name=$1
local id
echo "Waiting for ${name} to start"
while true; do
id=$(docker ps "--filter=label=com.docker.compose.service=${name}" --quiet)
if [[ -z $id ]]; then
echo "Unable to find docker service '${name}'"
exit 1
fi
if docker exec "${id}" "${@:2}" > /dev/null ; then
break
fi
echo "${name} ${id} is still busy..."
sleep 5
done
}
function stop_service {
local name=$1
local id
echo "Stopping ${name}..."
id=$(docker ps "--filter=label=com.docker.compose.service=${name}" --quiet)
if [[ -z $id ]]; then
echo "Unable to find docker service '${name}'"
exit 1
fi
docker stop "${id}" > /dev/null
docker rm "${id}" > /dev/null
}
function start_dbs {
set -x
docker run --rm \
-e "BLAZEGRAPH_DATA_DIR=${BLAZEGRAPH_TEMP_DIR}" \
-e "BLAZEGRAPH_IMAGE=${BLAZEGRAPH_IMAGE}" \
-e "MEM_BLAZE_HEAP_MB=${MEM_BLAZEGRAPH_MB}" \
-e "MEM_BLAZE_LIMIT_MB=$(( MAX_MEMORY_MB * 70 / 100 ))" \
-e "MEM_PG_MAINTENANCE_MB=$(( MAX_MEMORY_MB * 20 / 100 ))" \
-e "MEM_PG_SHARED_BUFFERS_MB=$(( MAX_MEMORY_MB * 15 / 100 ))" \
-e "MEM_PG_WORK_MB=$(( MAX_MEMORY_MB * 5 / 100 ))" \
-e "OSM_TTLS_DIR=${OSM_TTLS_DIR}" \
-e "POSTGRES_DATA_DIR=${POSTGRES_DATA_DIR}" \
-e "SOPHOX_HOST=${SOPHOX_HOST}" \
-e "WB_CONCEPT_URI=${WB_CONCEPT_URI}" \
-e POSTGRES_PASSWORD \
\
-v "${REPO_DIR}:/git_repo" \
-v /var/run/docker.sock:/var/run/docker.sock \
\
docker/compose:1.23.1 \
--file /git_repo/docker/dc-db-blazegraph.yml \
${RUN_PROD_MODE:+ --file /git_repo/docker/dc-db-blazegraph-prod.yml} \
--file /git_repo/docker/dc-db-postgres.yml \
${RUN_PROD_MODE:+ --file /git_repo/docker/dc-db-postgres-prod.yml} \
--project-name sophox \
up --detach
{ set +x; } 2>/dev/null
wait_for blazegraph curl --fail --silent http://127.0.0.1:9999/bigdata/status
wait_for postgres pg_isready --dbname=gis --quiet
sleep 2 # just in case :)
}
#
# ##################### Run docker-compose from a docker container
#
echo "########### Starting Services"
NETWORK_NAME=proxy_net
if [[ -z $(docker network ls --filter "name=^${NETWORK_NAME}$" --format="{{ .Name }}") ]] ; then
docker network create "${NETWORK_NAME}"
fi
start_dbs
echo "########### Starting Importers"
if [[ -n "${ENABLE_IMPORT_OSM2PGSQL}" || -n "${ENABLE_IMPORT_OSM2RDF}" || -n "${ENABLE_IMPORT_PAGEVIEWS}" ]]; then
set -x
docker run --rm \
-e "BLAZEGRAPH_URL=${BLAZEGRAPH_URL}" \
-e "BUILD_DIR=/git_repo" \
-e "DOWNLOAD_DIR=${DOWNLOAD_DIR}" \
-e "IS_FULL_PLANET=${IS_FULL_PLANET}" \
-e "MEM_OSM_PGSQL_IMPORT_MB=$(( MAX_MEMORY_MB * 20 / 100 ))" \
-e "MEM_OSM_RDF_LIMIT_MB=$(( MAX_MEMORY_MB * 70 / 100 ))" \
-e "OSM_FILE=${OSM_FILE}" \
-e "OSM_PGSQL_DATA_DIR=${OSM_PGSQL_DATA_DIR}" \
-e "OSM_PGSQL_TEMP_DIR=${OSM_PGSQL_TEMP_DIR}" \
-e "OSM_RDF_DATA_DIR=${OSM_RDF_DATA_DIR}" \
-e "OSM_RDF_MAX_STMTS=${OSM_RDF_MAX_STMTS}" \
-e "OSM_RDF_TEMP_DIR=${OSM_RDF_TEMP_DIR}" \
-e "OSM_RDF_WORKERS=${OSM_RDF_WORKERS}" \
-e "OSM_TTLS_DIR=${OSM_TTLS_DIR}" \
-e "PAGEVIEW_HR_FILES=${PAGEVIEW_HR_FILES}" \
-e "REPO_DIR=${REPO_DIR}" \
-e "STATUS_DIR=${STATUS_DIR}" \
-e POSTGRES_PASSWORD \
\
-v "${REPO_DIR}:/git_repo" \
-v /var/run/docker.sock:/var/run/docker.sock \
\
docker/compose:1.23.1 \
${ENABLE_IMPORT_OSM2PGSQL:+ --file /git_repo/docker/dc-importers-osm2pgsql.yml} \
${ENABLE_IMPORT_OSM2RDF:+ --file /git_repo/docker/dc-importers-osm2rdf.yml} \
${ENABLE_IMPORT_PAGEVIEWS:+ --file /git_repo/docker/dc-importers-pageviews.yml} \
--project-name sophox \
up
{ set +x; } 2>/dev/null
else
echo "All import services have been disabled, skipping"
fi
# Once all status flag files are created, delete downloaded OSM file
if [[ -f "${DOWNLOAD_DIR}/${OSM_FILE}" ]]; then
if ls "${STATUS_DIR}/osm-rdf.parsed" "${STATUS_DIR}/osm-pgsql.imported" > /dev/null 2>&1 ; then
echo "Deleting ${DOWNLOAD_DIR}/${OSM_FILE}"
rm "${DOWNLOAD_DIR}/${OSM_FILE}"
fi
fi
RUN_PROD_MODE=true
stop_service "blazegraph"
stop_service "postgres"
# Move blazegraph from temp to prod if needed
if [[ "${BLAZEGRAPH_TEMP_DIR}" != "${BLAZEGRAPH_DATA_DIR}" \
&& -f "${STATUS_DIR}/osm-rdf.imported" \
&& -f "${BLAZEGRAPH_TEMP_DIR}/osmdata.jnl" ]]; then
echo "########### Moving Blazegraph data ${BLAZEGRAPH_TEMP_DIR} --> ${BLAZEGRAPH_DATA_DIR}"
if [[ -f "${BLAZEGRAPH_DATA_DIR}/osmdata.jnl" ]]; then
echo "ERROR: File ${BLAZEGRAPH_DATA_DIR}/osmdata.jnl already exists. Aborting."
exit 1
fi
mkdir -p "${BLAZEGRAPH_DATA_DIR}"
echo "Moving jnl file..."
mv "${BLAZEGRAPH_TEMP_DIR}/osmdata.jnl" "${BLAZEGRAPH_DATA_DIR}"
BLAZEGRAPH_TEMP_DIR="${BLAZEGRAPH_DATA_DIR}"
fi
echo "Restarting Databases..."
start_dbs
echo "########### Starting Updaters"
if [[ -n "${ENABLE_SVC_PROXY}" || -n "${ENABLE_SVC_GUI}" || -n "${ENABLE_SVC_MISC}" || -n "${ENABLE_UPDATE_METADATA}" || \
-n "${ENABLE_UPDATE_OSM2PGSQL}" || -n "${ENABLE_UPDATE_OSM2RDF}" || -n "${ENABLE_UPDATE_PAGEVIEWS}" || \
-n "${ENABLE_UPDATE_USAGESTATS}" || -n "${ENABLE_UPDATE_MAINTAIN}" || -n "${ENABLE_UPDATE_RELLOC}" ]]; then
set -x
docker run --rm \
-e "ACME_FILE=${ACME_FILE}" \
-e "BLAZEGRAPH_IMAGE=${BLAZEGRAPH_IMAGE}" \
-e "BLAZEGRAPH_URL=${BLAZEGRAPH_URL}" \
-e "BUILD_DIR=/git_repo" \
-e "IS_FULL_PLANET=${IS_FULL_PLANET}" \
-e "MEM_OSM_PGSQL_UPDATE_MB=$(( MAX_MEMORY_MB * 5 / 100 ))" \
-e "OSM_PGSQL_DATA_DIR=${OSM_PGSQL_DATA_DIR}" \
-e "OSM_RDF_DATA_DIR=${OSM_RDF_DATA_DIR}" \
-e "REPO_DIR=${REPO_DIR}" \
-e "SOPHOX_HOST=${SOPHOX_HOST}" \
-e "STATUS_DIR=${STATUS_DIR}" \
-e "TRAEFIK_FILE=${TRAEFIK_FILE}" \
-e "TRAEFIK_HOST=${TRAEFIK_HOST}" \
-e "WB_CONCEPT_URI=${WB_CONCEPT_URI}" \
-e POSTGRES_PASSWORD \
\
-v "${REPO_DIR}:/git_repo" \
-v /var/run/docker.sock:/var/run/docker.sock \
\
docker/compose:1.23.1 \
${ENABLE_SVC_PROXY:+ --file /git_repo/docker/dc-service-proxy.yml} \
${ENABLE_SVC_GUI:+ --file /git_repo/docker/dc-service-gui.yml} \
${ENABLE_SVC_MISC:+ --file /git_repo/docker/dc-services.yml} \
${ENABLE_UPDATE_METADATA:+ --file /git_repo/docker/dc-updaters-metadata.yml} \
${ENABLE_UPDATE_OSM2PGSQL:+ --file /git_repo/docker/dc-updaters-osm2pgsql.yml} \
${ENABLE_UPDATE_OSM2RDF:+ --file /git_repo/docker/dc-updaters-osm2rdf.yml} \
${ENABLE_UPDATE_PAGEVIEWS:+ --file /git_repo/docker/dc-updaters-pageviews.yml} \
${ENABLE_UPDATE_USAGESTATS:+ --file /git_repo/docker/dc-updaters-usagestats.yml} \
${ENABLE_UPDATE_MAINTAIN:+ --file /git_repo/docker/dc-updaters-maintain.yml} \
${ENABLE_UPDATE_RELLOC:+ --file /git_repo/docker/dc-updaters-relloc.yml} \
--project-name sophox \
up \
${DETACH_DOCKER_COMPOSE:+ --detach}
{ set +x; } 2>/dev/null
else
echo "All updates have been disabled, skipping"
fi
echo "########### Startup is done, exiting"