Skip to content

Commit 14ce413

Browse files
committed
Process state.txt file to download dump files
1 parent 1693d65 commit 14ce413

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

images/full-history/start.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ date=$(date '+%y%m%d_%H%M')
1616
local_planetPBFFile=$VOLUME_DIR/planet-history-${date}.osm.pbf
1717
cloud_planetPBFFile=planet/planet-history-${date}.osm.pbf
1818
stateFile="$VOLUME_DIR/state.txt"
19-
2019
dumpFile="$VOLUME_DIR/input-latest.dump"
2120

2221

@@ -31,9 +30,15 @@ fi
3130
# ===============================
3231
download_dump_file() {
3332
echo "Downloading db .dump file from cloud..."
34-
3533
if [ "$CLOUDPROVIDER" == "aws" ]; then
36-
aws s3 cp "$DUMP_CLOUD_URL" "$dumpFile"
34+
if [[ "$DUMP_CLOUD_URL" == *.txt ]]; then
35+
temp_txt="$VOLUME_DIR/tmp_dump_url.txt"
36+
aws s3 cp "$DUMP_CLOUD_URL" "$temp_txt"
37+
first_line=$(head -n 1 "$temp_txt")
38+
aws s3 cp "$first_line" "$dumpFile"
39+
else
40+
aws s3 cp "$DUMP_CLOUD_URL" "$dumpFile"
41+
fi
3742
elif [ "$CLOUDPROVIDER" == "gcp" ]; then
3843
gsutil cp "$DUMP_CLOUD_URL" "$dumpFile"
3944
fi

images/planet-dump/start.sh

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ date=$(date '+%y%m%d_%H%M')
1515
local_planetPBFFile=$VOLUME_DIR/planet-${date}.osm.pbf
1616
cloud_planetPBFFile=planet/planet-${date}.osm.pbf
1717
stateFile="$VOLUME_DIR/state.txt"
18+
dumpFile="$VOLUME_DIR/input-latest.dump"
1819

1920
# If overwrite flag is enabled, use fixed filenames
2021
if [ "$OVERWRITE_PLANET_FILE" == "true" ]; then
@@ -26,16 +27,22 @@ fi
2627
# Download db .dump file
2728
# ===============================
2829
download_dump_file() {
29-
local_dumpFile="$VOLUME_DIR/input-latest.dump"
3030
echo "Downloading db .dump file from cloud..."
31-
3231
if [ "$CLOUDPROVIDER" == "aws" ]; then
33-
aws s3 cp "$DUMP_CLOUD_URL" "$local_dumpFile"
32+
if [[ "$DUMP_CLOUD_URL" == *.txt ]]; then
33+
temp_txt="$VOLUME_DIR/tmp_dump_url.txt"
34+
aws s3 cp "$DUMP_CLOUD_URL" "$temp_txt"
35+
first_line=$(head -n 1 "$temp_txt")
36+
aws s3 cp "$first_line" "$dumpFile"
37+
else
38+
aws s3 cp "$DUMP_CLOUD_URL" "$dumpFile"
39+
fi
3440
elif [ "$CLOUDPROVIDER" == "gcp" ]; then
35-
gsutil cp "$DUMP_CLOUD_URL" "$local_dumpFile"
41+
gsutil cp "$DUMP_CLOUD_URL" "$dumpFile"
3642
fi
3743
}
3844

45+
3946
# ===============================
4047
# Upload planet + state
4148
# ===============================
@@ -63,7 +70,7 @@ if [ "$PLANET_EXPORT_METHOD" == "planet-dump-ng" ]; then
6370
download_dump_file
6471
echo "Generating planet file with planet-dump-ng..."
6572
planet-dump-ng \
66-
--dump-file "$VOLUME_DIR/input-latest.dump" \
73+
--dump-file "$dumpFile" \
6774
--pbf "$local_planetPBFFile"
6875
elif [ "$PLANET_EXPORT_METHOD" == "osmosis" ]; then
6976
echo "Generating planet file with osmosis..."

0 commit comments

Comments
 (0)