pmcf 1.88.3 → 1.89.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cluster.mjs +37 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "1.88.3",
3
+ "version": "1.89.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/cluster.mjs CHANGED
@@ -113,17 +113,22 @@ export class Cluster extends Host {
113
113
  cfg.push(" auth_pass pass1234");
114
114
  cfg.push(" }");
115
115
 
116
-
117
- cfg.push(` notify_master "/usr/bin/systemctl start ${cluster.name}-master.target"`);
118
- cfg.push(` notify_backup "/usr/bin/systemctl start ${cluster.name}-backup.target"`);
119
- cfg.push(` notify_fault "/usr/bin/systemctl start ${cluster.name}-fault.target"`);
116
+ cfg.push(
117
+ ` notify_master "/usr/bin/systemctl start ${cluster.name}-master.target"`
118
+ );
119
+ cfg.push(
120
+ ` notify_backup "/usr/bin/systemctl start ${cluster.name}-backup.target"`
121
+ );
122
+ cfg.push(
123
+ ` notify_fault "/usr/bin/systemctl start ${cluster.name}-fault.target"`
124
+ );
120
125
 
121
126
  cfg.push("}");
122
127
  cfg.push("");
123
128
 
124
- for (const service of cluster.findServices({ type: "http" })) {
129
+ for (const service of cluster.findServices({ type: "http|dns|smtp" })) {
125
130
  cfg.push(`virtual_server ${cluster.rawAddress} ${service.port} {`);
126
- cfg.push(" delay_loop 6");
131
+ cfg.push(" delay_loop 10");
127
132
  cfg.push(" lb_algo wlc");
128
133
  cfg.push(" persistence_timeout 600");
129
134
  cfg.push(` protocol ${service.protocol.toUpperCase()}`);
@@ -136,12 +141,26 @@ export class Cluster extends Host {
136
141
  );
137
142
  cfg.push(` weight ${memberService.weight}`);
138
143
 
139
- switch (service.protocol) {
140
- case "tcp":
141
- cfg.push(` TCP_CHECK {`);
142
- cfg.push(" connect_timeout 3");
144
+ switch (service.type) {
145
+ case "dns":
146
+ cfg.push(` DNS_CHECK {`);
147
+ cfg.push(" type A");
148
+ cfg.push(" name google.com");
143
149
  cfg.push(" }");
144
150
  break;
151
+ case "smtp":
152
+ cfg.push(` SMTP_CHECK {`);
153
+ cfg.push(" }");
154
+ break;
155
+
156
+ default:
157
+ switch (service.protocol) {
158
+ case "tcp":
159
+ cfg.push(` TCP_CHECK {`);
160
+ cfg.push(" connect_timeout 10");
161
+ cfg.push(" }");
162
+ break;
163
+ }
145
164
  }
146
165
 
147
166
  cfg.push(" }");
@@ -163,7 +182,9 @@ export class Cluster extends Host {
163
182
  `${this.name}-master.target`,
164
183
  [
165
184
  "[Unit]",
166
- `Description=Services to be activated in master state of cluster ${this.name}`
185
+ `Description=Target for master state of cluster ${this.name}`,
186
+ "PartOf=keepalived.service",
187
+ `Conflicts=${this.name}-fault.target`
167
188
  ]
168
189
  );
169
190
 
@@ -172,7 +193,9 @@ export class Cluster extends Host {
172
193
  `${this.name}-backup.target`,
173
194
  [
174
195
  "[Unit]",
175
- `Description=Services to be activated in backup state of cluster ${this.name}`
196
+ `Description=Target for backup state of cluster ${this.name}`,
197
+ "PartOf=keepalived.service",
198
+ `Conflicts=${this.name}-fault.target`
176
199
  ]
177
200
  );
178
201
 
@@ -181,7 +204,8 @@ export class Cluster extends Host {
181
204
  `${this.name}-fault.target`,
182
205
  [
183
206
  "[Unit]",
184
- `Description=Services to be activated in fault state of cluster ${this.name}`
207
+ `Description=Target for fault state of cluster ${this.name}`,
208
+ `Conflicts=${this.name}-master.target ${this.name}-backup.target`
185
209
  ]
186
210
  );
187
211