]> git.openstreetmap.org Git - chef.git/blob - cookbooks/imagery/recipes/default.rb
80bf71bfe00875dcb166a2a6f413a0a3d165abd2
[chef.git] / cookbooks / imagery / recipes / default.rb
1 #
2 # Cookbook:: imagery
3 # Recipe:: default
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 #     https://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 "nginx"
21 include_recipe "git"
22
23 # Imagery gdal Requirements
24 package %w[
25   gdal-bin
26   # python-gdal - disable while broken in gis unstable repo
27 ]
28
29 # Imagery MapServer + Mapcache Requirements
30 package %w[
31   cgi-mapserver
32   mapcache-cgi
33   mapcache-tools
34 ]
35
36 # Mapserver via Nginx requires as fastcgi spawner
37 package %w[
38   spawn-fcgi
39   multiwatch
40 ]
41
42 # Imagery processing Requirements
43 package "imagemagick"
44
45 # Imagery misc compression
46 package %w[
47   xz-utils
48   unzip
49 ]
50
51 directory "/srv/imagery/mapserver" do
52   owner "root"
53   group "root"
54   mode 0o755
55   recursive true
56 end
57
58 directory "/srv/imagery/common" do
59   owner "root"
60   group "root"
61   mode 0o755
62   recursive true
63 end
64
65 directory "/srv/imagery/common/ostn02-ntv2-data" do
66   owner "root"
67   group "root"
68   mode 0o755
69 end
70
71 remote_file "#{Chef::Config[:file_cache_path]}/ostn02-ntv2-data.zip" do
72   source "https://www.ordnancesurvey.co.uk/docs/gps/ostn02-ntv2-data.zip"
73   not_if { ::File.exist?("/srv/imagery/common/ostn02-ntv2-data/OSTN02_NTv2.gsb") }
74 end
75
76 execute "unzip-ostn02-ntv2-data" do
77   command "unzip -q #{Chef::Config[:file_cache_path]}/ostn02-ntv2-data.zip"
78   cwd "/srv/imagery/common/ostn02-ntv2-data"
79   user "root"
80   group "root"
81   not_if { ::File.exist?("/srv/imagery/common/ostn02-ntv2-data/OSTN02_NTv2.gsb") }
82 end
83
84 nginx_site "default" do
85   template "nginx_default.conf.erb"
86   directory "/srv/imagery/default"
87   restart_nginx false
88 end
89
90 systemd_tmpfile "/run/mapserver-fastcgi" do
91   type "d"
92   owner "imagery"
93   group "imagery"
94   mode "0755"
95 end