pmcf 1.87.4 → 1.88.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.
- package/package.json +1 -1
- package/src/cluster.mjs +33 -0
- package/src/service.mjs +12 -1
- package/types/service.d.mts +6 -0
package/package.json
CHANGED
package/src/cluster.mjs
CHANGED
|
@@ -110,6 +110,12 @@ export class Cluster extends Host {
|
|
|
110
110
|
cfg.push(" auth_type PASS");
|
|
111
111
|
cfg.push(" auth_pass pass1234");
|
|
112
112
|
cfg.push(" }");
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
cfg.push(` notify_master "/usr/bin/systemctl start ${host.name}-master.target"`);
|
|
116
|
+
cfg.push(` notify_backup "/usr/bin/systemctl start ${host.name}-backup.target"`);
|
|
117
|
+
cfg.push(` notify_fault "/usr/bin/systemctl start ${host.name}-fault.target"`);
|
|
118
|
+
|
|
113
119
|
cfg.push("}");
|
|
114
120
|
cfg.push("");
|
|
115
121
|
|
|
@@ -150,6 +156,33 @@ export class Cluster extends Host {
|
|
|
150
156
|
cfg
|
|
151
157
|
);
|
|
152
158
|
|
|
159
|
+
await writeLines(
|
|
160
|
+
join(packageStagingDir, "/usr/lib/systemd/system"),
|
|
161
|
+
`${this.name}-master.target`,
|
|
162
|
+
[
|
|
163
|
+
"[Unit]",
|
|
164
|
+
`Description: Services to be activated in master state of cluster ${this.name}`
|
|
165
|
+
]
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
await writeLines(
|
|
169
|
+
join(packageStagingDir, "/usr/lib/systemd/system"),
|
|
170
|
+
`${this.name}-backup.target`,
|
|
171
|
+
[
|
|
172
|
+
"[Unit]",
|
|
173
|
+
`Description: Services to be activated in backup state of cluster ${this.name}`
|
|
174
|
+
]
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
await writeLines(
|
|
178
|
+
join(packageStagingDir, "/usr/lib/systemd/system"),
|
|
179
|
+
`${this.name}-fault.target`,
|
|
180
|
+
[
|
|
181
|
+
"[Unit]",
|
|
182
|
+
`Description: Services to be activated in fault state of cluster ${this.name}`
|
|
183
|
+
]
|
|
184
|
+
);
|
|
185
|
+
|
|
153
186
|
yield result;
|
|
154
187
|
}
|
|
155
188
|
}
|
package/src/service.mjs
CHANGED
|
@@ -54,7 +54,8 @@ const ServiceTypeDefinition = {
|
|
|
54
54
|
priority: { type: "number", collection: false, writeable: true },
|
|
55
55
|
weight: { type: "number", collection: false, writeable: true },
|
|
56
56
|
srvPrefix: { type: "string", collection: false, writeable: false },
|
|
57
|
-
tls: { type: "string", collection: false, writeable: false }
|
|
57
|
+
tls: { type: "string", collection: false, writeable: false },
|
|
58
|
+
systemd: { type: "string", collection: true, writeable: true }
|
|
58
59
|
}
|
|
59
60
|
};
|
|
60
61
|
|
|
@@ -65,6 +66,7 @@ export class Service extends Base {
|
|
|
65
66
|
#type;
|
|
66
67
|
#port;
|
|
67
68
|
#ipAddresses;
|
|
69
|
+
#systemd;
|
|
68
70
|
|
|
69
71
|
static {
|
|
70
72
|
addType(this);
|
|
@@ -98,6 +100,10 @@ export class Service extends Base {
|
|
|
98
100
|
data.ipAddresses = this.#ipAddresses;
|
|
99
101
|
}
|
|
100
102
|
|
|
103
|
+
if (this.#systemd) {
|
|
104
|
+
data.systemd = this.#systemd;
|
|
105
|
+
}
|
|
106
|
+
|
|
101
107
|
// @ts-ignore
|
|
102
108
|
return new this.constructor(owner, data);
|
|
103
109
|
}
|
|
@@ -191,6 +197,11 @@ export class Service extends Base {
|
|
|
191
197
|
return ServiceTypes[this.type]?.tls || false;
|
|
192
198
|
}
|
|
193
199
|
|
|
200
|
+
get systemdServices()
|
|
201
|
+
{
|
|
202
|
+
return this.#systemd;
|
|
203
|
+
}
|
|
204
|
+
|
|
194
205
|
get srvPrefix() {
|
|
195
206
|
const st = ServiceTypes[this.type];
|
|
196
207
|
if (st?.protocol) {
|
package/types/service.d.mts
CHANGED
|
@@ -97,6 +97,11 @@ export class Service extends Base {
|
|
|
97
97
|
collection: boolean;
|
|
98
98
|
writeable: boolean;
|
|
99
99
|
};
|
|
100
|
+
systemd: {
|
|
101
|
+
type: string;
|
|
102
|
+
collection: boolean;
|
|
103
|
+
writeable: boolean;
|
|
104
|
+
};
|
|
100
105
|
cidrAddresses: {
|
|
101
106
|
type: string;
|
|
102
107
|
collection: boolean;
|
|
@@ -138,6 +143,7 @@ export class Service extends Base {
|
|
|
138
143
|
get master(): any;
|
|
139
144
|
get protocol(): any;
|
|
140
145
|
get tls(): any;
|
|
146
|
+
get systemdServices(): any;
|
|
141
147
|
get srvPrefix(): string;
|
|
142
148
|
dnsRecordsForDomainName(domainName: any, hasSVRRecords: any): {
|
|
143
149
|
key: any;
|