Skip to content

Commit

Permalink
Update docker file and start.sh - imposm
Browse files Browse the repository at this point in the history
  • Loading branch information
Rub21 committed Feb 16, 2024
1 parent 3dfa195 commit b5123fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
6 changes: 4 additions & 2 deletions images/tiler-imposm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ RUN apt-get install -y \
curl \
wget \
unzip \
software-properties-common
software-properties-common && \
rm -rf /var/lib/apt/lists/*

# # Install python
RUN add-apt-repository ppa:deadsnakes/ppa && \
apt-get update && \
apt-get install -y build-essential python3.6 python3.6-dev python3-pip && \
rm -rf /var/lib/apt/lists/* && \
python3 -m pip install pip --upgrade && \
python3 -m pip install wheel

Expand Down Expand Up @@ -56,4 +58,4 @@ WORKDIR /osm
COPY config config
COPY scripts scripts
COPY start.sh start.sh
CMD ./start.sh
CMD ./start.sh
19 changes: 5 additions & 14 deletions images/tiler-imposm/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LIMITFILE="limitFile.geojson"

# directories to keep the imposm's cache for updating the db
WORKDIR=/mnt/data
CACHEDIR=$WORKDIR/cachedir
CACHE_DIR=$WORKDIR/cachedir
DIFF_DIR=$WORKDIR/diff
IMPOSM3_EXPIRE_DIR=$WORKDIR/imposm3_expire_dir

Expand All @@ -31,9 +31,7 @@ mkdir -p "$CACHE_DIR" "$DIFF_DIR" "$IMPOSM3_EXPIRE_DIR"
} >"$WORKDIR/config.json"

function getData() {
"""
Get the PBF file from the cloud provider or public URL
"""
### Get the PBF file from the cloud provider or public URL
if [ "$TILER_IMPORT_FROM" == "osm" ]; then
wget "$TILER_IMPORT_PBF_URL" -O "$PBFFILE"
elif [ "$TILER_IMPORT_FROM" == "osmseed" ]; then
Expand All @@ -52,9 +50,7 @@ function getData() {
}

function uploadExpiredFiles() {
"""
Upload the expired files to the cloud provider
"""
### Upload the expired files to the cloud provider
for file in $(find $IMPOSM3_EXPIRE_DIR -type f -cmin -1); do
bucketFile=${file#*"$WORKDIR"}
echo $(date +%F_%H:%M:%S)":" $file
Expand All @@ -70,10 +66,7 @@ function uploadExpiredFiles() {
}

function updateData() {
"""
Update the DB with the new data form minute replication
"""

### Update the DB with the new data form minute replication
if [ "$OVERWRITE_STATE" = "true" ]; then
rm $DIFF_DIR/last.state.txt
fi
Expand Down Expand Up @@ -103,9 +96,7 @@ function updateData() {
}

function importData() {
"""
Import the PBF and Natural Earth files to the DB
"""
### Import the PBF and Natural Earth files to the DB
echo "Execute the missing functions"
psql "postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DB" -a -f config/postgis_helpers.sql

Expand Down

0 comments on commit b5123fd

Please sign in to comment.