|
1 | 1 | class profiles::uitid::mailing ( |
2 | | - String $servername, |
3 | | - Variant[String,Array[String]] $serveraliases = [], |
4 | | - String $database_password, |
5 | | - String $database_host = '127.0.0.1', |
6 | | - String $config_source, |
7 | | - String $version = 'latest', |
8 | | - String $repository = 'uitid-mailing', |
9 | | - Boolean $deployment = true, |
10 | | - Boolean $cron_enabled = true, |
11 | | - Optional[String] $initial_heap_size = undef, |
12 | | - Optional[String] $maximum_heap_size = undef, |
13 | | - String $mailing_render_cron_schedule, |
14 | | - String $mailing_status_cron_schedule, |
15 | | - Boolean $jmx = true, |
16 | | - Integer $portbase = 4800, |
17 | | - Enum['running', 'stopped'] $service_status = 'running', |
18 | | - Hash $settings = {} |
| 2 | + String $servername, |
| 3 | + String $config_source, |
| 4 | + String $database_password, |
| 5 | + String $mailing_render_cron_schedule, |
| 6 | + String $mailing_status_cron_schedule, |
| 7 | + String $database_host = '127.0.0.1', |
| 8 | + String $version = 'latest', |
| 9 | + Variant[String,Array[String]] $serveraliases = [], |
| 10 | + String $repository = 'uitid-mailing', |
| 11 | + Boolean $deployment = true, |
| 12 | + Boolean $cron_enabled = true, |
| 13 | + Optional[String] $initial_heap_size = undef, |
| 14 | + String $maximum_heap_size = '512m', |
| 15 | + Boolean $jmx = true, |
| 16 | + Integer $portbase = 4800, |
| 17 | + Enum['running', 'stopped'] $service_status = 'running', |
| 18 | + Hash $settings = {} |
19 | 19 |
|
20 | 20 | ) inherits profiles { |
| 21 | + |
21 | 22 | $database_name = 'uitid_mailing' |
22 | 23 | $database_user = 'uitid_mailing' |
| 24 | + $database_host_remote = true |
23 | 25 | $glassfish_domain_http_port = $portbase + 80 |
24 | 26 | $default_attributes = { |
25 | | - user => 'glassfish', |
26 | | - passwordfile => '/home/glassfish/asadmin.pass', |
27 | | - portbase => String($portbase), |
| 27 | + user => 'glassfish', |
| 28 | + passwordfile => '/home/glassfish/asadmin.pass', |
| 29 | + portbase => String($portbase) |
| 30 | + } |
| 31 | + |
| 32 | + if $facts['mysqld_version'] { |
| 33 | + $database_host_available = true |
| 34 | + } else { |
| 35 | + $database_host_available = false |
28 | 36 | } |
29 | 37 |
|
30 | 38 | include profiles::apache |
31 | 39 | include profiles::java |
32 | 40 | include profiles::glassfish |
33 | 41 |
|
34 | | - profiles::apache::vhost::reverse_proxy { "http://${servername}": |
35 | | - destination => "http://127.0.0.1:${glassfish_domain_http_port}/", |
36 | | - aliases => $serveraliases, |
37 | | - preserve_host => true, |
38 | | - } |
| 42 | + realize Group['glassfish'] |
| 43 | + realize User['glassfish'] |
39 | 44 |
|
40 | | - $database_host_remote = true |
| 45 | + realize Apt::Source['publiq-tools'] |
| 46 | + realize Package['mysql-connector-j'] |
41 | 47 |
|
42 | 48 | class { 'profiles::mysql::remote_server': |
43 | | - host => $database_host, |
| 49 | + host => $database_host |
44 | 50 | } |
45 | 51 |
|
46 | | - if $facts['mysqld_version'] { |
47 | | - $database_host_available = true |
48 | | - } else { |
49 | | - $database_host_available = false |
| 52 | + profiles::apache::vhost::reverse_proxy { "http://${servername}": |
| 53 | + destination => "http://127.0.0.1:${glassfish_domain_http_port}/", |
| 54 | + aliases => $serveraliases, |
| 55 | + preserve_host => true |
50 | 56 | } |
51 | | - realize Group['glassfish'] |
52 | | - realize User['glassfish'] |
53 | | - |
54 | | - realize Apt::Source['publiq-tools'] |
55 | | - realize Package['mysql-connector-j'] |
56 | 57 |
|
57 | 58 | profiles::glassfish::domain { 'uitid-mailing': |
58 | 59 | portbase => $portbase, |
|
61 | 62 | jmx => $jmx, |
62 | 63 | service_status => $service_status, |
63 | 64 | require => Class['profiles::glassfish'], |
64 | | - notify => Service['uitid-mailing'], |
| 65 | + notify => Service['uitid-mailing'] |
65 | 66 | } |
66 | 67 |
|
67 | 68 | if $database_host_available { |
68 | 69 | mysql_database { $database_name: |
69 | 70 | charset => 'utf8mb4', |
70 | | - collate => 'utf8mb4_unicode_ci', |
| 71 | + collate => 'utf8mb4_unicode_ci' |
71 | 72 | } |
72 | 73 |
|
73 | 74 | profiles::mysql::app_user { "${database_user}@${database_name}": |
74 | 75 | password => $database_password, |
75 | 76 | remote => $database_host_remote, |
76 | | - require => Mysql_database[$database_name], |
| 77 | + require => Mysql_database[$database_name] |
77 | 78 | } |
78 | 79 |
|
79 | 80 | jdbcconnectionpool { 'mysql_uitid_mailing_j2eePool': |
80 | 81 | ensure => 'present', |
81 | 82 | resourcetype => 'javax.sql.DataSource', |
82 | 83 | dsclassname => 'com.mysql.cj.jdbc.MysqlDataSource', |
83 | 84 | properties => { |
84 | | - 'serverName' => $database_host, |
85 | | - 'portNumber' => '3306', |
86 | | - 'databaseName' => $database_name, |
87 | | - 'User' => $database_user, |
88 | | - 'Password' => $database_password, |
89 | | - 'URL' => "jdbc:mysql://${database_host}:3306/${database_name}", |
90 | | - 'driverClass' => 'com.mysql.cj.jdbc.Driver', |
91 | | - 'characterEncoding' => 'UTF-8', |
92 | | - 'useUnicode' => true, |
93 | | - 'useSSL' => false, |
94 | | - }, |
| 85 | + 'serverName' => $database_host, |
| 86 | + 'portNumber' => '3306', |
| 87 | + 'databaseName' => $database_name, |
| 88 | + 'User' => $database_user, |
| 89 | + 'Password' => $database_password, |
| 90 | + 'URL' => "jdbc:mysql://${database_host}:3306/${database_name}", |
| 91 | + 'driverClass' => 'com.mysql.cj.jdbc.Driver', |
| 92 | + 'characterEncoding' => 'UTF-8', |
| 93 | + 'useUnicode' => true, |
| 94 | + 'useSSL' => false |
| 95 | + }, |
95 | 96 | require => [Profiles::Glassfish::Domain['uitid-mailing'], Profiles::Mysql::App_user["${database_user}@${database_name}"]], |
96 | | - * => $default_attributes, |
| 97 | + * => $default_attributes |
97 | 98 | } |
98 | 99 |
|
99 | 100 | jdbcresource { 'jdbc/mailing': |
100 | 101 | ensure => 'present', |
101 | 102 | connectionpool => 'mysql_uitid_mailing_j2eePool', |
102 | 103 | require => Jdbcconnectionpool['mysql_uitid_mailing_j2eePool'], |
103 | | - * => $default_attributes, |
| 104 | + * => $default_attributes |
104 | 105 | } |
105 | 106 |
|
106 | 107 | if $deployment { |
|
116 | 117 | Package['mysql-connector-j'] -> Class['profiles::uitid::mailing::deployment'] |
117 | 118 | File['Domain uitid-mailing mysql-connector-j'] -> Class['profiles::uitid::mailing::deployment'] |
118 | 119 | Profiles::Mysql::App_user["${database_user}@${database_name}"] -> Class['profiles::uitid::mailing::deployment'] |
| 120 | + Profiles::Glassfish::Domain['uitid-mailing'] -> Class['profiles::uitid::mailing::deployment'] |
119 | 121 | Class['profiles::uitid::mailing::deployment'] ~> Service['uitid-mailing'] |
120 | 122 | } |
121 | 123 | } |
| 124 | + |
122 | 125 | set { 'server.network-config.protocols.protocol.http-listener-1.http.scheme-mapping': |
123 | 126 | ensure => 'present', |
124 | 127 | value => 'X-Forwarded-Proto', |
125 | 128 | require => Profiles::Glassfish::Domain['uitid-mailing'], |
126 | 129 | notify => Service['uitid-mailing'], |
127 | | - * => $default_attributes, |
| 130 | + * => $default_attributes |
128 | 131 | } |
129 | 132 |
|
130 | 133 | set { 'server.thread-pools.thread-pool.http-thread-pool.max-thread-pool-size': |
131 | 134 | ensure => 'present', |
132 | 135 | value => '32', |
133 | 136 | require => Profiles::Glassfish::Domain['uitid-mailing'], |
134 | 137 | notify => Service['uitid-mailing'], |
135 | | - * => $default_attributes, |
| 138 | + * => $default_attributes |
136 | 139 | } |
137 | 140 |
|
138 | 141 | jvmoption { 'Clear domain uitid-mailing default truststore': |
139 | 142 | ensure => 'absent', |
140 | 143 | option => '-Djavax.net.ssl.trustStore=\$\{com.sun.aas.instanceRoot\}/config/cacerts.jks', |
141 | 144 | require => Profiles::Glassfish::Domain['uitid-mailing'], |
142 | 145 | notify => Service['uitid-mailing'], |
143 | | - * => $default_attributes, |
| 146 | + * => $default_attributes |
144 | 147 | } |
145 | 148 |
|
146 | 149 | jvmoption { 'Domain uitid-mailing truststore': |
147 | 150 | ensure => 'present', |
148 | 151 | option => '-Djavax.net.ssl.trustStore=/etc/ssl/certs/java/cacerts', |
149 | 152 | require => Profiles::Glassfish::Domain['uitid-mailing'], |
150 | 153 | notify => Service['uitid-mailing'], |
151 | | - * => $default_attributes, |
| 154 | + * => $default_attributes |
152 | 155 | } |
153 | 156 |
|
154 | 157 | jvmoption { 'Domain uitid-mailing timezone': |
155 | 158 | ensure => 'present', |
156 | 159 | option => '-Duser.timezone=CET', |
157 | 160 | require => Profiles::Glassfish::Domain['uitid-mailing'], |
158 | 161 | notify => Service['uitid-mailing'], |
159 | | - * => $default_attributes, |
| 162 | + * => $default_attributes |
160 | 163 | } |
161 | 164 |
|
162 | 165 | $settings.each |$name, $value| { |
|
165 | 168 | value => $value, |
166 | 169 | require => Profiles::Glassfish::Domain['uitid-mailing'], |
167 | 170 | notify => Service['uitid-mailing'], |
168 | | - * => $default_attributes, |
| 171 | + * => $default_attributes |
169 | 172 | } |
170 | 173 | } |
| 174 | + |
171 | 175 | profiles::glassfish::domain::service_alias { 'uitid-mailing': |
172 | | - require => Profiles::Glassfish::Domain['uitid-mailing'], |
| 176 | + require => Profiles::Glassfish::Domain['uitid-mailing'] |
173 | 177 | } |
174 | 178 |
|
175 | 179 | service { 'uitid-mailing': |
176 | 180 | ensure => $service_status, |
177 | 181 | hasstatus => true, |
178 | 182 | enable => $service_status ? { |
179 | | - 'running' => true, |
180 | | - 'stopped' => false |
181 | | - }, |
182 | | - require => Profiles::Glassfish::Domain::Service_alias['uitid-mailing'], |
| 183 | + 'running' => true, |
| 184 | + 'stopped' => false |
| 185 | + }, |
| 186 | + require => Profiles::Glassfish::Domain::Service_alias['uitid-mailing'] |
183 | 187 | } |
184 | 188 |
|
185 | 189 | file { 'Domain uitid-mailing mysql-connector-j': |
186 | 190 | ensure => 'file', |
187 | 191 | path => '/opt/payara/glassfish/lib/mysql-connector-j.jar', |
188 | 192 | source => '/usr/share/java/mysql-connector-j.jar', |
189 | 193 | require => Package['mysql-connector-j'], |
190 | | - before => Profiles::Glassfish::Domain['uitid-mailing'], |
| 194 | + before => Profiles::Glassfish::Domain['uitid-mailing'] |
191 | 195 | } |
192 | 196 | } |
0 commit comments