]> git.openstreetmap.org Git - chef.git/blob - cookbooks/foundation/recipes/owg.rb
Switch operations site to use ruby 2.8 and bundler 2.x
[chef.git] / cookbooks / foundation / recipes / owg.rb
1 #
2 # Cookbook:: foundation
3 # Recipe:: owg
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 "apache"
21 include_recipe "git"
22
23 package %w[
24   gcc
25   g++
26   make
27   ruby2.7
28   ruby2.7-dev
29   libssl-dev
30   zlib1g-dev
31   pkg-config
32 ]
33
34 gem_package "bundler" do
35   package_name "bundler"
36   version "~> 2.2.22"
37   gem_binary "gem2.7"
38   options "--format-executable"
39 end
40
41 git "/srv/operations.osmfoundation.org" do
42   action :sync
43   repository "https://github.com/openstreetmap/owg-website.git"
44   depth 1
45   user "root"
46   group "root"
47   notifies :run, "execute[/srv/operations.osmfoundation.org/Gemfile]"
48 end
49
50 directory "/srv/operations.osmfoundation.org/_site" do
51   mode "755"
52   owner "nobody"
53   group "nogroup"
54 end
55
56 # Workaround https://github.com/jekyll/jekyll/issues/7804
57 # by creating a .jekyll-cache folder
58 directory "/srv/operations.osmfoundation.org/.jekyll-cache" do
59   mode "755"
60   owner "nobody"
61   group "nogroup"
62 end
63
64 execute "/srv/operations.osmfoundation.org/Gemfile" do
65   action :nothing
66   command "bundle2.7 install --deployment"
67   cwd "/srv/operations.osmfoundation.org"
68   user "root"
69   group "root"
70   notifies :run, "execute[/srv/operations.osmfoundation.org]"
71 end
72
73 execute "/srv/operations.osmfoundation.org" do
74   command "bundle2.7 exec jekyll build --trace"
75   cwd "/srv/operations.osmfoundation.org"
76   user "nobody"
77   group "nogroup"
78 end
79
80 ssl_certificate "operations.osmfoundation.org" do
81   domains "operations.osmfoundation.org"
82   notifies :reload, "service[apache2]"
83 end
84
85 apache_site "operations.osmfoundation.org" do
86   template "apache.owg.erb"
87   directory "/srv/operations.osmfoundation.org/_site"
88 end