summaryrefslogtreecommitdiff
path: root/puppet/modules/site_couchdb/manifests/designs.pp
blob: 1ab1c6a1e1ed879101d1bdeffce0b0d856086906 (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
37
38
39
40
41
42
43
44
45
class site_couchdb::designs {

  Class['site_couchdb::create_dbs']
    -> Class['site_couchdb::designs']

  file { '/srv/leap/couchdb/designs':
    ensure  => directory,
    source  => 'puppet:///modules/site_couchdb/designs',
    recurse => true,
    purge   => true,
    mode    => '0755'
  }

  site_couchdb::upload_design {
    'customers':   design => 'customers/Customer.json';
    'identities':  design => 'identities/Identity.json';
    'tickets':     design => 'tickets/Ticket.json';
    'messages':    design => 'messages/Message.json';
    'users':       design => 'users/User.json';
    'tmp_users':   design => 'users/User.json';
    'shared_docs':
      db => 'shared',
      design => 'shared/docs.json';
    'shared_syncs':
      db => 'shared',
      design => 'shared/syncs.json';
    'shared_transactions':
      db => 'shared',
      design => 'shared/transactions.json';
  }

  $sessions_db      = rotated_db_name('sessions', 'monthly')
  $sessions_next_db = rotated_db_name('sessions', 'monthly', 'next')
  site_couchdb::upload_design {
    $sessions_db:       design => 'sessions/Session.json';
    $sessions_next_db:  design => 'sessions/Session.json';
  }

  $tokens_db       = rotated_db_name('tokens', 'monthly')
  $tokens_next_db  = rotated_db_name('tokens', 'monthly', 'next')
  site_couchdb::upload_design {
    $tokens_db:      design => 'tokens/Token.json';
    $tokens_next_db: design => 'tokens/Token.json';
  }
}