]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/planet/templates/default/planetdump.erb
Copy planet dumps to S3
[chef.git] / cookbooks / planet / templates / default / planetdump.erb
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}"