pmcf 2.59.6 → 2.60.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 +12 -10
- package/src/host.mjs +17 -13
- package/src/services/systemd-journal-remote.mjs +11 -6
- package/src/services/systemd-journal-upload.mjs +2 -2
- package/src/services/systemd-journal.mjs +1 -1
- package/src/services/systemd-resolved.mjs +2 -2
- package/src/services/systemd-timesyncd.mjs +2 -2
- package/types/services/systemd-journal-remote.d.mts +2 -2
- package/types/services/systemd-journal-upload.d.mts +1 -1
- package/types/services/systemd-journal.d.mts +1 -1
- package/types/services/systemd-resolved.d.mts +1 -1
- package/types/services/systemd-timesyncd.d.mts +1 -1
package/package.json
CHANGED
package/src/cluster.mjs
CHANGED
|
@@ -106,15 +106,22 @@ export class Cluster extends Host {
|
|
|
106
106
|
cfg.push(` state ${cluster.masters.has(ni) ? "MASTER" : "BACKUP"}`);
|
|
107
107
|
cfg.push(` interface ${ni.name}`);
|
|
108
108
|
|
|
109
|
-
cfg.push(" virtual_ipaddress {");
|
|
110
109
|
for (const na of cluster.networkAddresses(
|
|
111
110
|
na => na.networkInterface.kind !== "loopback"
|
|
112
111
|
)) {
|
|
112
|
+
cfg.push(
|
|
113
|
+
` ${
|
|
114
|
+
na.family === "IPv4"
|
|
115
|
+
? "virtual_ipaddress"
|
|
116
|
+
: "virtual_ipaddress_excluded"
|
|
117
|
+
} {`
|
|
118
|
+
);
|
|
113
119
|
cfg.push(
|
|
114
120
|
` ${na.cidrAddress} dev ${ni.name} label ${cluster.name}`
|
|
115
121
|
);
|
|
122
|
+
cfg.push(" }");
|
|
116
123
|
}
|
|
117
|
-
|
|
124
|
+
|
|
118
125
|
cfg.push(` virtual_router_id ${cluster.routerId}`);
|
|
119
126
|
cfg.push(
|
|
120
127
|
` priority ${host.priority + (cluster.masters.has(ni) ? 0 : 5)}`
|
|
@@ -127,17 +134,12 @@ export class Cluster extends Host {
|
|
|
127
134
|
cfg.push(" }");
|
|
128
135
|
|
|
129
136
|
cfg.push(
|
|
130
|
-
` notify_master "/usr/bin/systemctl start ${cluster.name}-master.target"
|
|
131
|
-
|
|
132
|
-
cfg.push(
|
|
133
|
-
` notify_backup "/usr/bin/systemctl start ${cluster.name}-backup.target"`
|
|
134
|
-
);
|
|
135
|
-
cfg.push(
|
|
137
|
+
` notify_master "/usr/bin/systemctl start ${cluster.name}-master.target"`,
|
|
138
|
+
` notify_backup "/usr/bin/systemctl start ${cluster.name}-backup.target"`,
|
|
136
139
|
` notify_fault "/usr/bin/systemctl start ${cluster.name}-fault.target"`
|
|
137
140
|
);
|
|
138
141
|
|
|
139
|
-
cfg.push("}");
|
|
140
|
-
cfg.push("");
|
|
142
|
+
cfg.push("}", "");
|
|
141
143
|
|
|
142
144
|
for (const endpoint of serviceEndpoints(cluster, {
|
|
143
145
|
services: { type: "http" },
|
package/src/host.mjs
CHANGED
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
domainFromDominName,
|
|
9
9
|
domainName,
|
|
10
10
|
writeLines,
|
|
11
|
-
sectionLines
|
|
11
|
+
sectionLines,
|
|
12
|
+
asArray
|
|
12
13
|
} from "./utils.mjs";
|
|
13
14
|
import { objectFilter } from "./filter.mjs";
|
|
14
15
|
import { addType, types } from "./types.mjs";
|
|
@@ -457,7 +458,7 @@ export class Host extends ServiceOwner {
|
|
|
457
458
|
|
|
458
459
|
for (const networkInterface of this.networkInterfaces.values()) {
|
|
459
460
|
for (const s of networkInterface.subnets()) {
|
|
460
|
-
sn.set(s.address,s);
|
|
461
|
+
sn.set(s.address, s);
|
|
461
462
|
}
|
|
462
463
|
}
|
|
463
464
|
|
|
@@ -514,17 +515,20 @@ export class Host extends ServiceOwner {
|
|
|
514
515
|
await generateKnownHosts(this.owner.hosts(), join(dir, "root", ".ssh"));
|
|
515
516
|
|
|
516
517
|
for (const service of this.services) {
|
|
517
|
-
if (service.
|
|
518
|
-
const {
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
518
|
+
if (service.systemdConfigs) {
|
|
519
|
+
for (const {
|
|
520
|
+
serviceName,
|
|
521
|
+
configFileName,
|
|
522
|
+
content
|
|
523
|
+
} of asArray(service.systemdConfigs(this.name))) {
|
|
524
|
+
await writeLines(dir, configFileName, sectionLines(...content));
|
|
525
|
+
|
|
526
|
+
addHook(
|
|
527
|
+
packageData.properties.hooks,
|
|
528
|
+
"post_install",
|
|
529
|
+
`systemctl enable ${serviceName}`
|
|
530
|
+
);
|
|
531
|
+
}
|
|
528
532
|
}
|
|
529
533
|
}
|
|
530
534
|
|
|
@@ -32,11 +32,16 @@ export class SystemdJournalRemoteService extends Service {
|
|
|
32
32
|
return SystemdJournalRemoteServiceTypeDefinition.name;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
return
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
systemdConfigs(name) {
|
|
36
|
+
return [
|
|
37
|
+
{
|
|
38
|
+
serviceName: "systemd-journal-remote.service",
|
|
39
|
+
configFileName: `etc/systemd/journal-remote.conf.d/${name}.conf`,
|
|
40
|
+
content: ["Remote", {}]
|
|
41
|
+
} /*,
|
|
42
|
+
{
|
|
43
|
+
serviceName: "systemd-journal-remote.socket"
|
|
44
|
+
}*/
|
|
45
|
+
];
|
|
41
46
|
}
|
|
42
47
|
}
|
|
@@ -34,9 +34,9 @@ export class SystemdJournalUploadService extends Service {
|
|
|
34
34
|
return SystemdJournalUploadServiceTypeDefinition.name;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
systemdConfigs(name) {
|
|
38
38
|
return {
|
|
39
|
-
serviceName: "systemd-journal-upload",
|
|
39
|
+
serviceName: "systemd-journal-upload.service",
|
|
40
40
|
configFileName: `etc/systemd/journal-upload.conf.d/${name}.conf`,
|
|
41
41
|
content: ["Upload", {
|
|
42
42
|
URL : this.url
|
|
@@ -32,7 +32,7 @@ export class SystemdJournalService extends Service {
|
|
|
32
32
|
return SystemdJournalServiceTypeDefinition.name;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
systemdConfigs(name) {
|
|
36
36
|
return {
|
|
37
37
|
serviceName: "systemd-journald",
|
|
38
38
|
configFileName: `etc/systemd/journal.conf.d/${name}.conf`,
|
|
@@ -36,7 +36,7 @@ export class SystemdResolvedService extends ExtraSourceService {
|
|
|
36
36
|
return SystemdResolvedServiceTypeDefinition.name;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
systemdConfigs(name) {
|
|
40
40
|
const options = (priority, limit) => {
|
|
41
41
|
return {
|
|
42
42
|
services: { type: "dns", priority },
|
|
@@ -48,7 +48,7 @@ export class SystemdResolvedService extends ExtraSourceService {
|
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
return {
|
|
51
|
-
serviceName: "systemd-resolved",
|
|
51
|
+
serviceName: "systemd-resolved.service",
|
|
52
52
|
configFileName: `etc/systemd/resolved.conf.d/${name}.conf`,
|
|
53
53
|
content: [
|
|
54
54
|
"Resolve",
|
|
@@ -36,9 +36,9 @@ export class SystemdTimesyncdService extends ExtraSourceService {
|
|
|
36
36
|
return SystemdTimesyncdServiceTypeDefinition.name;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
systemdConfigs(name) {
|
|
40
40
|
return {
|
|
41
|
-
serviceName: "systemd-timesyncd",
|
|
41
|
+
serviceName: "systemd-timesyncd.service",
|
|
42
42
|
configFileName: `etc/systemd/timesyncd.conf.d/${name}.conf`,
|
|
43
43
|
content: [
|
|
44
44
|
"Time",
|
|
@@ -245,10 +245,10 @@ export class SystemdJournalRemoteService extends Service {
|
|
|
245
245
|
};
|
|
246
246
|
get type(): string;
|
|
247
247
|
get systemdServices(): string;
|
|
248
|
-
|
|
248
|
+
systemdConfigs(name: any): {
|
|
249
249
|
serviceName: string;
|
|
250
250
|
configFileName: string;
|
|
251
251
|
content: {}[];
|
|
252
|
-
};
|
|
252
|
+
}[];
|
|
253
253
|
}
|
|
254
254
|
import { Service } from "pmcf";
|
|
@@ -251,7 +251,7 @@ export class SystemdJournalUploadService extends Service {
|
|
|
251
251
|
};
|
|
252
252
|
get type(): string;
|
|
253
253
|
get systemdServices(): string;
|
|
254
|
-
|
|
254
|
+
systemdConfigs(name: any): {
|
|
255
255
|
serviceName: string;
|
|
256
256
|
configFileName: string;
|
|
257
257
|
content: (string | {
|
|
@@ -245,7 +245,7 @@ export class SystemdJournalService extends Service {
|
|
|
245
245
|
};
|
|
246
246
|
get type(): string;
|
|
247
247
|
get systemdServices(): string;
|
|
248
|
-
|
|
248
|
+
systemdConfigs(name: any): {
|
|
249
249
|
serviceName: string;
|
|
250
250
|
configFileName: string;
|
|
251
251
|
content: (string | {
|
|
@@ -244,7 +244,7 @@ export class SystemdResolvedService extends ExtraSourceService {
|
|
|
244
244
|
properties: {};
|
|
245
245
|
};
|
|
246
246
|
get systemdServices(): string;
|
|
247
|
-
|
|
247
|
+
systemdConfigs(name: any): {
|
|
248
248
|
serviceName: string;
|
|
249
249
|
configFileName: string;
|
|
250
250
|
content: (string | {
|
|
@@ -244,7 +244,7 @@ export class SystemdTimesyncdService extends ExtraSourceService {
|
|
|
244
244
|
properties: {};
|
|
245
245
|
};
|
|
246
246
|
get systemdServices(): string;
|
|
247
|
-
|
|
247
|
+
systemdConfigs(name: any): {
|
|
248
248
|
serviceName: string;
|
|
249
249
|
configFileName: string;
|
|
250
250
|
content: (string | {
|