querysub 0.569.0 → 0.571.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/appSecrets.ts +21 -0
- package/package.json +1 -1
- package/src/deployManager/components/ProcessesView.tsx +5 -4
- package/src/deployManager/machineApplyMainCode.ts +227 -410
- package/src/deployManager/machineController.ts +15 -9
- package/src/deployManager/processLogs.ts +32 -41
- package/src/deployManager/processManager.ts +102 -88
package/appSecrets.ts
CHANGED
|
@@ -23,6 +23,8 @@ export const getCloudflareCreds = lazy(async (): Promise<{ key: string; email: s
|
|
|
23
23
|
|
|
24
24
|
/** Serves the secret keys sliftutils' getSecret expects, reading them the way querysub already does: backblaze creds off disk (getBackblazePath), cloudflare creds from the keys archives bucket (with its local file fallback). */
|
|
25
25
|
export async function getAppSecret(key: string): Promise<string | undefined> {
|
|
26
|
+
// HACK: This is used by the storage server. Which we want to shut down immediately. That way the next instance can start up. The sword server already looks for notifications about when it's going to be shutting down and it flushes to disk early in this case, so it should be fairly safe to hard kill it.
|
|
27
|
+
doImmediateShutdown();
|
|
26
28
|
// Import query sub so our logs go to our actual log server. Otherwise we won't know if we get any errors.
|
|
27
29
|
Querysub;
|
|
28
30
|
if (key.startsWith("backblaze.json.")) {
|
|
@@ -39,3 +41,22 @@ export async function getAppSecret(key: string): Promise<string | undefined> {
|
|
|
39
41
|
}
|
|
40
42
|
return undefined;
|
|
41
43
|
}
|
|
44
|
+
|
|
45
|
+
let doImmediateShutdown = lazy(() => {
|
|
46
|
+
// NOTE: This extra code is required to actual capture ctrl+c
|
|
47
|
+
if (process.platform === "win32") {
|
|
48
|
+
var rl = require("readline").createInterface({
|
|
49
|
+
input: process.stdin,
|
|
50
|
+
output: process.stdout
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
rl.on("SIGINT", function () {
|
|
54
|
+
process.emit("SIGINT");
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function doShutdown() {
|
|
58
|
+
console.log("SIGINT received, shutting down immediately");
|
|
59
|
+
process.exit();
|
|
60
|
+
}
|
|
61
|
+
process.on("SIGINT", doShutdown);
|
|
62
|
+
});
|
package/package.json
CHANGED
|
@@ -32,14 +32,15 @@ class ProcessOutput extends qreact.Component<{ record: ProcessRecord; machineNod
|
|
|
32
32
|
private unmounted = false;
|
|
33
33
|
componentDidMount() {
|
|
34
34
|
// Props are synchronized state, so the plain values the async work needs are read here
|
|
35
|
-
let { folder,
|
|
35
|
+
let { folder, pid, startTime } = this.props.record;
|
|
36
36
|
let nodeId = this.props.machineNodeId;
|
|
37
37
|
let callbackId = this.callbackId;
|
|
38
38
|
this.watching = (async () => {
|
|
39
39
|
await watchProcessOutput({
|
|
40
40
|
nodeId,
|
|
41
41
|
folder,
|
|
42
|
-
|
|
42
|
+
pid,
|
|
43
|
+
startTime,
|
|
43
44
|
callbackId,
|
|
44
45
|
onData: async (data: string) => {
|
|
45
46
|
Querysub.commit(() => {
|
|
@@ -153,9 +154,9 @@ class MachineProcesses extends qreact.Component<{ machineId: string; applyNodeId
|
|
|
153
154
|
{this.state.showHistorical && `Hide ${historical.length} historical` || `Show ${historical.length} historical`}
|
|
154
155
|
</Button>}
|
|
155
156
|
</div>
|
|
156
|
-
{running.map(record => <ProcessRow key={record.
|
|
157
|
+
{running.map(record => <ProcessRow key={`${record.pid}-${record.startTime}`} record={record} machineNodeId={this.props.applyNodeId} />)}
|
|
157
158
|
{this.state.showHistorical && historical.map(record =>
|
|
158
|
-
<ProcessRow key={record.
|
|
159
|
+
<ProcessRow key={`${record.pid}-${record.startTime}`} record={record} machineNodeId={this.props.applyNodeId} />
|
|
159
160
|
)}
|
|
160
161
|
</div>;
|
|
161
162
|
}
|