5 # Copyright:: 2016, OpenStreetMap Foundation
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
11 # https://www.apache.org/licenses/LICENSE-2.0
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.
20 include_recipe "apache"
40 comment "blogs.openstreetmap.org"
41 home "/srv/blogs.openstreetmap.org"
42 shell "/usr/sbin/nologin"
46 directory "/srv/blogs.openstreetmap.org" do
52 git "/srv/blogs.openstreetmap.org" do
54 repository "https://github.com/gravitystorm/blogs.osm.org.git"
60 bundle_config "/srv/blogs.openstreetmap.org" do
64 settings "deployment" => "true",
65 "without" => "development:test",
66 "build.sqlite3" => "--enable-system-libraries"
67 subscribes :create, "git[/srv/blogs.openstreetmap.org]", :immediately
70 bundle_install "/srv/blogs.openstreetmap.org" do
74 subscribes :run, "git[/srv/blogs.openstreetmap.org]", :immediately
77 bundle_exec "/srv/blogs.openstreetmap.org" do
79 command "pluto build -t osm -o build"
82 subscribes :run, "git[/srv/blogs.openstreetmap.org]", :immediately
83 retries 2 # May fail on first run due to faulty blogs
86 ssl_certificate "blogs.openstreetmap.org" do
87 domains ["blogs.openstreetmap.org", "blogs.osm.org"]
88 notifies :reload, "service[apache2]"
91 apache_site "blogs.openstreetmap.org" do
93 directory "/srv/blogs.openstreetmap.org/build"
94 variables :aliases => ["blogs.osm.org"]
97 template "/usr/local/bin/blogs-update" do
98 source "blogs-update.erb"
104 systemd_service "blogs-update" do
105 description "Update blog aggregator"
106 exec_start "/usr/local/bin/blogs-update"
108 sandbox :enable_network => true
109 read_write_paths "/srv/blogs.openstreetmap.org"
112 systemd_timer "blogs-update" do
113 description "Update blog aggregator"
115 on_unit_inactive_sec "30m"
118 service "blogs-update.timer" do
119 action [:enable, :start]
122 template "/etc/cron.daily/blogs-backup" do
123 source "backup.cron.erb"