]> git.openstreetmap.org Git - chef.git/blob - cookbooks/serverinfo/recipes/default.rb
c027480d9b0df9ef6d2a67153ddaf816c527769f
[chef.git] / cookbooks / serverinfo / recipes / default.rb
1 #
2 # Cookbook Name:: serverinfo
3 # Recipe:: default
4 #
5 # Copyright 2015, 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::ssl"
21 include_recipe "git"
22
23 package "ruby"
24 package "ruby-dev"
25
26 gem_package "jekyll"
27
28 git "/srv/hardware.openstreetmap.org" do
29   action :sync
30   repository "git://github.com/gravitystorm/osmf-server-info.git"
31   user "root"
32   group "root"
33   notifies :run, "execute[/srv/hardware.openstreetmap.org]"
34 end
35
36 nodes = { :rows => search(:node, "*:*") }
37 roles = { :rows => search(:role, "*:*") }
38
39 file "/srv/hardware.openstreetmap.org/_data/nodes.json" do
40   content nodes.to_json
41   mode 0o644
42   owner "root"
43   group "root"
44   notifies :run, "execute[/srv/hardware.openstreetmap.org]"
45 end
46
47 file "/srv/hardware.openstreetmap.org/_data/roles.json" do
48   content roles.to_json
49   mode 0o644
50   owner "root"
51   group "root"
52   notifies :run, "execute[/srv/hardware.openstreetmap.org]"
53 end
54
55 directory "/srv/hardware.openstreetmap.org/_site" do
56   mode 0o755
57   owner "nobody"
58   group "nogroup"
59 end
60
61 execute "/srv/hardware.openstreetmap.org" do
62   action :nothing
63   command "jekyll build --trace"
64   cwd "/srv/hardware.openstreetmap.org"
65   user "nobody"
66   group "nogroup"
67 end
68
69 ssl_certificate "hardware.openstreetmap.org" do
70   domains "hardware.openstreetmap.org"
71   notifies :reload, "service[apache2]"
72 end
73
74 apache_site "hardware.openstreetmap.org" do
75   template "apache.erb"
76   directory "/srv/hardware.openstreetmap.org/_site"
77 end