--- /dev/null
+default[:planet][:dump][:xml_directory] = "/store/planet/planet"
+default[:planet][:dump][:xml_history_directory] = "/store/planet/planet/full-history"
+default[:planet][:dump][:pbf_directory] = "/store/planet/pbf"
+default[:planet][:dump][:pbf_history_directory] = "/store/planet/pbf/full-history"
files_mode 0755
end
-directory "/store/planet/planet" do
- owner "www-data"
- group "planet"
- mode 0775
-end
-
-directory "/store/planet/pbf" do
- owner "www-data"
- group "planet"
- mode 0775
+[:xml_directory, :xml_history_directory,
+ :pbf_directory, :pbf_history_directory].each do |dir|
+ directory dir do
+ owner "www-data"
+ group "planet"
+ mode 0775
+ end
end
directory "/store/planet/notes" do
mode 0755
end
-template "/usr/local/bin/planetdump" do
- source "planetdump.erb"
- owner "root"
- group "root"
- mode 0755
+["planetdump", "planet-mirror-redirect-update", "apache-latest-planet-filename"].each do |program|
+ template "/usr/local/bin/#{program}" do
+ source "#{program}.erb"
+ owner "root"
+ group "root"
+ mode 0755
+ end
end
$| = 1;
while (<STDIN>) {
- my $where = readlink("/store/planet/planet/planet-latest.osm.bz2");
+ my $where = readlink("<%= node[:planet][:dump][:xml_directory] %>/planet-latest.osm.bz2");
s/planet\/planet\-latest\.osm\.bz2/planet\/$where/g;
print $_;
}
Modifies .htaccess
*/
$_YEAR = date('Y');
-$_PLANET_FOLDER = '/store/planet/planet/'.$_YEAR.'/';
+$_PLANET_FOLDER = '<%= node[:planet][:dump][:xml_directory] %>/'.$_YEAR.'/';
$_PLANET_REGEX = "/^(planet|changesets)\-\d{6}(\-nolt)?\.osm\.(bz2|gz)$/";
$_MIRROR = 'http://ftp.heanet.ie/mirrors/openstreetmap.org/planet/'.$_YEAR.'/';
$_PLANET_HTACCESS = $_PLANET_FOLDER.'../../.htaccess';
#!/bin/bash
+# DO NOT EDIT - This file is being maintained by Chef
# Exit on error
set -e
-p "planet-${date}.osm.pbf" -P "history-${date}.osm.pbf"
# Move XML dumps into place
-for file in "changesets-${date}.osm.bz2" "planet-${date}.osm.bz2" "history-${date}.osm.bz2"
-do
- md5sum "#{file}" > "#{file}.md5"
- mv "${file}" "${file}.md5" "/store/planet/planet"
-done
-
-# Move PBF dumps into place
-for file in "planet-${date}.osm.pbf" "history-${date}.osm.pbf"
-do
- md5sum "#{file}" > "#{file}.md5"
- mv "${file}" "${file}.md5" "/store/planet/pbf"
-done
+year = `echo ${date} | sed "s/.*-\([0-9]\)\{4\}-.*/\1/"`
+<% {
+ "changesets-${date}.osm.bz2" => "#{node[:planet][:dump][:xml_directory]}/${year}",
+ "planet-${date}.osm.bz2" => "#{node[:planet][:dump][:xml_directory]}/${year}",
+ "history-${date}.osm.bz2" => "#{node[:planet][:dump][:xml_history_directory]}/${year}",
+ "planet-${date}.osm.pbf" => node[:planet][:dump][:pbf_directory],
+ "history-${date}.osm.pbf" => node[:planet][:dump][:pbf_history_directory]
+}.each do |file,dir| %>
+md5sum "<%= file %>" > "<%= file %>.md5"
+mv "<%= file %>" "<%= file %>.md5" "<%= dir %>"
+<% end %>