2 # Cookbook Name:: taginfo
5 # Copyright 2014, OpenStreetMap Foundation
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
22 include_recipe "apache::ssl"
23 include_recipe "passenger"
26 package "libsqlite3-dev"
28 package "libosmpbf-dev"
29 package "libprotobuf-dev"
30 package "libboost-dev"
31 package "libexpat1-dev"
32 package "libsparsehash-dev"
33 package "libgd2-xpm-dev"
46 gem_package "sinatra-r18n"
47 gem_package "rack-contrib"
49 node[:taginfo][:sites].each do |site|
51 directory = site[:directory] || "/srv/#{name}"
52 description = site[:description]
54 contact = site[:contact]
56 directory directory do
62 git "#{directory}/osmium" do
64 repository "git://github.com/joto/osmium.git"
70 git "#{directory}/taginfo" do
72 repository "git://github.com/joto/taginfo.git"
78 settings = JSON.parse(IO.read("#{directory}/taginfo/taginfo-config-example.json"))
80 settings["instance"]["url"] = "http://#{name}/"
81 settings["instance"]["description"] = description
82 settings["instance"]["icon"] = "/img/logo/#{icon}.png"
83 settings["instance"]["contact"] = contact
84 settings["opensearch"]["shortname"] = "Taginfo"
85 settings["opensearch"]["contact"] = "webmaster@openstreetmap.org"
86 settings["tagstats"]["cxxflags"] = "-I../../osmium/include"
88 file "#{directory}/taginfo-config.json" do
92 content JSON.pretty_generate(settings)
95 execute "#{directory}/taginfo/tagstats/Makefile" do
98 cwd "#{directory}/taginfo/tagstats"
101 subscribes :run, "git[#{directory}/osmium]"
102 subscribes :run, "git[#{directory}/taginfo]"
103 notifies :restart, "service[apache2]"
106 directory "#{directory}/planet" do
112 remote_file "#{directory}/planet/planet.pbf" do
113 action :create_if_missing
114 source "http://planet.openstreetmap.org/pbf/planet-latest.osm.pbf"
120 template "#{directory}/planet/configuration.txt" do
121 source "configuration.txt.erb"
127 file "#{directory}/planet/download.lock" do
133 directory "#{directory}/bin" do
139 template "#{directory}/bin/update-planet" do
140 source "update-planet.erb"
144 variables :directory => directory
147 directory "#{directory}/data" do
154 template "apache.erb"
155 directory "#{directory}/taginfo/web/public"