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