]> git.openstreetmap.org Git - chef.git/blob - cookbooks/switch2osm/recipes/default.rb
switch2osm: add temporary workaround until for missing config
[chef.git] / cookbooks / switch2osm / recipes / default.rb
1 #
2 # Cookbook:: switch2osm
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 include_recipe "apache"
20 include_recipe "git"
21
22 package %w[
23   ruby
24   ruby-dev
25   zlib1g-dev
26 ]
27
28 gem_package "bundler" do
29   version "1.17.3"
30 end
31
32 git "/srv/switch2osm.org" do
33   action :sync
34   repository "https://github.com/switch2osm/switch2osm.github.io.git"
35   user "root"
36   group "root"
37   notifies :run, "execute[/srv/switch2osm.org/Gemfile]"
38 end
39
40 directory "/srv/switch2osm.org/_site" do
41   mode 0o755
42   owner "nobody"
43   group "nogroup"
44 end
45
46 # Workaround https://github.com/jekyll/jekyll/issues/7804
47 # by creating a .jekyll-cache folder
48 directory "/srv/switch2osm.org/.jekyll-cache" do
49   mode 0o755
50   owner "nobody"
51   group "nogroup"
52 end
53
54 execute "/srv/switch2osm.org/Gemfile" do
55   action :nothing
56   command "bundle install --deployment"
57   cwd "/srv/switch2osm.org"
58   user "root"
59   group "root"
60   notifies :run, "execute[/srv/switch2osm.org]"
61 end
62
63 # Temporary workaround until merged: https://github.com/switch2osm/switch2osm.github.io/pull/68
64 file "/srv/switch2osm.org/_config_osm.yml" do
65   mode 0o644
66   user "root"
67   group "root"
68   content "url: https://switch2osm.org"
69 end
70
71 execute "/srv/switch2osm.org" do
72   action :nothing
73   command "bundle exec jekyll build --trace --config _config.yml,_config_osm.yml"
74   cwd "/srv/switch2osm.org"
75   user "nobody"
76   group "nogroup"
77 end
78
79 ssl_certificate "switch2osm.org" do
80   domains ["switch2osm.org",
81            "www.switch2osm.org", "switch2osm.com", "www.switch2osm.com"]
82   notifies :reload, "service[apache2]"
83 end
84
85 apache_site "switch2osm.org" do
86   template "apache.erb"
87   directory "/srv/switch2osm.org/_site"
88 end