querysub 0.292.0 → 0.294.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "querysub",
3
- "version": "0.292.0",
3
+ "version": "0.294.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "note1": "note on node-forge fork, see https://github.com/digitalbazaar/forge/issues/744 for details",
@@ -10,7 +10,6 @@ import { delay, runInSerial, runInfinitePoll, runInfinitePollCallAtStart } from
10
10
  import { compare, compareArray, isNodeTrue, sort, timeInMinute } from "socket-function/src/misc";
11
11
  import { cacheLimited, lazy } from "socket-function/src/caching";
12
12
  import { canHaveChildren } from "socket-function/src/types";
13
- import { registerShutdownHandler, shutdown } from "../diagnostics/periodic";
14
13
  import { hostArchives } from "../-b-authorities/cdnAuthority";
15
14
  import { getModuleFromConfig } from "../3-path-functions/pathFunctionLoader";
16
15
  import path from "path";
@@ -26,7 +25,6 @@ import { onEdgeNodesChanged } from "./edgeBootstrap";
26
25
  import { startEdgeNotifier } from "./edgeClientWatcher";
27
26
  import { getGitRefLive, getGitURLLive } from "./git";
28
27
  import { DeployProgress } from "./deployFunctions";
29
- import { watchOnRollingUpdate } from "../deployManager/machineController";
30
28
 
31
29
  const UPDATE_POLL_INTERVAL = timeInMinute * 15;
32
30
  const DEAD_NODE_COUNT_THRESHOLD = 15;
@@ -89,8 +87,9 @@ export async function registerEdgeNode(config: {
89
87
  }
90
88
  registeredEdgeNode = true;
91
89
  let host = config.host;
90
+ await delay(0);
92
91
 
93
-
92
+ const { registerShutdownHandler } = await import("../diagnostics/periodic");
94
93
  registerShutdownHandler(async () => {
95
94
  edgeShutdown = true;
96
95
  console.log(magenta(`Removing node from edge node list due to shutdown`));
@@ -99,6 +98,7 @@ export async function registerEdgeNode(config: {
99
98
  }));
100
99
  await updateEdgeNodesFile();
101
100
  });
101
+ const { watchOnRollingUpdate } = await import("../deployManager/machineController");
102
102
  watchOnRollingUpdate({
103
103
  callback: async (time) => {
104
104
  let duration = time - Date.now();
@@ -290,6 +290,7 @@ async function updateEdgeNodesFile() {
290
290
  newEdgeNodeIndex.edgeNodes.push(edgeNodeConfig);
291
291
  }
292
292
 
293
+ console.log(magenta(`Updating ${edgeNodeIndexFile} with ${JSON.stringify(newEdgeNodeIndex)}`));
293
294
  await edgeNodeStorage.set(edgeNodeIndexFile, Buffer.from(JSON.stringify(newEdgeNodeIndex)));
294
295
  }
295
296
 
@@ -26,6 +26,7 @@ export class MachineDetailPage extends qreact.Component {
26
26
  let relevantServiceConfigs = new Map<string, ServiceConfig>();
27
27
  for (let serviceId of serviceList) {
28
28
  let serviceConfig = controller.getServiceConfig(serviceId);
29
+ if (!serviceConfig?.parameters.deploy) continue;
29
30
  if (serviceConfig && serviceConfig.machineIds.includes(selectedMachineId)) {
30
31
  relevantServiceConfigs.set(serviceId, serviceConfig);
31
32
  }
@@ -361,7 +361,7 @@ const runScreenCommand = measureWrap(async function runScreenCommand(config: {
361
361
  console.log(green(`Renaming screen ${screenName} to ${rollingScreenName} for rolling interval ${config.rollingWindow} at ${new Date().toLocaleString()}`));
362
362
  await runPromise(`${prefix}tmux rename-session -t ${screenName} ${rollingScreenName}`);
363
363
  rollingScreens.set(rollingScreenName, screenName);
364
- rollingKeepScreenAlive.set(rollingScreenName, {
364
+ rollingKeepScreenAlive.set(screenName, {
365
365
  rollingScreenName,
366
366
  originalScreenName: screenName,
367
367
  pinnedDuration: config.rollingWindow,
@@ -448,7 +448,16 @@ done`);
448
448
  const killScreen = measureWrap(async function killScreen(config: {
449
449
  screenName: string;
450
450
  }) {
451
+ console.log(red(`Killing screen ${config.screenName}`));
451
452
  let prefix = getTmuxPrefix();
453
+ // Try ctrl+c a few times first
454
+ for (let i = 0; i < 5; i++) {
455
+ if (!await isScreenRunningProcess(config.screenName)) {
456
+ break;
457
+ }
458
+ await runPromise(`${prefix}tmux send-keys -t ${config.screenName} 'C-c' Enter`);
459
+ await delay(5000);
460
+ }
452
461
  await runPromise(`${prefix}tmux kill-session -t ${config.screenName}`);
453
462
  await removeOldNodeId(config.screenName);
454
463
  });
@@ -629,7 +638,10 @@ const resyncServicesBase = runInSerial(measureWrap(async function resyncServices
629
638
  rollingKeepScreenAlive.delete(rollingScreenRemainder);
630
639
  rollingInfo = undefined;
631
640
  }
632
- if (rollingInfo) continue;
641
+ if (rollingInfo) {
642
+ console.log(green(`Skipping killing rolling screen ${screenName} because it's still alive at ${new Date().toLocaleString()}. Keeping it alive until ${new Date(rollingInfo.pinnedTime + rollingInfo.pinnedDuration).toLocaleString()}`));
643
+ continue;
644
+ }
633
645
  }
634
646
  await killScreen({
635
647
  screenName,
@@ -1,26 +1,8 @@
1
1
  Hmm... our cyoa servers are dying very fast... why?
2
2
 
3
- 9) Rolling service updates
4
- - Add rollingWindow to the definition
5
- - Set for public facing services (but not for scripts)
6
- - PathValueServer - 10 minutes
7
- - FunctionRunner - CANNOT use rolling
8
- - HTTP - 4 hours
9
- - Boostrapper - NO rolling
10
- - gc/join - NO rolling
11
- - Show the rolling time in the update buttons (both list and the save button on the details page), so we know it will be a rolling update
12
- - Keep the oldest service alive when we update
13
- - Tracked per serviceId
14
- - Update the rolling time, so if we remove the rolling window we kill the old service immediately
15
- - Notify when servers are outdated
16
- - After min(5 minute, 10% of rolling window size)
17
- - Use the node registration to know the nodeId to talk to, and allow servers to register to get told when they are outdated (and how long before they are shutdown).
18
- - In HTTP server, notify users, in the same way we notify for hash updates, that they will need to switch servers
19
- - Verify this update works with a relatively low rolling update window, ensuring it force refreshes before the server actually restarts.
20
-
21
- 10) Verify we can using a rolling update with CYOA, and that it'll notify users, then refresh (eventually)
22
- - I guess set the rollingWindow to 10 minutes for testing.
23
-
3
+ 1) Verify clientside notifications work when we rolling update cyoa
4
+ 2) Verify edge nodes are removed when we rolling update cyoa
5
+ 3) Update cyoa rolling time back to 4 hours
24
6
 
25
7
  10) Add RAM total, ram % used, cpu count, CPU %, disk size, disk % used to machine info
26
8
  - Show this all in the list page, with nice bars?