]> git.openstreetmap.org Git - chef.git/commitdiff
Copy minutely replication diffs to S3
authorTom Hughes <tom@compton.nu>
Sun, 24 Sep 2023 14:35:00 +0000 (15:35 +0100)
committerTom Hughes <tom@compton.nu>
Sun, 24 Sep 2023 14:37:54 +0000 (15:37 +0100)
cookbooks/planet/files/default/replication-bin/replicate-minute
cookbooks/planet/recipes/replication.rb

index a0c967177c9ecddebd438dc64a86c5c735a480b5..736a0ce9f11e38c2c9688dddd4cdc2b641bbb7a5 100755 (executable)
@@ -8,3 +8,16 @@ osmdbt-catchup --quiet
 osmdbt-get-log --quiet
 osmdbt-catchup --quiet
 osmdbt-create-diff --quiet --with-comment --max-changes=50000
+
+cd /store/planet/replication/minute
+
+. state.txt
+
+sequencePart1=$(($sequenceNumber / 1000000 % 1000))
+sequencePart2=$(($sequenceNumber / 1000 % 1000))
+sequencePart3=$(($sequenceNumber % 1000))
+diffPath=$(printf "%03d/%03d/%03d" $sequencePart1 $sequencePart2 $sequencePart3)
+
+/opt/awscli/v2/current/bin/aws --profile=osm-pds-upload s3 cp --storage-class=INTELLIGENT_TIERING "${diffPath}.osc.gz" "s3://osm-planet-eu-central-1/planet/replication/minute/${diffPath}.osc.gz"
+/opt/awscli/v2/current/bin/aws --profile=osm-pds-upload s3 cp --storage-class=INTELLIGENT_TIERING "${diffPath}.state.txt" "s3://osm-planet-eu-central-1/planet/replication/minute/${diffPath}.state.txt"
+/opt/awscli/v2/current/bin/aws --profile=osm-pds-upload s3 cp --storage-class=INTELLIGENT_TIERING "state.txt" "s3://osm-planet-eu-central-1/planet/replication/minute/state.txt"
index e0a3bcc7e7c6a815dba9d250fa92a9716b9f681a..6b2f9ab74d3dfa75d19c8a9a63033a495fa2a646 100644 (file)
@@ -269,6 +269,8 @@ systemd_service "replication-minutely" do
   working_directory "/etc/replication"
   exec_start "/usr/local/bin/replicate-minute"
   sandbox :enable_network => true
+  protect_home "tmpfs"
+  bind_paths "/home/planet"
   read_write_paths [
     "/run/replication",
     "/store",