From: Tom Hughes Date: Fri, 9 Aug 2013 16:39:43 +0000 (+0100) Subject: Configure a machine to run the database cleanup script each day X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/95ffc03cc70202418d19dae36293f7d6a8ed0e71 Configure a machine to run the database cleanup script each day --- diff --git a/cookbooks/web/recipes/cleanup.rb b/cookbooks/web/recipes/cleanup.rb new file mode 100644 index 000000000..8b8faca43 --- /dev/null +++ b/cookbooks/web/recipes/cleanup.rb @@ -0,0 +1,27 @@ +# +# Cookbook Name:: web +# Recipe:: cleanup +# +# Copyright 2013, OpenStreetMap Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +include_recipe "web::base" + +template "/etc/cron.daily/web-cleanup" do + source "cleanup.cron.erb" + owner "root" + group "root" + mode 0755 +end diff --git a/cookbooks/web/templates/default/cleanup.cron.erb b/cookbooks/web/templates/default/cleanup.cron.erb new file mode 100644 index 000000000..996aeec9a --- /dev/null +++ b/cookbooks/web/templates/default/cleanup.cron.erb @@ -0,0 +1,3 @@ +#!/bin/sh + +<%= node[:web][:base_directory] %>/rails/script/cleanup diff --git a/roles/spike-01.rb b/roles/spike-01.rb index 84622aea0..97fec5fd2 100644 --- a/roles/spike-01.rb +++ b/roles/spike-01.rb @@ -30,5 +30,6 @@ run_list( "role[ic]", "role[web-frontend]", "role[web-gpximport]", - "role[web-statistics]" + "role[web-statistics]", + "role[web-cleanup]" ) diff --git a/roles/web-cleanup.rb b/roles/web-cleanup.rb new file mode 100644 index 000000000..26b2fd4b7 --- /dev/null +++ b/roles/web-cleanup.rb @@ -0,0 +1,7 @@ +name "web-cleanup" +description "Role applied to all web/api database cleanup servers" + +run_list( + "role[web]", + "recipe[web::cleanup]" +)