]> git.openstreetmap.org Git - chef.git/commitdiff
Copy tile logs to S3
authorTom Hughes <tom@compton.nu>
Sun, 24 Sep 2023 17:57:53 +0000 (18:57 +0100)
committerTom Hughes <tom@compton.nu>
Sun, 24 Sep 2023 17:57:53 +0000 (18:57 +0100)
cookbooks/tilelog/metadata.rb
cookbooks/tilelog/recipes/default.rb
cookbooks/tilelog/templates/default/tilelog.erb

index 0dba182a6d9b64bf6585f87324a74e87985e58eb..d3f5a753c72bae4d9af5cc61addaaac1a8544741 100644 (file)
@@ -7,5 +7,6 @@ description      "Installs and configures tile log analysis"
 version          "1.0.0"
 supports         "ubuntu"
 depends          "accounts"
+depends          "planet"
 depends          "python"
 depends          "systemd"
index 2722c4f32f61b6efe762c517a0e1e70a7845cf27..9370225150ec2f748ae8686174c6fdec409436e5 100644 (file)
@@ -18,6 +18,7 @@
 #
 
 include_recipe "accounts"
+include_recipe "planet::aws"
 include_recipe "python"
 
 passwords = data_bag_item("tilelog", "passwords")
@@ -57,6 +58,8 @@ systemd_service "tilelog" do
   exec_start "/usr/local/bin/tilelog"
   nice 10
   sandbox :enable_network => true
+  protect_home "tmpfs"
+  bind_paths "/home/planet"
   read_write_paths tilelog_output_directory
 end
 
index 0cb24ce4d75f9260c0059c492e8a1dcbf44a4fed..f00f2cb5d2d8eda9681fcce09bf8278b9d00e74d 100644 (file)
@@ -4,6 +4,7 @@ set -e
 if [ -z "$DATE" ]
 then
   DATE=$(date -u -d "1 day ago" "+%Y-%m-%d")
+  YEAR=$(date -u -d "1 day ago" "+%Y")
 fi
 
 OUTDIR="<%= @output_dir %>"
@@ -26,4 +27,9 @@ nice -n 19 /opt/tilelog/bin/tilelog --date "${DATE}" \
 
 mv "${TILEFILE}" "${HOSTFILE}" "${APPFILE}" "${COUNTRYFILE}" "${OUTDIR}"
 
+/opt/awscli/v2/current/bin/aws --profile=osm-pds-upload s3 cp --storage-class=INTELLIGENT_TIERING "${OUTDIR}/${TILEFILE}" "s3://osm-planet-eu-central-1/tile_logs/standard_layer/tiles/${YEAR}/${TILEFILE}"
+/opt/awscli/v2/current/bin/aws --profile=osm-pds-upload s3 cp --storage-class=INTELLIGENT_TIERING "${OUTDIR}/${HOSTFILE}" "s3://osm-planet-eu-central-1/tile_logs/standard_layer/hosts/${YEAR}/${HOSTFILE}"
+/opt/awscli/v2/current/bin/aws --profile=osm-pds-upload s3 cp --storage-class=INTELLIGENT_TIERING "${OUTDIR}/${APPFILE}" "s3://osm-planet-eu-central-1/tile_logs/standard_layer/apps/${YEAR}/${APPFILE}"
+/opt/awscli/v2/current/bin/aws --profile=osm-pds-upload s3 cp --storage-class=INTELLIGENT_TIERING "${OUTDIR}/${COUNTRYFILE}" "s3://osm-planet-eu-central-1/tile_logs/standard_layer/countries/${YEAR}/${COUNTRYFILE}"
+
 rm -rf "$TMPDIR"