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 directory "/var/log/taginfo" do
55 template "/etc/logrotate.d/taginfo" do
56 source "logrotate.erb"
62 node[:taginfo][:sites].each do |site|
64 directory = site[:directory] || "/srv/#{name}"
65 description = site[:description]
67 contact = site[:contact]
69 directory "/var/log/taginfo/#{site}" do
75 directory directory do
81 git "#{directory}/osmium" do
83 repository "git://github.com/joto/osmium.git"
89 git "#{directory}/taginfo" do
91 repository "git://github.com/joto/taginfo.git"
97 settings = JSON.parse(IO.read("#{directory}/taginfo/taginfo-config-example.json"))
99 settings["instance"]["url"] = "http://#{name}/"
100 settings["instance"]["description"] = description
101 settings["instance"]["icon"] = "/img/logo/#{icon}.png"
102 settings["instance"]["contact"] = contact
103 settings["logging"]["directory"] = "/var/log/taginfo/#{site}"
104 settings["opensearch"]["shortname"] = "Taginfo"
105 settings["opensearch"]["contact"] = "webmaster@openstreetmap.org"
106 settings["sources"]["db"]["planetfile"] = "#{directory}/planet/planet.pbf"
107 settings["sources"]["db"]["tagstats"] = "#{directory}/taginfo/tagstats/tagstats"
108 settings["tagstats"]["cxxflags"] = "-I../../osmium/include"
110 file "#{directory}/taginfo-config.json" do
114 content JSON.pretty_generate(settings)
117 execute "#{directory}/taginfo/tagstats/Makefile" do
120 cwd "#{directory}/taginfo/tagstats"
123 subscribes :run, "git[#{directory}/osmium]"
124 subscribes :run, "git[#{directory}/taginfo]"
125 notifies :restart, "service[apache2]"
128 directory "#{directory}/taginfo/web/tmp" do
134 directory "#{directory}/data" do
140 directory "#{directory}/download" do
146 directory "#{directory}/sources" do
152 directory "#{directory}/planet" do
158 remote_file "#{directory}/planet/planet.pbf" do
159 action :create_if_missing
160 source "http://planet.openstreetmap.org/pbf/planet-latest.osm.pbf"
166 directory "#{directory}/planet/log" do
172 directory "#{directory}/planet/replication" do
178 template "#{directory}/planet/replication/configuration.txt" do
179 source "configuration.txt.erb"
185 file "#{directory}/planet/replication/download.lock" do
191 directory "#{directory}/bin" do
197 template "#{directory}/bin/update-planet" do
198 source "update-planet.erb"
202 variables :directory => directory
205 template "#{directory}/bin/update-taginfo" do
206 source "update-taginfo.erb"
210 variables :directory => directory
213 template "#{directory}/bin/update" do
218 variables :directory => directory
222 template "apache.erb"
223 directory "#{directory}/taginfo/web/public"