]> git.openstreetmap.org Git - chef.git/blob - cookbooks/planet/files/default/replication-bin/replicate-minute
Copy minutely replication diffs to S3
[chef.git] / cookbooks / planet / files / default / replication-bin / replicate-minute
1 #!/bin/sh
2
3 set -e
4
5 cd /etc/replication
6
7 osmdbt-catchup --quiet
8 osmdbt-get-log --quiet
9 osmdbt-catchup --quiet
10 osmdbt-create-diff --quiet --with-comment --max-changes=50000
11
12 cd /store/planet/replication/minute
13
14 . state.txt
15
16 sequencePart1=$(($sequenceNumber / 1000000 % 1000))
17 sequencePart2=$(($sequenceNumber / 1000 % 1000))
18 sequencePart3=$(($sequenceNumber % 1000))
19 diffPath=$(printf "%03d/%03d/%03d" $sequencePart1 $sequencePart2 $sequencePart3)
20
21 /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"
22 /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"
23 /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"