Skip to content

Commit

Permalink
fix #499
Browse files Browse the repository at this point in the history
  • Loading branch information
wp99cp committed Oct 1, 2024
1 parent 4c7178d commit c187fa8
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
6 changes: 1 addition & 5 deletions route_engine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
FROM ghcr.io/gis-ops/docker-valhalla/valhalla:3.4.0
FROM ghcr.io/gis-ops/docker-valhalla/valhalla:latest

USER root

# install python
RUN apt-get update && apt-get install -y python3 python3-pip libgdal-dev

COPY ./entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

Expand Down
2 changes: 2 additions & 0 deletions route_engine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ files.

**Note:** You need roughly 32GB of memory on your machine to run this script.

You can download the SHP files from https://www.swisstopo.admin.ch/de/landschaftsmodell-swisstlm3d.

```bash
# First you need to build the docker container in the `helper_scripts` folder.
docker build -t shp_to_osm .
Expand Down
12 changes: 4 additions & 8 deletions route_engine/dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
FROM ghcr.io/gis-ops/docker-valhalla/valhalla:3.4.0
FROM ghcr.io/gis-ops/docker-valhalla/valhalla:latest

# install python
RUN sudo apt-get update && sudo apt-get install -y python3 python3-pip libgdal-dev

COPY ./entrypoint.sh /entrypoint.sh
RUN sudo chmod +x /entrypoint.sh

# set user to root
USER root
COPY ./entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

USER valhalla
ENTRYPOINT ["/entrypoint.sh"]
CMD ["build_tiles"]
21 changes: 16 additions & 5 deletions route_engine/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
#!/bin/bash

# check if /custom_files contains some files apart from .gitkeep
if ! [ "$(ls -A /custom_files | grep -Ev '.gitkeep')" ]; then
# check if /custom_files contains some files apart from .gitkeep or file_hashes.txt
# (the latter is should be ignored to recover from failed downloads / startups)
if ! [ "$(ls -A /custom_files | grep -Ev '.gitkeep' | file_hashes.txt)" ]; then

echo "No custom files found in /custom_files. Start downloading default files..."

# Install gdown
pip install gdown
# Install dependencies for downloading files
sudo apt update
sudo apt install python3-pip -y
python3 -m pip install --break-system-packages gdown

# pip install gdown
export PATH=$PATH:/home/valhalla/.local/bin

# clear /custom_files
sudo rm -rf /custom_files/*
sudo chmod 777 /custom_files

gdown 1lkrS268Mphtifxmdw0UHVnR9_cNErNks -O /custom_files/
# download pre-computed valhalla tiles
# these tiles are generated for valhalla version 3.5.0 or higher
# based on swissTLM3D released at 2024-03
gdown 11OUl2HTd0dVTdAC3CDHbXIOxEShx9gUz -O /custom_files/

# rename the downloaded file
mv /custom_files/valhalla_tiles_*.tar /custom_files/valhalla_tiles.tar

echo "Default files downloaded successfully"

Expand Down

0 comments on commit c187fa8

Please sign in to comment.