--- /dev/null
+Cookbook
+========
+TODO: Enter the cookbook description here.
+
+e.g.
+This cookbook makes your favorite breakfast sandwich.
+
+Requirements
+------------
+TODO: List your cookbook requirements. Be sure to include any requirements this cookbook has on platforms, libraries, other cookbooks, packages, operating systems, etc.
+
+Attributes
+----------
+TODO: List you cookbook attributes here.
+
+Usage
+-----
+TODO: Write usage instructions for each cookbook.
+
+Contributing
+------------
+TODO: (optional) If this is a public cookbook, detail the process for contributing. If this is a private cookbook, remove this section.
+
+e.g.
+1. Fork the repository on Github
+2. Create a named feature branch (like `add_component_x`)
+3. Write your change
+4. Write tests for your change (if applicable)
+5. Run the tests, ensuring they all pass
+6. Submit a Pull Request using Github
+
+License and Authors
+-------------------
+Authors: TODO: List authors
--- /dev/null
+name "taginfo"
+maintainer "OpenStreetMap Administrators"
+maintainer_email "admins@openstreetmap.org"
+license "Apache 2.0"
+description "Installs and configures taginfo"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
+version "1.0.0"
+depends "apache"
+depends "git"
+
+attribute "taginfo",
+ :display_name => "TAGINFO",
+ :description => "Hash of TAGINFO attributes",
+ :type => "hash"
+
+attribute "taginfo/sites",
+ :display_name => "Sites",
+ :description => "Array of TAGINFO sites to setup",
+ :default => []
--- /dev/null
+#
+# Cookbook Name:: taginfo
+# Recipe:: default
+#
+# Copyright 2014, 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 "apache::ssl"
+include_recipe "git"
+
+package "libsqlite3-dev"
+package "zlib1g-dev"
+package "libosmpbf-dev"
+package "libprotobuf-dev"
+package "libboost-dev"
+package "libexpat1-dev"
+package "libsparsehash-dev"
+package "libgd2-xpm-dev"
+package "make"
+package "g++"
+
+package "sqlite3"
+
+package "ruby"
+package "rubygems"
+gem_package "json"
+gem_package "sqlite3"
+gem_package "sinatra"
+gem_package "sinatra-r18n"
+gem_package "rack-contrib"
+
+apache_module "passenger"
+
+munin_plugin "passenger_memory"
+munin_plugin "passenger_processes"
+munin_plugin "passenger_queues"
+munin_plugin "passenger_requests"
+
+node[:taginfo][:sites].each do |site|
+ name = site[:name]
+ directory = site[:directory] || "/srv/#{name}"
+
+ directory directory do
+ owner "taginfo"
+ group "taginfo"
+ mode 0755
+ end
+
+ git "#{directory}/osmium" do
+ action :sync
+ repository "git://github.com/joto/osmium.git"
+ revision "master"
+ user "taginfo"
+ group "taginfo"
+ end
+
+ git "#{directory}/taginfo" do
+ action :sync
+ repository "git://github.com/joto/taginfo.git"
+ revision "master"
+ user "taginfo"
+ group "taginfo"
+ end
+
+ settings = edit_file "#{directory}/taginfo/taginfo-config-example.json" do |line|
+ line.gsub!(/^( *)"cxxflags": ".*",/, "\\1\"cxxflags\": \"-I../../osmium/include\",")
+
+ line
+ end
+
+ file "#{directory}/taginfo-config.json" do
+ owner "taginfo"
+ group "taginfo"
+ mode 0644
+ content settings
+ end
+
+ execute "#{directory}/taginfo/tagstats/Makefile" do
+ action :nothing
+ command "make"
+ cwd "#{directory}/taginfo/tagstats"
+ user "taginfo"
+ group "taginfo"
+ subscribes :run, "git[#{directory}/osmium]"
+ subscribes :run, "git[#{directory}/taginfo]"
+ notifies :restart, "service[apache2]"
+ end
+
+ directory "#{directory}/data" do
+ owner "taginfo"
+ group "taginfo"
+ mode 0755
+ end
+
+ apache_site name do
+ template "apache.erb"
+ directory "#{directory}/taginfo/web/public"
+ end
+end
--- /dev/null
+# DO NOT EDIT - This file is being maintained by Chef
+
+<% [80, 443].each do |port| -%>
+
+<VirtualHost *:<%= port %>>
+ ServerName <%= @name %>
+ ServerAdmin webmaster@openstreetmap.org
+<% if port == 443 -%>
+
+ SSLEngine on
+<% end -%>
+
+ CustomLog /var/log/apache2/<%= @name %>-access.log combined
+ ErrorLog /var/log/apache2/<%= @name %>-error.log
+
+ DocumentRoot <%= @directory %>
+ RackEnv production
+ PassengerMinInstances 10
+ PassengerPreStart http://<%= @name %>/
+</VirtualHost>
+<% end -%>