]> git.openstreetmap.org Git - chef.git/blob - cookbooks/gps-tile/recipes/default.rb
ed60f1fd7619fedd456157caad50a2a9acd2f2ed
[chef.git] / cookbooks / gps-tile / recipes / default.rb
1 #
2 # Cookbook Name:: gps-tile
3 # Recipe:: default
4 #
5 # Copyright 2013, OpenStreetMap Foundation
6 #
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
10 #
11 #     http://www.apache.org/licenses/LICENSE-2.0
12 #
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.
18 #
19
20 include_recipe "apache"
21
22 package "make"
23 package "build-essential"
24 package "pkg-config"
25 package "zlib1g-dev"
26 package "libbz2-dev"
27 package "libarchive-dev"
28 package "libexpat1-dev"
29 package "libpng-dev"
30 package "pngquant"
31 package "libcache-memcached-perl"
32
33 directory "/srv/gps-tile.openstreetmap.org" do
34   owner "gpstile"
35   group "gpstile"
36   mode 0o755
37 end
38
39 git "/srv/gps-tile.openstreetmap.org/import" do
40   action :sync
41   repository "git://github.com/ericfischer/gpx-import.git"
42   revision "live"
43   user "gpstile"
44   group "gpstile"
45 end
46
47 execute "/srv/gps-tile.openstreetmap.org/import/src/Makefile" do
48   action :nothing
49   command "make"
50   cwd "/srv/gps-tile.openstreetmap.org/import/src"
51   user "gpstile"
52   group "gpstile"
53   subscribes :run, "git[/srv/gps-tile.openstreetmap.org/import]"
54 end
55
56 git "/srv/gps-tile.openstreetmap.org/datamaps" do
57   action :sync
58   repository "git://github.com/ericfischer/datamaps.git"
59   revision "live"
60   user "gpstile"
61   group "gpstile"
62 end
63
64 execute "/srv/gps-tile.openstreetmap.org/datamaps/Makefile" do
65   action :nothing
66   command "make"
67   cwd "/srv/gps-tile.openstreetmap.org/datamaps"
68   user "gpstile"
69   group "gpstile"
70   subscribes :run, "git[/srv/gps-tile.openstreetmap.org/datamaps]"
71 end
72
73 git "/srv/gps-tile.openstreetmap.org/updater" do
74   action :sync
75   repository "git://github.com/ericfischer/gpx-updater.git"
76   revision "live"
77   user "gpstile"
78   group "gpstile"
79 end
80
81 template "/etc/init.d/gps-update" do
82   source "update.init.erb"
83   owner "root"
84   group "root"
85   mode 0o755
86 end
87
88 service "gps-update" do
89   action [:enable, :start]
90   supports :restart => true, :status => true
91   subscribes :restart, "git[/srv/gps-tile.openstreetmap.org/updater]"
92 end
93
94 remote_directory "/srv/gps-tile.openstreetmap.org/html" do
95   source "html"
96   owner "gpstile"
97   group "gpstile"
98   mode 0o755
99   files_owner "gpstile"
100   files_group "gpstile"
101   files_mode 0o644
102 end
103
104 apache_module "headers"
105
106 ssl_certificate "gps-tile.openstreetmap.org" do
107   domains ["gps-tile.openstreetmap.org",
108            "a.gps-tile.openstreetmap.org",
109            "b.gps-tile.openstreetmap.org",
110            "c.gps-tile.openstreetmap.org",
111            "gps.tile.openstreetmap.org",
112            "gps-a.tile.openstreetmap.org",
113            "gps-b.tile.openstreetmap.org",
114            "gps-c.tile.openstreetmap.org"]
115   notifies :reload, "service[apache2]"
116 end
117
118 apache_site "gps-tile.openstreetmap.org" do
119   template "apache.erb"
120 end