@@ -674,10 +674,15 @@ build_valhalla() {
674674 log " Building Valhalla routing tiles..."
675675 fi
676676
677- docker compose -f " $COMPOSE_FILE " \
678- run --rm --no-deps valhalla \
679- valhalla_build_tiles -c /custom_files/valhalla.json /custom_files/* .osm.pbf
680- ok " Valhalla build complete"
677+ log " Valhalla auto-builds tiles on startup when PBF files are present."
678+ log " Starting the container (set use_tiles_ignore_pbf=False to force rebuild)..."
679+ if ! docker compose -f " $COMPOSE_FILE " --profile routing up -d valhalla; then
680+ err " Failed to start Valhalla container"
681+ return 1
682+ fi
683+ log " Valhalla is building in the background."
684+ log " Monitor progress with: docker compose logs -f valhalla"
685+ ok " Valhalla container started (building tiles)"
681686}
682687
683688build_osrm () {
@@ -693,7 +698,10 @@ build_osrm() {
693698 fi
694699
695700 log " Building OSRM routing data..."
696- docker compose -f " $COMPOSE_FILE " run --rm osrm-build
701+ if ! docker compose -f " $COMPOSE_FILE " run --rm osrm-build; then
702+ err " OSRM build failed"
703+ return 1
704+ fi
697705 ok " OSRM build complete"
698706}
699707
@@ -714,7 +722,10 @@ build_otp() {
714722 fi
715723
716724 log " Building OTP transit graph..."
717- docker compose -f " $COMPOSE_FILE " run --rm otp-build
725+ if ! docker compose -f " $COMPOSE_FILE " run --rm otp-build; then
726+ err " OTP build failed"
727+ return 1
728+ fi
718729 ok " OTP build complete"
719730}
720731
@@ -750,15 +761,18 @@ build_tiles() {
750761 log " Generating vector tiles with Planetiler..."
751762 fi
752763
753- docker run --rm \
764+ if ! docker run --rm \
754765 -e JAVA_TOOL_OPTIONS=" -Xmx30g" \
755766 -v " ${DATA_DIR} /osm:/osm:ro" \
756767 -v " ${DATA_DIR} /tileserver:/output" \
757768 ghcr.io/onthegomap/planetiler:latest \
758769 --osm-path=" /osm/${pbf_name} " \
759770 --output=" /output/tiles.mbtiles" \
760771 --nodemap-type=array \
761- --force
772+ --force; then
773+ err " Tile generation failed"
774+ return 1
775+ fi
762776 ok " Tile generation complete: data/tileserver/tiles.mbtiles"
763777}
764778
@@ -774,7 +788,10 @@ build_pelias() {
774788
775789 # Start Elasticsearch
776790 log " Starting Elasticsearch..."
777- docker compose -f " $COMPOSE_FILE " --profile pelias up -d elasticsearch
791+ if ! docker compose -f " $COMPOSE_FILE " --profile pelias up -d elasticsearch; then
792+ err " Failed to start Elasticsearch"
793+ return 1
794+ fi
778795 log " Waiting for Elasticsearch to be ready..."
779796 local retries=0
780797 while ! docker compose -f " $COMPOSE_FILE " exec elasticsearch curl -fs http://localhost:9200/_cluster/health & > /dev/null; do
@@ -789,22 +806,34 @@ build_pelias() {
789806
790807 # Create schema
791808 log " Creating Pelias schema..."
792- docker compose -f " $COMPOSE_FILE " --profile build run --rm pelias-schema
809+ if ! docker compose -f " $COMPOSE_FILE " --profile build run --rm pelias-schema; then
810+ err " Pelias schema creation failed"
811+ return 1
812+ fi
793813 ok " Schema created"
794814
795815 # Download and import Who's on First
796816 log " Downloading and importing Who's on First administrative data..."
797- docker compose -f " $COMPOSE_FILE " --profile build run --rm pelias-whosonfirst-import
817+ if ! docker compose -f " $COMPOSE_FILE " --profile build run --rm pelias-whosonfirst-import; then
818+ err " Who's on First import failed"
819+ return 1
820+ fi
798821 ok " Who's on First import complete"
799822
800823 # Import OpenStreetMap
801824 log " Importing OpenStreetMap data..."
802- docker compose -f " $COMPOSE_FILE " --profile build run --rm pelias-openstreetmap-import
825+ if ! docker compose -f " $COMPOSE_FILE " --profile build run --rm pelias-openstreetmap-import; then
826+ err " OpenStreetMap import failed"
827+ return 1
828+ fi
803829 ok " OpenStreetMap import complete"
804830
805831 # Build placeholder
806832 log " Building placeholder (coarse geocoding) data..."
807- docker compose -f " $COMPOSE_FILE " --profile build run --rm pelias-placeholder-build
833+ if ! docker compose -f " $COMPOSE_FILE " --profile build run --rm pelias-placeholder-build; then
834+ err " Placeholder build failed"
835+ return 1
836+ fi
808837 ok " Placeholder build complete"
809838
810839 ok " Pelias geocoding index built. Start with: docker compose --profile pelias up -d"
@@ -825,7 +854,10 @@ build_nominatim() {
825854 fi
826855
827856 log " Nominatim auto-imports on first start. Starting the container..."
828- docker compose -f " $COMPOSE_FILE " --profile nominatim up -d nominatim
857+ if ! docker compose -f " $COMPOSE_FILE " --profile nominatim up -d nominatim; then
858+ err " Failed to start Nominatim container"
859+ return 1
860+ fi
829861 log " Nominatim is importing in the background."
830862 log " Monitor progress with: docker compose logs -f nominatim"
831863 log " Import is complete when you see 'Using project directory: /nominatim'"
@@ -840,7 +872,10 @@ build_photon() {
840872 log " This can take several hours depending on bandwidth."
841873 log " Subsequent starts use the cached index."
842874
843- docker compose -f " $COMPOSE_FILE " --profile photon up -d photon
875+ if ! docker compose -f " $COMPOSE_FILE " --profile photon up -d photon; then
876+ err " Failed to start Photon container"
877+ return 1
878+ fi
844879 log " Photon is downloading its index in the background."
845880 log " Monitor progress with: docker compose logs -f photon"
846881 ok " Photon container started"
@@ -860,7 +895,10 @@ build_overpass() {
860895 fi
861896
862897 log " Overpass auto-imports on first start. Starting the container..."
863- docker compose -f " $COMPOSE_FILE " --profile overpass up -d overpass
898+ if ! docker compose -f " $COMPOSE_FILE " --profile overpass up -d overpass; then
899+ err " Failed to start Overpass container"
900+ return 1
901+ fi
864902 log " Overpass is importing in the background."
865903 log " Monitor progress with: docker compose logs -f overpass"
866904 ok " Overpass container started (importing)"
0 commit comments