]> git.openstreetmap.org Git - chef.git/blob - cookbooks/imagery/resources/layer.rb
Imagery: au-agri, hamps-aerial, ossv, surrey-aerial
[chef.git] / cookbooks / imagery / resources / layer.rb
1 #
2 # Cookbook Name:: imagery
3 # Resource:: imagery_layer
4 #
5 # Copyright 2016, 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 default_action :create
21
22 property :name, String
23 property :site, String, :required => true
24 property :source, String, :required => true
25 property :text, String
26 property :copyright, String, :default => "Copyright"
27 property :projection, String, :default => "EPSG:3857"
28 property :palette, String
29 property :extent, String
30 property :background, String
31 property :resample, String, :default => "average"
32 property :imagemode, String
33 property :extension, String
34 property :max_zoom, Fixnum, :default => 23
35
36 action :create do
37   template "/srv/imagery/mapserver/layer-#{name}.map" do
38     cookbook "imagery"
39     source "mapserver.map.erb"
40     owner "root"
41     group "root"
42     mode 0644
43     variables new_resource.to_hash
44   end
45
46   template "/etc/init/mapserv-fgi-layer-#{name}.conf" do
47     cookbook "imagery"
48     source "mapserv_fcgi.conf.erb"
49     owner "root"
50     group "root"
51     mode 0644
52     variables new_resource.to_hash
53   end
54
55   service "mapserv-fgi-layer-#{name}.conf" do
56     provider Chef::Provider::Service::Upstart
57     action [:enable, :start]
58     supports :status => true, :restart => true, :reload => false
59     subscribes :restart, "template[/srv/imagery/mapserver/layer-#{name}.map]"
60     subscribes :restart, "template[/etc/init/mapserv-fgi-layer-#{name}.conf]"
61   end
62 end