]> git.openstreetmap.org Git - chef.git/blob - cookbooks/blogs/recipes/default.rb
Centralise ruby installation in a new 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 "accounts"
21 include_recipe "apache"
22 include_recipe "git"
23 include_recipe "ruby"
24
25 package %W[
26   make
27   gcc
28   g++
29   libsqlite3-dev
30 ]
31
32 directory "/srv/blogs.openstreetmap.org" do
33   owner "blogs"
34   group "blogs"
35   mode "755"
36 end
37
38 git "/srv/blogs.openstreetmap.org" do
39   action :sync
40   repository "https://github.com/gravitystorm/blogs.osm.org.git"
41   depth 1
42   user "blogs"
43   group "blogs"
44   notifies :run, "bundle_install[/srv/blogs.openstreetmap.org]", :immediately
45 end
46
47 bundle_install "/srv/blogs.openstreetmap.org" do
48   action :nothing
49   options "--deployment"
50   user "blogs"
51   group "blogs"
52   notifies :run, "bundle_exec[/srv/blogs.openstreetmap.org]", :immediately
53 end
54
55 bundle_exec "/srv/blogs.openstreetmap.org" do
56   action :nothing
57   command "pluto build -t osm -o build"
58   user "blogs"
59   group "blogs"
60 end
61
62 ssl_certificate "blogs.openstreetmap.org" do
63   domains ["blogs.openstreetmap.org", "blogs.osm.org"]
64   notifies :reload, "service[apache2]"
65 end
66
67 apache_site "blogs.openstreetmap.org" do
68   template "apache.erb"
69   directory "/srv/blogs.openstreetmap.org/build"
70   variables :aliases => ["blogs.osm.org"]
71 end
72
73 template "/usr/local/bin/blogs-update" do
74   source "blogs-update.erb"
75   owner "root"
76   group "root"
77   mode "0755"
78 end
79
80 cron_d "blogs" do
81   minute "*/30"
82   user "blogs"
83   command "/usr/local/bin/blogs-update"
84   mailto "admins@openstreetmap.org"
85 end