]> git.openstreetmap.org Git - chef.git/commitdiff
Copy planet dumps to S3
authorTom Hughes <tom@compton.nu>
Sun, 24 Sep 2023 18:27:20 +0000 (19:27 +0100)
committerTom Hughes <tom@compton.nu>
Sun, 24 Sep 2023 18:27:20 +0000 (19:27 +0100)
cookbooks/planet/recipes/dump.rb
cookbooks/planet/templates/default/planetdump.erb

index 6cc509c62c5bdb979d5fb8e5a9ab421dfc0d43f6..aa69f9318922fb75b57d075261bfc14e5ac5ac8d 100644 (file)
@@ -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",
index 6b3a83656bac446190ec92c7bb1f2138988ff16d..8ffd8f9cc0994aaa5c26c44f22dc2f2e074d2d7c 100644 (file)
@@ -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}"