summaryrefslogtreecommitdiff
path: root/puppet/modules/site_couchdb/manifests/mirror.pp
blob: abe35c4ccca4f6334097938d458ba6af2d6738d9 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
class site_couchdb::mirror {

  Class['site_couchdb::add_users']
    -> Class['site_couchdb::mirror']

  class { 'couchdb':
    admin_pw            => $site_couchdb::couchdb_admin_pw,
    admin_salt          => $site_couchdb::couchdb_admin_salt,
    chttpd_bind_address => '127.0.0.1'
  }

  $masters = $site_couchdb::couchdb_config['replication']['masters']
  $master_node_names = keys($site_couchdb::couchdb_config['replication']['masters'])
  $master_node = $masters[$master_node_names[0]]
  $user = $site_couchdb::couchdb_replication_user
  $password = $site_couchdb::couchdb_replication_pw
  $from_host = $master_node['domain_internal']
  $from_port = $master_node['couch_port']
  $from = "http://${user}:${password}@${from_host}:${from_port}"

  notice("mirror from: ${from}")

  ### customer database
  couchdb::mirror_db { 'customers':
    from => $from,
    require => Couchdb::Query::Setup['localhost']
  }

  ## identities database
  couchdb::mirror_db { 'identities':
    from => $from,
    require => Couchdb::Query::Setup['localhost']
  }

  ## keycache database
  couchdb::mirror_db { 'keycache':
    from => $from,
    require => Couchdb::Query::Setup['localhost']
  }

  ## sessions database
  couchdb::mirror_db { 'sessions':
    from => $from,
    require => Couchdb::Query::Setup['localhost']
  }

  ## shared database
  couchdb::mirror_db { 'shared':
    from => $from,
    require => Couchdb::Query::Setup['localhost']
  }

  ## tickets database
  couchdb::mirror_db { 'tickets':
    from => $from,
    require => Couchdb::Query::Setup['localhost']
  }

  ## tokens database
  couchdb::mirror_db { 'tokens':
    from => $from,
    require => Couchdb::Query::Setup['localhost']
  }

  ## users database
  couchdb::mirror_db { 'users':
    from => $from,
    require => Couchdb::Query::Setup['localhost']
  }

  ## messages db
  couchdb::mirror_db { 'messages':
    from => $from,
    require => Couchdb::Query::Setup['localhost']
  }

}