]> git.openstreetmap.org Git - chef.git/blob - cookbooks/gps-tile/recipes/default.rb
Revert "systemd: fix property limit_cpu type"
[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 #     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 "apache"
21
22 package %w[
23   make
24   build-essential
25   pkg-config
26   zlib1g-dev
27   libbz2-dev
28   libarchive-dev
29   libexpat1-dev
30   libpng-dev
31   pngquant
32   libcache-memcached-perl
33 ]
34
35 directory "/srv/gps-tile.openstreetmap.org" do
36   owner "gpstile"
37   group "gpstile"
38   mode 0o755
39 end
40
41 git "/srv/gps-tile.openstreetmap.org/import" do
42   action :sync
43   repository "git://github.com/ericfischer/gpx-import.git"
44   revision "live"
45   user "gpstile"
46   group "gpstile"
47 end
48
49 execute "/srv/gps-tile.openstreetmap.org/import/src/Makefile" do
50   action :nothing
51   command "make"
52   cwd "/srv/gps-tile.openstreetmap.org/import/src"
53   user "gpstile"
54   group "gpstile"
55   subscribes :run, "git[/srv/gps-tile.openstreetmap.org/import]"
56 end
57
58 git "/srv/gps-tile.openstreetmap.org/datamaps" do
59   action :sync
60   repository "git://github.com/ericfischer/datamaps.git"
61   revision "live"
62   user "gpstile"
63   group "gpstile"
64 end
65
66 execute "/srv/gps-tile.openstreetmap.org/datamaps/Makefile" do
67   action :nothing
68   command "make"
69   cwd "/srv/gps-tile.openstreetmap.org/datamaps"
70   user "gpstile"
71   group "gpstile"
72   subscribes :run, "git[/srv/gps-tile.openstreetmap.org/datamaps]"
73 end
74
75 git "/srv/gps-tile.openstreetmap.org/updater" do
76   action :sync
77   repository "git://github.com/ericfischer/gpx-updater.git"
78   revision "live"
79   user "gpstile"
80   group "gpstile"
81 end
82
83 systemd_service "gps-update" do
84   description "GPS tile update daemon"
85   after ["network.target", "memcached.service"]
86   wants ["memcached.service"]
87   user "gpstile"
88   working_directory "/srv/gps-tile.openstreetmap.org"
89   exec_start "/srv/gps-tile.openstreetmap.org/updater/update"
90   private_tmp true
91   private_devices true
92   protect_system "full"
93   protect_home true
94   no_new_privileges true
95   restart "on-failure"
96 end
97
98 service "gps-update" do
99   action [:enable, :start]
100   subscribes :restart, "git[/srv/gps-tile.openstreetmap.org/updater]"
101   subscribes :restart, "systemd_service[gps-update]"
102 end
103
104 remote_directory "/srv/gps-tile.openstreetmap.org/html" do
105   source "html"
106   owner "gpstile"
107   group "gpstile"
108   mode 0o755
109   files_owner "gpstile"
110   files_group "gpstile"
111   files_mode 0o644
112 end
113
114 apache_module "headers"
115 apache_module "rewrite"
116
117 ssl_certificate "gps-tile.openstreetmap.org" do
118   domains ["gps-tile.openstreetmap.org",
119            "a.gps-tile.openstreetmap.org",
120            "b.gps-tile.openstreetmap.org",
121            "c.gps-tile.openstreetmap.org",
122            "gps.tile.openstreetmap.org",
123            "gps-a.tile.openstreetmap.org",
124            "gps-b.tile.openstreetmap.org",
125            "gps-c.tile.openstreetmap.org"]
126   notifies :reload, "service[apache2]"
127 end
128
129 apache_site "gps-tile.openstreetmap.org" do
130   template "apache.erb"
131 end