Skip to content

Commit

Permalink
Copy minutely replication diffs to S3
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Sep 24, 2023
1 parent f1a403d commit 74c63e9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cookbooks/planet/files/default/replication-bin/replicate-minute
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 2 additions & 0 deletions cookbooks/planet/recipes/replication.rb
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@
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",
Expand Down

0 comments on commit 74c63e9

Please sign in to comment.