Skip to content

Commit 4ef067c

Browse files
committed
Add ulr path to download files
1 parent e3ff53e commit 4ef067c

File tree

4 files changed

+48
-9
lines changed

4 files changed

+48
-9
lines changed

envs/.env.taginfo.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ INSTANCE_ICON=https://www.openhistoricalmap.org/assets/ohm_logo-2d97749faddd5bd0
1212
INSTANCE_CONTACT= "Anonymous"
1313
TAGINFO_PROJECT_REPO=https://github.com/OpenHistoricalMap/taginfo-projects.git
1414
DOWNLOAD_DB='languages wiki'
15-
CREATE_DB='db projects chronology'
15+
CREATE_DB='db projects chronology'
16+
TAGINFO_DB_BASE_URL=https://planet.openhistoricalmap.org.s3.amazonaws.com/taginfo

images/taginfo/start.sh

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,60 @@ compress_files() {
6363
}
6464

6565
download_db_files() {
66-
if ! aws s3 ls "s3://$AWS_S3_BUCKET/$ENVIRONMENT" 2>&1 | grep -q 'An error occurred'; then
67-
aws s3 sync "s3://$AWS_S3_BUCKET/$ENVIRONMENT/" "$DATADIR/"
68-
mv $DATADIR/*.db $DATADIR/
69-
mv $DATADIR/*/*.db $DATADIR/
70-
compress_files
66+
local base_url=$1
67+
68+
if [ -z "$base_url" ]; then
69+
echo "Error: URL base is required for download_db_files"
70+
return 1
7171
fi
72+
73+
# Ensure base_url ends with /
74+
if [[ ! "$base_url" =~ /$ ]]; then
75+
base_url="${base_url}/"
76+
fi
77+
78+
# List of SQLite database files to download
79+
local db_files=(
80+
"projects-cache.db"
81+
"selection.db"
82+
"taginfo-chronology.db"
83+
"taginfo-db.db"
84+
"taginfo-history.db"
85+
"taginfo-languages.db"
86+
"taginfo-master.db"
87+
"taginfo-projects.db"
88+
"taginfo-wiki.db"
89+
"taginfo-wikidata.db"
90+
)
91+
92+
echo "Downloading SQLite database files from: $base_url"
93+
94+
for db_file in "${db_files[@]}"; do
95+
local file_url="${base_url}${db_file}"
96+
local output_path="${DATADIR}/${db_file}"
97+
98+
echo "Downloading: $db_file"
99+
if wget -q --show-progress -O "$output_path" --no-check-certificate "$file_url"; then
100+
echo "Successfully downloaded: $db_file"
101+
else
102+
echo "Warning: Failed to download $db_file from $file_url"
103+
# Continue with other files even if one fails
104+
fi
105+
done
106+
107+
echo "Database files download completed"
72108
}
73109

74110
sync_latest_db_version() {
75111
while true; do
76112
sleep "$INTERVAL_DOWNLOAD_DATA"
77-
download_db_files
113+
download_db_files "$TAGINFO_DB_BASE_URL"
78114
done
79115
}
80116

81117
start_web() {
82118
echo "Start...Taginfo web service"
83-
download_db_files
119+
download_db_files "$TAGINFO_DB_BASE_URL"
84120
cd $WORKDIR/taginfo/web && ./taginfo.rb & sync_latest_db_version
85121
}
86122

osm-seed/templates/taginfo/taginfo-configMap.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ data:
1515
TIME_UPDATE_INTERVAL: {{ .Values.taginfo.env.TIME_UPDATE_INTERVAL | quote }}
1616
AWS_S3_BUCKET: {{ .Values.taginfo.env.AWS_S3_BUCKET | quote }}
1717
ENVIRONMENT: {{ .Values.taginfo.env.ENVIRONMENT | quote }}
18-
INTERVAL_DOWNLOAD_DATA: {{ .Values.taginfo.env.INTERVAL_DOWNLOAD_DATA | quote}}
18+
INTERVAL_DOWNLOAD_DATA: {{ .Values.taginfo.env.INTERVAL_DOWNLOAD_DATA | quote }}
19+
TAGINFO_DB_BASE_URL: {{ .Values.taginfo.env.TAGINFO_DB_BASE_URL | quote }}
1920
{{- end }}

osm-seed/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,7 @@ taginfo:
10301030
ENVIRONMENT: development
10311031
AWS_S3_BUCKET: taginfo
10321032
INTERVAL_DOWNLOAD_DATA: 3600
1033+
TAGINFO_DB_BASE_URL: https://planet.openhistoricalmap.org.s3.amazonaws.com/taginfo
10331034
resources:
10341035
enabled: false
10351036
requests:

0 commit comments

Comments
 (0)