]> git.openstreetmap.org Git - chef.git/blob - cookbooks/imagery/recipes/default.rb
imagery: Cleanup proj handling with EPSG:27700 conversion
[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 and proj requirements
24 package %w[
25   gdal-bin
26   python3-gdal
27   proj-bin
28 ]
29
30 # Imagery MapServer + Mapcache requirements
31 package %w[
32   cgi-mapserver
33   mapcache-cgi
34   mapcache-tools
35 ]
36
37 # Mapserver via nginx requires as fastcgi spawner
38 package %w[
39   spawn-fcgi
40   multiwatch
41 ]
42
43 # Imagery processing Requirements
44 package "imagemagick"
45
46 # Imagery misc compression
47 package %w[
48   xz-utils
49   unzip
50 ]
51
52 directory "/srv/imagery/mapserver" do
53   owner "root"
54   group "root"
55   mode "755"
56   recursive true
57 end
58
59 directory "/srv/imagery/common" do
60   owner "root"
61   group "root"
62   mode "755"
63   recursive true
64 end
65
66 directory "/srv/imagery/common/ostn02-ntv2-data" do
67   recursive true
68   action :delete
69 end
70
71 # Pre-download uk_os_OSTN15_NTv2_OSGBtoETRS.tif used for EPSG:27700 conversions
72 execute "uk_os_OSTN15_NTv2_OSGBtoETRS.tif" do
73   command "projsync --file uk_os_OSTN15_NTv2_OSGBtoETRS.tif --system-directory"
74   not_if { ::File.exist?("/usr/share/proj/uk_os_OSTN15_NTv2_OSGBtoETRS.tif") }
75 end
76
77 nginx_site "default" do
78   template "nginx_default.conf.erb"
79   directory "/srv/imagery/default"
80 end
81
82 systemd_tmpfile "/run/mapserver-fastcgi" do
83   type "d"
84   owner "imagery"
85   group "imagery"
86   mode "0755"
87 end