Skip to content

Commit

Permalink
Copy tile logs to S3
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Sep 24, 2023
1 parent f6fef27 commit a286cc9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions cookbooks/tilelog/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
version "1.0.0"
supports "ubuntu"
depends "accounts"
depends "planet"
depends "python"
depends "systemd"
3 changes: 3 additions & 0 deletions cookbooks/tilelog/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#

include_recipe "accounts"
include_recipe "planet::aws"
include_recipe "python"

passwords = data_bag_item("tilelog", "passwords")
Expand Down Expand Up @@ -57,6 +58,8 @@
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

Expand Down
6 changes: 6 additions & 0 deletions cookbooks/tilelog/templates/default/tilelog.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>"
Expand All @@ -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"

0 comments on commit a286cc9

Please sign in to comment.