X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/7585a1716c3d5974561c02e9cd488789491aeabf..f983bc8f7682ae60c8f32284ee25b25aa40ba2d8:/cookbooks/tilecache/templates/default/tilecache-curl-time.erb diff --git a/cookbooks/tilecache/templates/default/tilecache-curl-time.erb b/cookbooks/tilecache/templates/default/tilecache-curl-time.erb index cc066c0f1..0c4f53268 100644 --- a/cookbooks/tilecache/templates/default/tilecache-curl-time.erb +++ b/cookbooks/tilecache/templates/default/tilecache-curl-time.erb @@ -1,10 +1,26 @@ #!/bin/bash -mkdir -p /src/tilecache/data/$(date --utc "+%Y/%m") -<% @caches.each do |cache| -%> -<% if cache[:hostname] != node[:hostname] -%> -<% cache.ipaddresses(:family => :inet, :role => :external).sort.each do |address| -%> - curl -w "@/src/tilecache/tilecache-curl-time.txt" -o /dev/null -s -k -4 \ - 'https://<%= cache[:hostname] %>/19/262106/174485.png' \ +mkdir -p /srv/tilecache/data/$(date --utc "+%Y/%m") +# localhost +curl -w "@/srv/tilecache/tilecache-curl-time.txt" -o /dev/null -s -k -4 \ +--max-time 60 \ +'http://localhost:8080/19/262106/174485.png' \ +-H 'authority: c.tile.openstreetmap.org' \ +-H 'sec-fetch-dest: image' \ +-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36' \ +-H 'dnt: 1' \ +-H 'accept: image/webp,image/apng,image/*,*/*;q=0.8' \ +-H 'sec-fetch-site: same-site' \ +-H 'sec-fetch-mode: no-cors' \ +-H 'referer: https://www.openstreetmap.org/' \ +-H 'accept-language: en-GB,en-US;q=0.9,en;q=0.8' \ +--compressed >> /srv/tilecache/data/$(date --utc "+%Y/%m")/localhost-<%= node.name.split(".").first %>-$(date --utc "+%Y-%m-%dT%H").txt +# render +<% @renders.each do |render| -%> +<% if render.name != node.name -%> +<% render.ipaddresses(:family => :inet, :role => :external).sort.each do |address| -%> + curl -w "@/srv/tilecache/tilecache-curl-time.txt" -o /dev/null -s -k -4 \ + --max-time 60 \ + 'https://<%= render.name %>/19/262106/174485.png' \ -H 'authority: c.tile.openstreetmap.org' \ -H 'sec-fetch-dest: image' \ -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36' \ @@ -14,25 +30,27 @@ mkdir -p /src/tilecache/data/$(date --utc "+%Y/%m") -H 'sec-fetch-mode: no-cors' \ -H 'referer: https://www.openstreetmap.org/' \ -H 'accept-language: en-GB,en-US;q=0.9,en;q=0.8' \ - --compressed | tee -a /src/tilecache/data/$(date --utc "+%Y/%m")/tilecache-<%= render[:hostname] %>-$(date --utc --iso-8601).txt + --compressed >> /srv/tilecache/data/$(date --utc "+%Y/%m")/render-<%= render.name.split(".").first %>-$(date --utc "+%Y-%m-%dT%H").txt <% end -%> <% end -%> <% end -%> -<% @renders.each do |render| -%> -<% if render[:hostname] != node[:hostname] -%> -<% render.ipaddresses(:family => :inet, :role => :external).sort.each do |address| -%> - curl -w "@/src/tilecache/tilecache-curl-time.txt" -o /dev/null -s -k -4 \ - 'https://<%= render[:hostname] %>/19/262106/174485.png' \ - -H 'authority: c.tile.openstreetmap.org' \ - -H 'sec-fetch-dest: image' \ - -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36' \ - -H 'dnt: 1' \ - -H 'accept: image/webp,image/apng,image/*,*/*;q=0.8' \ - -H 'sec-fetch-site: same-site' \ - -H 'sec-fetch-mode: no-cors' \ - -H 'referer: https://www.openstreetmap.org/' \ - -H 'accept-language: en-GB,en-US;q=0.9,en;q=0.8' \ - --compressed | tee -a /src/tilecache/data/$(date --utc "+%Y/%m")/render-<%= render[:hostname] %>-$(date --utc --iso-8601).txt +# caches +<% @caches.each do |cache| -%> +<% if cache.name != node.name -%> +<% cache.ipaddresses(:family => :inet, :role => :external).sort.each do |address| -%> + curl -w "@/srv/tilecache/tilecache-curl-time.txt" -o /dev/null -s -k -4 \ + --max-time 60 \ + 'https://<%= cache.name %>/19/262106/174485.png' \ + -H 'authority: c.tile.openstreetmap.org' \ + -H 'sec-fetch-dest: image' \ + -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36' \ + -H 'dnt: 1' \ + -H 'accept: image/webp,image/apng,image/*,*/*;q=0.8' \ + -H 'sec-fetch-site: same-site' \ + -H 'sec-fetch-mode: no-cors' \ + -H 'referer: https://www.openstreetmap.org/' \ + -H 'accept-language: en-GB,en-US;q=0.9,en;q=0.8' \ + --compressed >> /srv/tilecache/data/$(date --utc "+%Y/%m")/tilecache-<%= cache.name.split(".").first %>-$(date --utc "+%Y-%m-%dT%H").txt <% end -%> <% end -%> <% end -%>