summaryrefslogtreecommitdiff
path: root/puppet/modules/site_webapp/manifests/cron.pp
blob: 7147a0d2966c5502da891534a6e91e9659894882 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class site_webapp::cron {

  # cron tasks that need to be performed to cleanup the database
  cron {
    'rotate_databases':
      command     => 'cd /srv/leap/webapp && bundle exec rake db:rotate',
      environment => 'RAILS_ENV=production',
      user        => 'root',
      hour        => [0,6,12,18],
      minute      => 0;

    'delete_tmp_databases':
      command     => 'cd /srv/leap/webapp && bundle exec rake db:deletetmp',
      environment => 'RAILS_ENV=production',
      user        => 'root',
      hour        => 1,
      minute      => 1;

    # there is no longer a need to remove expired sessions, since the database
    # will get destroyed.
    'remove_expired_sessions':
      command     => 'cd /srv/leap/webapp && bundle exec rake cleanup:sessions',
      environment => 'RAILS_ENV=production',
      user        => 'leap-webapp',
      hour        => 2,
      minute      => 30,
      ensure      => absent;

    'remove_expired_tokens':
      command     => 'cd /srv/leap/webapp && bundle exec rake cleanup:tokens',
      environment => 'RAILS_ENV=production',
      user        => 'leap-webapp',
      hour        => 3,
      minute      => 0;
  }
}