Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vectortile: Use flex expiry #721

Merged
merged 1 commit into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cookbooks/vectortile/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -250,15 +250,15 @@
owner "root"
group "root"
mode "755"
variables :tilekiln_bin => "#{tilekiln_directory}/bin/tilekiln", :source_database => "spirit", :config_path => "#{shortbread_config}", :diff_size => "1000", :tiles_file => "/srv/vector.openstreetmap.org/data/tiles.txt", :post_processing => "/usr/local/bin/tiles-rerender"
variables :tilekiln_bin => "#{tilekiln_directory}/bin/tilekiln", :source_database => "spirit", :config_path => "#{shortbread_config}", :diff_size => "1000", :expiry_dir => "/srv/vector.openstreetmap.org/data/", :post_processing => "/usr/local/bin/tiles-rerender"
end

template "/usr/local/bin/tiles-rerender" do
source "tiles-rerender.erb"
owner "root"
group "root"
mode "755"
variables :tilekiln_bin => "#{tilekiln_directory}/bin/tilekiln", :source_database => "spirit", :storage_database => "tiles", :config_path => "#{shortbread_config}", :tiles_file => "/srv/vector.openstreetmap.org/data/tiles.txt", :update_threads => 4
variables :tilekiln_bin => "#{tilekiln_directory}/bin/tilekiln", :source_database => "spirit", :storage_database => "tiles", :config_path => "#{shortbread_config}", :expiry_dir => "/srv/vector.openstreetmap.org/data/", :update_threads => 4
end

systemd_service "replicate" do
Expand Down
2 changes: 1 addition & 1 deletion cookbooks/vectortile/templates/default/import-planet.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

set -e

export LUA_PATH='/srv/vector.openstreetmap.org/osm2pgsql-themepark/lua/?.lua;/srv/vector.openstreetmap.org/spirit/?.lua;;'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bit is no longer necessary as a change resulting from lua include path changes made in spirit to allow expiry to work

export LUA_PATH='/srv/vector.openstreetmap.org/osm2pgsql-themepark/lua/?.lua;;'

# Import the osm2pgsql file specified as an argument, using the locations for spirit
osm2pgsql \
Expand Down
8 changes: 6 additions & 2 deletions cookbooks/vectortile/templates/default/tiles-rerender.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#!/bin/sh
set -eu
<%= @tilekiln_bin %> generate tiles \

cd "<%= @expiry_dir %>"

wc -l z*.txt
cat z*.txt | <%= @tilekiln_bin %> generate tiles \
--source-dbname "<%= @source_database %>" \
--storage-dbname "<%= @storage_database %>" \
--num-threads "<%= node[:vectortile][:replication][:threads] %>" \
--config <%= @config_path %> < <%= @tiles_file %>
--config <%= @config_path %>
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/bin/sh

# Usage
# sudo -u tilekiln vector-update
# sudo -u tileupdate vector-update

set -eu

export LUA_PATH='/srv/vector.openstreetmap.org/osm2pgsql-themepark/lua/?.lua;/srv/vector.openstreetmap.org/spirit/?.lua;;'
export LUA_PATH='/srv/vector.openstreetmap.org/osm2pgsql-themepark/lua/?.lua;;'

cd "<%= @expiry_dir %>"
osm2pgsql-replication update \
-d "<%= @source_database %>" \
--max-diff-size "<%= @diff_size %>"
7 changes: 3 additions & 4 deletions cookbooks/vectortile/templates/default/vector-update-tile.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@

set -eu

export LUA_PATH='/srv/vector.openstreetmap.org/osm2pgsql-themepark/lua/?.lua;/srv/vector.openstreetmap.org/spirit/?.lua;;'
export LUA_PATH='/srv/vector.openstreetmap.org/osm2pgsql-themepark/lua/?.lua;;'

cd "<%= @expiry_dir %>"
osm2pgsql-replication update \
-d "<%= @source_database %>" \
--max-diff-size "<%= @diff_size %>" \
--post-processing "<%= @post_processing %>" \
-- --expire-tiles=10-14 \
--expire-output="<%= @tiles_file %>"
--post-processing "<%= @post_processing %>"
Loading