--- /dev/null
+= DESCRIPTION:
+
+= REQUIREMENTS:
+
+= ATTRIBUTES:
+
+= USAGE:
+
--- /dev/null
+#map {
+ position: absolute;
+ top: 0px;
+ bottom: 0px;
+ left: 0px;
+ right: 0px;
+}
--- /dev/null
+function createMap(divName, jsonFile) {
+ // Create a map
+ var map = L.map(divName);
+
+ // Add OpenStreetMap layer
+ L.tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
+ attribution: "© <a target=\"_parent\" href=\"http://www.openstreetmap.org\">OpenStreetMap</a> and contributors, under an <a target=\"_parent\" href=\"http://www.openstreetmap.org/copyright\">open license</a>",
+ maxZoom: 18
+ }).addTo(map);
+
+ // Add the JSON file as an overlay
+ $.ajax({
+ url: jsonFile,
+ success: function(json) {
+ var jsonLayer = L.geoJson(json, {
+ style: function(feature) {
+ return { color: feature.properties.colour, weight: 2, opacity: 1 }
+ },
+ onEachFeature: function (feature, layer) {
+ layer.bindPopup(feature.properties.country + " via " + feature.properties.server);
+ layer.on("mouseover", function () {
+ this.setStyle({ weight: 5 });
+ });
+ layer.on("mouseout", function () {
+ this.setStyle({ weight: 2 });
+ });
+ }
+ }).addTo(map);
+
+ map.fitBounds(jsonLayer.getBounds());
+ }
+ });
+
+ return map;
+}
--- /dev/null
+#!/bin/zsh
+
+# DO NOT EDIT - This file is being maintained by Chef
+
+unset GIT_DIR
+
+while read oldrev newrev refname
+do
+ if [[ "$refname" = "refs/heads/master" ]]
+ then
+ /usr/local/bin/dns-update
+ fi
+done
--- /dev/null
+maintainer "OpenStreetMap Administrators"
+maintainer_email "admins@openstreetmap.org"
+license "Apache 2.0"
+description "Configure DNS management"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
+version "1.0.0"
--- /dev/null
+#
+# Cookbook Name:: dns
+# Recipe:: default
+#
+# Copyright 2011, OpenStreetMap Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+include_recipe "git"
+include_recipe "apache"
+
+passwords = data_bag_item("dns", "passwords")
+
+package "make"
+
+package "perl"
+package "libxml-treebuilder-perl"
+package "libxml-writer-perl"
+package "libyaml-perl"
+package "libwww-perl"
+package "libjson-xs-perl"
+
+directory "/srv/dns.openstreetmap.org" do
+ owner "root"
+ group "root"
+ mode 0755
+end
+
+remote_directory "/srv/dns.openstreetmap.org/html" do
+ source "html"
+ owner "root"
+ group "root"
+ mode 0755
+ files_owner "root"
+ files_group "root"
+ files_mode 0644
+end
+
+zones = Array.new
+
+Dir.glob("/var/lib/dns/kml/*.kml").each do |kmlfile|
+ zone = File.basename(kmlfile, ".kml")
+
+ template "/srv/dns.openstreetmap.org/html/#{zone}.html" do
+ source "zone.html.erb"
+ owner "root"
+ group "root"
+ mode 0644
+ variables :zone => zone
+ end
+
+ zones.push(zone)
+end
+
+template "/srv/dns.openstreetmap.org/html/index.html" do
+ source "index.html.erb"
+ owner "root"
+ group "root"
+ mode 0644
+ variables :zones => zones
+end
+
+apache_site "dns.openstreetmap.org" do
+ template "apache.erb"
+ directory "/srv/dns.openstreetmap.org"
+end
+
+template "/usr/local/bin/dns-update" do
+ source "dns-update.erb"
+ owner "root"
+ group "git"
+ mode 0750
+ variables :passwords => passwords
+end
+
+execute "dns-update" do
+ action :nothing
+ command "/usr/local/bin/dns-update"
+ user "git"
+ group "git"
+end
+
+directory "/var/lib/dns" do
+ owner "git"
+ group "git"
+ mode 02775
+ notifies :run, resources(:execute => "dns-update")
+end
+
+cookbook_file "#{node[:dns][:repository]}/hooks/post-receive" do
+ source "post-receive"
+ owner "git"
+ group "git"
+ mode 0750
+end
+
+template "/usr/local/bin/dns-check" do
+ source "dns-check.erb"
+ owner "root"
+ group "git"
+ mode 0750
+ variables :passwords => passwords
+end
+
+template "/etc/cron.d/dns" do
+ source "cron.erb"
+ owner "root"
+ group "root"
+ mode 0644
+end
--- /dev/null
+# DO NOT EDIT - This file is being maintained by Chef
+
+<VirtualHost *:80>
+ ServerName <%= @name %>
+ ServerAdmin webmaster@openstreetmap.org
+
+ CustomLog /var/log/apache2/<%= @name %>-access.log combined
+ ErrorLog /var/log/apache2/<%= @name %>-error.log
+
+ DocumentRoot <%= @directory %>/html
+ Alias /json/ /var/lib/dns/json/
+</VirtualHost>
--- /dev/null
+# DO NOT EDIT - This file is being maintained by Chef
+
+*/3 * * * * git /usr/local/bin/dns-check
--- /dev/null
+#!/bin/sh
+
+export RSYNC_PASSWORD=<%= @passwords["rsync"] %>
+export PINGDOM_USERNAME=pingdom@openstreetmap.org
+export PINGDOM_PASSWORD=<%= @passwords["pingdom"] %>
+
+make --quiet --directory=/var/lib/dns --assume-new=lib/countries.xml update > /dev/null
--- /dev/null
+#!/bin/sh
+
+# DO NOT EDIT - This file is being maintained by Chef
+
+umask 0002
+
+export RSYNC_PASSWORD=<%= @passwords["rsync"] %>
+export PINGDOM_USERNAME=pingdom@openstreetmap.org
+export PINGDOM_PASSWORD=<%= @passwords["pingdom"] %>
+
+cd /var/lib/dns
+
+if [ ! -d .git ]
+then
+ git clone /var/lib/git/dns.git /var/lib/dns
+fi
+
+git pull -q
+
+make update
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+ <title>GeoDNS - Zones</title>
+ </head>
+ <body>
+ <h1 align="center">GeoDNS Zones</h1>
+ <% @zones.each do |zone| -%>
+ <h2 align="center"><a href="<%= zone %>.html"><%= zone %></a></h2>
+ <% end -%>
+ </body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+ <title>GeoDNS - <%= @zone %></title>
+ <link rel="stylesheet" href="dns.css" type="text/css" media="all" />
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.css" />
+ <!--[if lte IE 8]>
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.ie.css" />
+ <![endif]-->
+ <script type="text/javascript" src="http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.js"></script>
+ <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
+ <script type="text/javascript" src="dns.js"></script>
+ </head>
+ <body onload="createMap('map', 'json/<%= @zone %>.json')">
+ <div id="map"></div>
+ </body>
+</html>