From 82228d29879117f6211e8ef85eb50bb407c08b97 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 24 Sep 2023 19:27:20 +0100 Subject: [PATCH] Copy planet dumps to S3 --- cookbooks/planet/recipes/dump.rb | 2 ++ .../planet/templates/default/planetdump.erb | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/cookbooks/planet/recipes/dump.rb b/cookbooks/planet/recipes/dump.rb index 6cc509c62..aa69f9318 100644 --- a/cookbooks/planet/recipes/dump.rb +++ b/cookbooks/planet/recipes/dump.rb @@ -110,6 +110,8 @@ systemd_service "planetdump@" do exec_start "/usr/local/bin/planetdump %i" memory_max "64G" sandbox true + protect_home "tmpfs" + bind_paths "/home/planet" read_write_paths [ "/store/planetdump", "/store/planet/pbf", diff --git a/cookbooks/planet/templates/default/planetdump.erb b/cookbooks/planet/templates/default/planetdump.erb index 6b3a83656..8ffd8f9cc 100644 --- a/cookbooks/planet/templates/default/planetdump.erb +++ b/cookbooks/planet/templates/default/planetdump.erb @@ -142,7 +142,8 @@ function install_dump { type="$1" format="$2" dir="$3" - year="$4" + s3dir="$4" + year="$5" name="${type}-${date}.osm.${format}" latest="${type}-latest.osm.${format}" rss_file="${type}-${format}-rss.xml" @@ -155,6 +156,10 @@ function install_dump { test -f "${rss_file}" && xmllint --noout "${rss_file}" && cp -f "${rss_file}" "${dir}" rm -f "${dir}/${latest}.md5" sed -e "s/${name}/${latest}/" "${dir}/${year}/${name}.md5" > "${dir}/${latest}.md5" + + /opt/awscli/v2/current/bin/aws --profile=osm-pds-upload s3 cp --storage-class=INTELLIGENT_TIERING "${dir}/${year}/${name}.md5" "${s3dir}/${name}.md5" + /opt/awscli/v2/current/bin/aws --profile=osm-pds-upload s3 cp --storage-class=INTELLIGENT_TIERING "${dir}/${year}/${name}" "${s3dir}/${name}" + /opt/awscli/v2/current/bin/aws --profile=osm-pds-upload s3 cp --storage-class=INTELLIGENT_TIERING "${dir}/${year}/${name}.torrent" "${s3dir}/${name}.torrent" } # Create *.torrent files @@ -166,9 +171,9 @@ mk_torrent "planet" "pbf" "pbf" mk_torrent "history" "pbf" "pbf/full-history" # Move dumps into place -install_dump "changesets" "bz2" "<%= node[:planet][:dump][:xml_directory] %>" "${year}" -install_dump "discussions" "bz2" "<%= node[:planet][:dump][:xml_directory] %>" "${year}" -install_dump "planet" "bz2" "<%= node[:planet][:dump][:xml_directory] %>" "${year}" -install_dump "history" "bz2" "<%= node[:planet][:dump][:xml_history_directory] %>" "${year}" -install_dump "planet" "pbf" "<%= node[:planet][:dump][:pbf_directory] %>" -install_dump "history" "pbf" "<%= node[:planet][:dump][:pbf_history_directory] %>" +install_dump "changesets" "bz2" "<%= node[:planet][:dump][:xml_directory] %>" "s3://osm-planet-eu-central-1/changesets/osm/${year}" "${year}" +install_dump "discussions" "bz2" "<%= node[:planet][:dump][:xml_directory] %>" "s3://osm-planet-eu-central-1/discussions/osm/${year}" "${year}" +install_dump "planet" "bz2" "<%= node[:planet][:dump][:xml_directory] %>" "s3://osm-planet-eu-central-1/planet/osm/${year}" "${year}" +install_dump "history" "bz2" "<%= node[:planet][:dump][:xml_history_directory] %>" "s3://osm-planet-eu-central-1/planet-full-history/osm/${year}" "${year}" +install_dump "planet" "pbf" "<%= node[:planet][:dump][:pbf_directory] %>" "s3://osm-planet-eu-central-1/planet/pbf/${year}" +install_dump "history" "pbf" "<%= node[:planet][:dump][:pbf_history_directory] %>" "s3://osm-planet-eu-central-1/planet-full-history/pbf/${year}" -- 2.45.1