LEFT | RIGHT |
(no file at all) | |
1 # == Class: codereview | 1 # == Class: codereview |
2 # | 2 # |
3 # A codereview server setup based on Rietveld and PostgreSQL. | 3 # A codereview server setup based on Rietveld. |
4 # | 4 # |
5 # === Parameters: | 5 # === Parameters: |
6 # | 6 # |
7 # [*domain*] | 7 # [*domain*] |
8 # The auhority part of the URL the Rietveld instance is associated with. | 8 # The auhority part of the URL the Rietveld instance is associated with. |
9 # | 9 # |
10 # [*is_default*] | 10 # [*is_default*] |
11 # Whether the $domain shall become set up as default (or fallback) | 11 # Whether the $domain shall become set up as default (or fallback) |
12 # within the HTTP daemon. | 12 # within the HTTP daemon. |
13 # | 13 # |
14 # [*certificate*] | 14 # [*certificate*] |
15 # The name of the SSL certificate file within modules/private/files, if | 15 # The name of the SSL certificate file within modules/private/files, if |
16 # any. Requires a private_key as well. | 16 # any. Requires a private_key as well. |
17 # | 17 # |
18 # [*private_key*] | 18 # [*private_key*] |
19 # The name of the private key file within modules/private/files, if any. | 19 # The name of the private key file within modules/private/files, if any. |
20 # Requires a certificate as well. | 20 # Requires a certificate as well. |
21 # | 21 # |
22 # [*database_account*] | |
23 # The name of the database account Rietveld shall use. | |
24 # | |
25 # [*database_password*] | |
26 # The password identifying Rietveld with the database. | |
27 # | |
28 # [*database_name*] | |
29 # The name of the Rietveld database within the RDBMS. | |
30 # | |
31 # === Examples: | 22 # === Examples: |
32 # | 23 # |
33 # class {'codereview': | 24 # class {'codereview': |
34 # domain => 'localhost', | 25 # domain => 'localhost', |
35 # database_name => 'codereview', | |
36 # database_account => 'codereview', | |
37 # database_password => 'swordfish', | |
38 # } | 26 # } |
39 # | 27 # |
40 class codereview( | 28 class codereview( |
41 $domain, | 29 $domain, |
42 $is_default = false, | 30 $is_default = false, |
43 $certificate = undef, | 31 $certificate = undef, |
44 $private_key = undef, | 32 $private_key = undef, |
45 $database_account = hiera('codereview::database_account', 'rietveld'), | |
46 $database_password = hiera('codereview::database_password', 'changeme'), | |
47 $database_name = hiera('codereview::database_name', 'codereview'), | |
48 ) { | 33 ) { |
49 | |
50 class {'postgresql::server': | |
51 } | |
52 | |
53 postgresql::server::database {$database_name: | |
54 } | |
55 -> | |
56 postgresql::server::role {$database_account: | |
57 db => $database_name, | |
58 password_hash => postgresql_password($database_account, $database_password), | |
59 login => true, | |
60 superuser => false, | |
61 } | |
62 -> | |
63 postgresql::server::database_grant {$database_account: | |
64 db => $database_name, | |
65 privilege => 'ALL', | |
66 role => $database_account, | |
67 } | |
68 | 34 |
69 class {'rietveld': | 35 class {'rietveld': |
70 domain => $domain, | 36 domain => $domain, |
71 certificate => $certificate, | 37 certificate => $certificate, |
72 private_key => $private_key, | 38 private_key => $private_key, |
73 is_default => $is_default, | 39 is_default => $is_default, |
74 database => { | |
75 'engine' => 'postgresql_psycopg2', | |
76 'name' => $database_name, | |
77 'user' => $database_account, | |
78 'password' => $database_password, | |
79 }, | |
80 } | 40 } |
81 | 41 |
82 package {['python-psycopg2']: | |
83 ensure => installed, | |
84 } | |
85 | |
86 Class['rietveld'] <- Package['python-psycopg2'] | |
87 Class['rietveld'] <- Postgresql::Server::Database_grant[$database_account] | |
88 } | 42 } |
89 | |
LEFT | RIGHT |