]> git.openstreetmap.org Git - chef.git/blob - cookbooks/blogs/recipes/default.rb
Use bundler 1.x for the blogs cookbook
[chef.git] / cookbooks / blogs / recipes / default.rb
1 #
2 # Cookbook:: blogs
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 "apache"
21 include_recipe "git"
22
23 package %w[
24   ruby
25   ruby-dev
26   make
27   gcc
28   libsqlite3-dev
29 ]
30
31 gem_package "bundler" do
32   version "~> 1.17.2"
33 end
34
35 directory "/srv/blogs.openstreetmap.org" do
36   owner "blogs"
37   group "blogs"
38   mode 0o755
39 end
40
41 git "/srv/blogs.openstreetmap.org" do
42   action :sync
43   repository "git://github.com/gravitystorm/blogs.osm.org.git"
44   user "blogs"
45   group "blogs"
46   notifies :run, "execute[/srv/blogs.openstreetmap.org/Gemfile]", :immediately
47 end
48
49 execute "/srv/blogs.openstreetmap.org/Gemfile" do
50   action :nothing
51   command "bundle install"
52   cwd "/srv/blogs.openstreetmap.org"
53   user "root"
54   group "root"
55   notifies :run, "execute[/srv/blogs.openstreetmap.org]", :immediately
56 end
57
58 execute "/srv/blogs.openstreetmap.org" do
59   action :nothing
60   command "bundle exec /usr/local/bin/pluto build -t osm -o build"
61   cwd "/srv/blogs.openstreetmap.org"
62   user "blogs"
63   group "blogs"
64 end
65
66 ssl_certificate "blogs.openstreetmap.org" do
67   domains ["blogs.openstreetmap.org", "blogs.osm.org"]
68   notifies :reload, "service[apache2]"
69 end
70
71 apache_site "blogs.openstreetmap.org" do
72   template "apache.erb"
73   directory "/srv/blogs.openstreetmap.org/build"
74   variables :aliases => ["blogs.osm.org"]
75 end
76
77 template "/etc/cron.d/blogs" do
78   source "cron.erb"
79   owner "root"
80   group "root"
81   mode "0644"
82 end