@dxos/phoenix 0.3.8-next.f4e0086 → 0.3.8

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.
@@ -26,56 +26,49 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // packages/common/phoenix/src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
29
+ var node_exports = {};
30
+ __export(node_exports, {
33
31
  Phoenix: () => Phoenix,
34
32
  WatchDog: () => WatchDog
35
33
  });
36
- module.exports = __toCommonJS(src_exports);
37
-
38
- // packages/common/phoenix/src/phoenix.ts
34
+ module.exports = __toCommonJS(node_exports);
39
35
  var import_node_child_process = require("node:child_process");
40
- var import_node_fs2 = require("node:fs");
36
+ var import_node_fs = require("node:fs");
41
37
  var import_node_path = require("node:path");
42
38
  var import_pkg_up = __toESM(require("pkg-up"));
43
39
  var import_invariant = require("@dxos/invariant");
44
40
  var import_log = require("@dxos/log");
45
-
46
- // packages/common/phoenix/src/utils.ts
47
- var import_node_fs = require("node:fs");
41
+ var import_node_fs2 = require("node:fs");
48
42
  var import_async = require("@dxos/async");
49
-
50
- // packages/common/phoenix/src/defs.ts
43
+ var import_node_child_process2 = require("node:child_process");
44
+ var import_node_fs3 = require("node:fs");
45
+ var import_async2 = require("@dxos/async");
46
+ var import_invariant2 = require("@dxos/invariant");
47
+ var import_log2 = require("@dxos/log");
51
48
  var WATCHDOG_START_TIMEOUT = 1e4;
52
49
  var WATCHDOG_STOP_TIMEOUT = 1e3;
53
50
  var WATCHDOG_CHECK_INTERVAL = 50;
54
-
55
- // packages/common/phoenix/src/utils.ts
56
51
  var waitForPidDeletion = async (pidFile) => (0, import_async.waitForCondition)({
57
- condition: () => !(0, import_node_fs.existsSync)(pidFile),
52
+ condition: () => !(0, import_node_fs2.existsSync)(pidFile),
58
53
  timeout: WATCHDOG_STOP_TIMEOUT,
59
54
  interval: WATCHDOG_CHECK_INTERVAL
60
55
  });
61
56
  var waitForPidFileBeingFilledWithInfo = async (pidFile) => (0, import_async.waitForCondition)({
62
- condition: () => (0, import_node_fs.readFileSync)(pidFile, {
57
+ condition: () => (0, import_node_fs2.readFileSync)(pidFile, {
63
58
  encoding: "utf-8"
64
59
  }).includes("pid"),
65
60
  timeout: WATCHDOG_START_TIMEOUT,
66
61
  interval: WATCHDOG_CHECK_INTERVAL,
67
62
  error: new Error("Lock file is not being propagated with info.")
68
63
  });
69
-
70
- // packages/common/phoenix/src/phoenix.ts
71
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/common/phoenix/src/phoenix.ts";
64
+ var __dxlog_file = "/home/circleci/project/packages/common/phoenix/src/phoenix.ts";
72
65
  var Phoenix = class _Phoenix {
73
66
  /**
74
67
  * Starts detached watchdog process which starts and monitors selected command.
75
68
  */
76
69
  static async start(params) {
77
70
  {
78
- if ((0, import_node_fs2.existsSync)(params.pidFile)) {
71
+ if ((0, import_node_fs.existsSync)(params.pidFile)) {
79
72
  await _Phoenix.stop(params.pidFile);
80
73
  }
81
74
  await waitForPidDeletion(params.pidFile);
@@ -86,11 +79,11 @@ var Phoenix = class _Phoenix {
86
79
  params.errFile,
87
80
  params.pidFile
88
81
  ].forEach((filename) => {
89
- if (!(0, import_node_fs2.existsSync)(filename)) {
90
- (0, import_node_fs2.mkdirSync)((0, import_node_path.dirname)(filename), {
82
+ if (!(0, import_node_fs.existsSync)(filename)) {
83
+ (0, import_node_fs.mkdirSync)((0, import_node_path.dirname)(filename), {
91
84
  recursive: true
92
85
  });
93
- (0, import_node_fs2.writeFileSync)(filename, "", {
86
+ (0, import_node_fs.writeFileSync)(filename, "", {
94
87
  encoding: "utf-8"
95
88
  });
96
89
  }
@@ -127,10 +120,10 @@ var Phoenix = class _Phoenix {
127
120
  * Stops detached watchdog process by PID info written down in PID file.
128
121
  */
129
122
  static async stop(pidFile, force = false) {
130
- if (!(0, import_node_fs2.existsSync)(pidFile)) {
123
+ if (!(0, import_node_fs.existsSync)(pidFile)) {
131
124
  throw new Error("PID file does not exist");
132
125
  }
133
- const fileContent = (0, import_node_fs2.readFileSync)(pidFile, {
126
+ const fileContent = (0, import_node_fs.readFileSync)(pidFile, {
134
127
  encoding: "utf-8"
135
128
  });
136
129
  if (!fileContent.includes("pid")) {
@@ -151,25 +144,18 @@ var Phoenix = class _Phoenix {
151
144
  ]
152
145
  });
153
146
  if (err.message.includes("ESRCH") || err.name.includes("ESRCH")) {
154
- (0, import_node_fs2.unlinkSync)(pidFile);
147
+ (0, import_node_fs.unlinkSync)(pidFile);
155
148
  } else {
156
149
  throw err;
157
150
  }
158
151
  }
159
152
  }
160
153
  static info(pidFile) {
161
- return JSON.parse((0, import_node_fs2.readFileSync)(pidFile, {
154
+ return JSON.parse((0, import_node_fs.readFileSync)(pidFile, {
162
155
  encoding: "utf-8"
163
156
  }));
164
157
  }
165
158
  };
166
-
167
- // packages/common/phoenix/src/watchdog.ts
168
- var import_node_child_process2 = require("node:child_process");
169
- var import_node_fs3 = require("node:fs");
170
- var import_async2 = require("@dxos/async");
171
- var import_invariant2 = require("@dxos/invariant");
172
- var import_log2 = require("@dxos/log");
173
159
  function _ts_decorate(decorators, target, key, desc) {
174
160
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
175
161
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -180,7 +166,7 @@ function _ts_decorate(decorators, target, key, desc) {
180
166
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
181
167
  return c > 3 && r && Object.defineProperty(target, key, r), r;
182
168
  }
183
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/common/phoenix/src/watchdog.ts";
169
+ var __dxlog_file2 = "/home/circleci/project/packages/common/phoenix/src/watchdog.ts";
184
170
  var WatchDog = class {
185
171
  constructor(_params) {
186
172
  this._params = _params;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/index.ts", "../../../src/phoenix.ts", "../../../src/utils.ts", "../../../src/defs.ts", "../../../src/watchdog.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n// Inspired by https://github.com/foreversd/forever\n// Their copyright notice is included below.\n// Copyright (C) 2010 Charlie Robbins & the Contributors\n//\n\nexport * from './phoenix';\nexport * from './watchdog';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { fork } from 'node:child_process';\nimport { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport pkgUp from 'pkg-up';\n\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\n\nimport { waitForPidDeletion, waitForPidFileBeingFilledWithInfo } from './utils';\nimport { type ProcessInfo, type WatchDogParams } from './watchdog';\n\n/**\n * Utils to start/stop detached process with errors and logs handling.\n */\nexport class Phoenix {\n /**\n * Starts detached watchdog process which starts and monitors selected command.\n */\n static async start(params: WatchDogParams) {\n {\n // Clear stale pid file.\n if (existsSync(params.pidFile)) {\n await Phoenix.stop(params.pidFile);\n }\n\n await waitForPidDeletion(params.pidFile);\n }\n\n {\n // Create log folders.\n [params.logFile, params.errFile, params.pidFile].forEach((filename) => {\n if (!existsSync(filename)) {\n mkdirSync(dirname(filename), { recursive: true });\n writeFileSync(filename, '', { encoding: 'utf-8' });\n }\n });\n }\n\n const watchdogPath = join(dirname(pkgUp.sync({ cwd: __dirname })!), 'bin', 'watchdog');\n\n const watchDog = fork(watchdogPath, [JSON.stringify(params)], {\n detached: true,\n cwd: __dirname,\n });\n\n watchDog.on('exit', (code, signal) => {\n if (code && code !== 0) {\n log.error('Monitor died unexpectedly', { code, signal });\n }\n });\n\n await waitForPidFileBeingFilledWithInfo(params.pidFile);\n\n watchDog.disconnect();\n watchDog.unref();\n\n return Phoenix.info(params.pidFile);\n }\n\n /**\n * Stops detached watchdog process by PID info written down in PID file.\n */\n static async stop(pidFile: string, force = false) {\n if (!existsSync(pidFile)) {\n throw new Error('PID file does not exist');\n }\n const fileContent = readFileSync(pidFile, { encoding: 'utf-8' });\n if (!fileContent.includes('pid')) {\n throw new Error('Invalid PID file content');\n }\n\n const { pid } = JSON.parse(fileContent);\n const signal: NodeJS.Signals = force ? 'SIGKILL' : 'SIGINT';\n try {\n process.kill(pid, signal);\n } catch (err) {\n invariant(err instanceof Error, 'Invalid error type');\n if (err.message.includes('ESRCH') || err.name.includes('ESRCH')) {\n // Process is already dead.\n unlinkSync(pidFile);\n } else {\n throw err;\n }\n }\n }\n\n static info(pidFile: string): ProcessInfo {\n return JSON.parse(readFileSync(pidFile, { encoding: 'utf-8' }));\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { existsSync, readFileSync } from 'node:fs';\n\nimport { waitForCondition } from '@dxos/async';\n\nimport { WATCHDOG_CHECK_INTERVAL, WATCHDOG_START_TIMEOUT, WATCHDOG_STOP_TIMEOUT } from './defs';\n\nexport const waitForPidCreation = async (pidFile: string) =>\n waitForCondition({\n condition: () => existsSync(pidFile),\n timeout: WATCHDOG_START_TIMEOUT,\n interval: WATCHDOG_CHECK_INTERVAL,\n });\n\nexport const waitForPidDeletion = async (pidFile: string) =>\n waitForCondition({\n condition: () => !existsSync(pidFile),\n timeout: WATCHDOG_STOP_TIMEOUT,\n interval: WATCHDOG_CHECK_INTERVAL,\n });\n\nexport const waitForPidFileBeingFilledWithInfo = async (pidFile: string) =>\n waitForCondition({\n condition: () => readFileSync(pidFile, { encoding: 'utf-8' }).includes('pid'),\n timeout: WATCHDOG_START_TIMEOUT,\n interval: WATCHDOG_CHECK_INTERVAL,\n error: new Error('Lock file is not being propagated with info.'),\n });\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport const LOCK_TIMEOUT = 1_000;\nexport const LOCK_CHECK_INTERVAL = 50;\nexport const WATCHDOG_START_TIMEOUT = 10_000;\nexport const WATCHDOG_STOP_TIMEOUT = 1_000;\nexport const WATCHDOG_CHECK_INTERVAL = 50;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type ChildProcessWithoutNullStreams, spawn } from 'node:child_process';\nimport { existsSync, unlinkSync, writeFileSync } from 'node:fs';\nimport { type FileHandle } from 'node:fs/promises';\n\nimport { synchronized } from '@dxos/async';\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\n\nimport { waitForPidDeletion, waitForPidFileBeingFilledWithInfo } from './utils';\n\nexport type ProcessInfo = WatchDogParams & {\n pid?: number;\n started?: number;\n restarts?: number;\n running?: boolean;\n};\n\nexport type WatchDogParams = {\n profile?: string; // Human readable process identifier\n pidFile: string; // Path to PID file\n\n //\n // Log files and associated logging options for this instance\n //\n logFile: string; // Path to log output all logs\n errFile: string; // Path to log output from child stderr\n\n //\n // Basic configuration options\n //\n maxRestarts?: number | undefined; // Sets the maximum number of times a given script should run\n killTree?: boolean | undefined; // Kills the entire child process tree on `exit`\n\n //\n // Command to spawn as well as options and other vars\n // (env, cwd, etc) to pass along\n //\n command: string; // Binary to run (default: 'node')\n args?: string[] | undefined; // Additional arguments to pass to the script,\n\n //\n // More specific options to pass along to `child_process.spawn` which\n // will override anything passed to the `spawnWith` option\n //\n env?: NodeJS.ProcessEnv | undefined;\n cwd?: string | undefined;\n shell?: boolean | undefined;\n};\n\nexport class WatchDog {\n private _lock?: FileHandle;\n private _child?: ChildProcessWithoutNullStreams;\n private _restarts = 0;\n\n constructor(private readonly _params: WatchDogParams) {}\n\n @synchronized\n async start() {\n const { cwd, shell, env, command, args } = { cwd: process.cwd(), ...this._params };\n\n this._log(`Spawning process \\`\\`\\`${command} ${args?.join(' ')}\\`\\`\\``);\n this._child = spawn(command, args, { cwd, shell, env, stdio: 'pipe' });\n\n this._child.stdout.on('data', (data: Uint8Array) => {\n this._log(String(data));\n });\n this._child.stderr.on('data', (data: Uint8Array) => {\n this._err(data);\n });\n this._child.on('close', async (code: number, signal: number | NodeJS.Signals) => {\n if (code && code !== 0 && signal !== 'SIGINT' && signal !== 'SIGKILL') {\n this._err(`Died unexpectedly with exit code ${code} (signal: ${signal}).`);\n await this.restart();\n }\n this._log(`Stopped with exit code ${code} (signal: ${signal}).`);\n if (existsSync(this._params.pidFile)) {\n unlinkSync(this._params.pidFile);\n }\n });\n\n const childInfo: ProcessInfo = {\n pid: this._child.pid,\n started: Date.now(),\n restarts: this._restarts,\n ...this._params,\n };\n\n writeFileSync(this._params.pidFile, JSON.stringify(childInfo, undefined, 2), { encoding: 'utf-8' });\n\n await waitForPidFileBeingFilledWithInfo(this._params.pidFile);\n }\n\n /**\n * Sends SIGKILL to the child process and the tree it spawned (if `killTree` param is `true`).\n */\n @synchronized\n async kill() {\n if (!this._child) {\n return;\n }\n\n await this._killWithSignal('SIGKILL');\n\n if (existsSync(this._params.pidFile)) {\n unlinkSync(this._params.pidFile);\n }\n\n await waitForPidDeletion(this._params.pidFile);\n }\n\n async restart() {\n await this.kill();\n if (this._params.maxRestarts !== undefined && this._restarts >= this._params.maxRestarts) {\n this._err('Max restarts number is reached');\n } else {\n log('Restarting...');\n this._restarts++;\n await this.start();\n }\n }\n\n async _killWithSignal(signal: number | NodeJS.Signals) {\n invariant(this._child?.pid, 'Child process has no pid.');\n this._child.kill(signal);\n this._child = undefined;\n }\n\n private _log(message: string | Uint8Array) {\n writeFileSync(this._params.logFile, message + '\\n', {\n flag: 'a+',\n encoding: 'utf-8',\n });\n }\n\n private _err(message: string | Uint8Array) {\n this._log(message);\n writeFileSync(this._params.errFile, message + '\\n', {\n flag: 'a+',\n encoding: 'utf-8',\n });\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;ACIA,gCAAqB;AACrB,IAAAA,kBAA+E;AAC/E,uBAA8B;AAC9B,oBAAkB;AAElB,uBAA0B;AAC1B,iBAAoB;;;ACNpB,qBAAyC;AAEzC,mBAAiC;;;ACA1B,IAAMC,yBAAyB;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EA,MAAMF,UAAU;AACd,UAAM,KAAKgB,KAAI;AACf,QAAI,KAAKtC,QAAQyC,gBAAgBN,UAAa,KAAKlC,aAAa,KAAKD,QAAQyC,aAAa;AACxF,WAAKtB,KAAK,gCAAA;IACZ,OAAO;AACLuB,2BAAI,iBAAA,QAAA;;;;;;AACJ,WAAKzC;AACL,YAAM,KAAKC,MAAK;IAClB;EACF;EAEA,MAAMqC,gBAAgBlB,QAAiC;AACrDsB,qCAAU,KAAKhC,QAAQgB,KAAK,6BAAA;;;;;;;;;AAC5B,SAAKhB,OAAO2B,KAAKjB,MAAAA;AACjB,SAAKV,SAASwB;EAChB;EAEQ1B,KAAKmC,SAA8B;AACzCZ,uCAAc,KAAKhC,QAAQ6C,SAASD,UAAU,MAAM;MAClDE,MAAM;MACNV,UAAU;IACZ,CAAA;EACF;EAEQjB,KAAKyB,SAA8B;AACzC,SAAKnC,KAAKmC,OAAAA;AACVZ,uCAAc,KAAKhC,QAAQ+C,SAASH,UAAU,MAAM;MAClDE,MAAM;MACNV,UAAU;IACZ,CAAA;EACF;AACF;;EArFGY;GAPUlD,SAAAA,WAAAA,SAAAA,IAAAA;;EA8CVkD;GA9CUlD,SAAAA,WAAAA,QAAAA,IAAAA;",
6
- "names": ["import_node_fs", "WATCHDOG_START_TIMEOUT", "WATCHDOG_STOP_TIMEOUT", "WATCHDOG_CHECK_INTERVAL", "waitForPidDeletion", "pidFile", "waitForCondition", "condition", "existsSync", "timeout", "WATCHDOG_STOP_TIMEOUT", "interval", "WATCHDOG_CHECK_INTERVAL", "waitForPidFileBeingFilledWithInfo", "readFileSync", "encoding", "includes", "WATCHDOG_START_TIMEOUT", "error", "Error", "Phoenix", "start", "params", "existsSync", "pidFile", "stop", "waitForPidDeletion", "logFile", "errFile", "forEach", "filename", "mkdirSync", "dirname", "recursive", "writeFileSync", "encoding", "watchdogPath", "join", "pkgUp", "sync", "cwd", "__dirname", "watchDog", "fork", "JSON", "stringify", "detached", "on", "code", "signal", "log", "error", "waitForPidFileBeingFilledWithInfo", "disconnect", "unref", "info", "force", "Error", "fileContent", "readFileSync", "includes", "pid", "parse", "process", "kill", "err", "invariant", "message", "name", "unlinkSync", "import_node_child_process", "import_node_fs", "import_async", "import_invariant", "import_log", "WatchDog", "constructor", "_params", "_restarts", "start", "cwd", "shell", "env", "command", "args", "process", "_log", "join", "_child", "spawn", "stdio", "stdout", "on", "data", "String", "stderr", "_err", "code", "signal", "restart", "existsSync", "pidFile", "unlinkSync", "childInfo", "pid", "started", "Date", "now", "restarts", "writeFileSync", "JSON", "stringify", "undefined", "encoding", "waitForPidFileBeingFilledWithInfo", "kill", "_killWithSignal", "waitForPidDeletion", "maxRestarts", "log", "invariant", "message", "logFile", "flag", "errFile", "synchronized"]
3
+ "sources": ["../../../src/phoenix.ts", "../../../src/utils.ts", "../../../src/defs.ts", "../../../src/watchdog.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { fork } from 'node:child_process';\nimport { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport pkgUp from 'pkg-up';\n\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\n\nimport { waitForPidDeletion, waitForPidFileBeingFilledWithInfo } from './utils';\nimport { type ProcessInfo, type WatchDogParams } from './watchdog';\n\n/**\n * Utils to start/stop detached process with errors and logs handling.\n */\nexport class Phoenix {\n /**\n * Starts detached watchdog process which starts and monitors selected command.\n */\n static async start(params: WatchDogParams) {\n {\n // Clear stale pid file.\n if (existsSync(params.pidFile)) {\n await Phoenix.stop(params.pidFile);\n }\n\n await waitForPidDeletion(params.pidFile);\n }\n\n {\n // Create log folders.\n [params.logFile, params.errFile, params.pidFile].forEach((filename) => {\n if (!existsSync(filename)) {\n mkdirSync(dirname(filename), { recursive: true });\n writeFileSync(filename, '', { encoding: 'utf-8' });\n }\n });\n }\n\n const watchdogPath = join(dirname(pkgUp.sync({ cwd: __dirname })!), 'bin', 'watchdog');\n\n const watchDog = fork(watchdogPath, [JSON.stringify(params)], {\n detached: true,\n cwd: __dirname,\n });\n\n watchDog.on('exit', (code, signal) => {\n if (code && code !== 0) {\n log.error('Monitor died unexpectedly', { code, signal });\n }\n });\n\n await waitForPidFileBeingFilledWithInfo(params.pidFile);\n\n watchDog.disconnect();\n watchDog.unref();\n\n return Phoenix.info(params.pidFile);\n }\n\n /**\n * Stops detached watchdog process by PID info written down in PID file.\n */\n static async stop(pidFile: string, force = false) {\n if (!existsSync(pidFile)) {\n throw new Error('PID file does not exist');\n }\n const fileContent = readFileSync(pidFile, { encoding: 'utf-8' });\n if (!fileContent.includes('pid')) {\n throw new Error('Invalid PID file content');\n }\n\n const { pid } = JSON.parse(fileContent);\n const signal: NodeJS.Signals = force ? 'SIGKILL' : 'SIGINT';\n try {\n process.kill(pid, signal);\n } catch (err) {\n invariant(err instanceof Error, 'Invalid error type');\n if (err.message.includes('ESRCH') || err.name.includes('ESRCH')) {\n // Process is already dead.\n unlinkSync(pidFile);\n } else {\n throw err;\n }\n }\n }\n\n static info(pidFile: string): ProcessInfo {\n return JSON.parse(readFileSync(pidFile, { encoding: 'utf-8' }));\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { existsSync, readFileSync } from 'node:fs';\n\nimport { waitForCondition } from '@dxos/async';\n\nimport { WATCHDOG_CHECK_INTERVAL, WATCHDOG_START_TIMEOUT, WATCHDOG_STOP_TIMEOUT } from './defs';\n\nexport const waitForPidCreation = async (pidFile: string) =>\n waitForCondition({\n condition: () => existsSync(pidFile),\n timeout: WATCHDOG_START_TIMEOUT,\n interval: WATCHDOG_CHECK_INTERVAL,\n });\n\nexport const waitForPidDeletion = async (pidFile: string) =>\n waitForCondition({\n condition: () => !existsSync(pidFile),\n timeout: WATCHDOG_STOP_TIMEOUT,\n interval: WATCHDOG_CHECK_INTERVAL,\n });\n\nexport const waitForPidFileBeingFilledWithInfo = async (pidFile: string) =>\n waitForCondition({\n condition: () => readFileSync(pidFile, { encoding: 'utf-8' }).includes('pid'),\n timeout: WATCHDOG_START_TIMEOUT,\n interval: WATCHDOG_CHECK_INTERVAL,\n error: new Error('Lock file is not being propagated with info.'),\n });\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport const LOCK_TIMEOUT = 1_000;\nexport const LOCK_CHECK_INTERVAL = 50;\nexport const WATCHDOG_START_TIMEOUT = 10_000;\nexport const WATCHDOG_STOP_TIMEOUT = 1_000;\nexport const WATCHDOG_CHECK_INTERVAL = 50;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type ChildProcessWithoutNullStreams, spawn } from 'node:child_process';\nimport { existsSync, unlinkSync, writeFileSync } from 'node:fs';\nimport { type FileHandle } from 'node:fs/promises';\n\nimport { synchronized } from '@dxos/async';\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\n\nimport { waitForPidDeletion, waitForPidFileBeingFilledWithInfo } from './utils';\n\nexport type ProcessInfo = WatchDogParams & {\n pid?: number;\n started?: number;\n restarts?: number;\n running?: boolean;\n};\n\nexport type WatchDogParams = {\n profile?: string; // Human readable process identifier\n pidFile: string; // Path to PID file\n\n //\n // Log files and associated logging options for this instance\n //\n logFile: string; // Path to log output all logs\n errFile: string; // Path to log output from child stderr\n\n //\n // Basic configuration options\n //\n maxRestarts?: number | undefined; // Sets the maximum number of times a given script should run\n killTree?: boolean | undefined; // Kills the entire child process tree on `exit`\n\n //\n // Command to spawn as well as options and other vars\n // (env, cwd, etc) to pass along\n //\n command: string; // Binary to run (default: 'node')\n args?: string[] | undefined; // Additional arguments to pass to the script,\n\n //\n // More specific options to pass along to `child_process.spawn` which\n // will override anything passed to the `spawnWith` option\n //\n env?: NodeJS.ProcessEnv | undefined;\n cwd?: string | undefined;\n shell?: boolean | undefined;\n};\n\nexport class WatchDog {\n private _lock?: FileHandle;\n private _child?: ChildProcessWithoutNullStreams;\n private _restarts = 0;\n\n constructor(private readonly _params: WatchDogParams) {}\n\n @synchronized\n async start() {\n const { cwd, shell, env, command, args } = { cwd: process.cwd(), ...this._params };\n\n this._log(`Spawning process \\`\\`\\`${command} ${args?.join(' ')}\\`\\`\\``);\n this._child = spawn(command, args, { cwd, shell, env, stdio: 'pipe' });\n\n this._child.stdout.on('data', (data: Uint8Array) => {\n this._log(String(data));\n });\n this._child.stderr.on('data', (data: Uint8Array) => {\n this._err(data);\n });\n this._child.on('close', async (code: number, signal: number | NodeJS.Signals) => {\n if (code && code !== 0 && signal !== 'SIGINT' && signal !== 'SIGKILL') {\n this._err(`Died unexpectedly with exit code ${code} (signal: ${signal}).`);\n await this.restart();\n }\n this._log(`Stopped with exit code ${code} (signal: ${signal}).`);\n if (existsSync(this._params.pidFile)) {\n unlinkSync(this._params.pidFile);\n }\n });\n\n const childInfo: ProcessInfo = {\n pid: this._child.pid,\n started: Date.now(),\n restarts: this._restarts,\n ...this._params,\n };\n\n writeFileSync(this._params.pidFile, JSON.stringify(childInfo, undefined, 2), { encoding: 'utf-8' });\n\n await waitForPidFileBeingFilledWithInfo(this._params.pidFile);\n }\n\n /**\n * Sends SIGKILL to the child process and the tree it spawned (if `killTree` param is `true`).\n */\n @synchronized\n async kill() {\n if (!this._child) {\n return;\n }\n\n await this._killWithSignal('SIGKILL');\n\n if (existsSync(this._params.pidFile)) {\n unlinkSync(this._params.pidFile);\n }\n\n await waitForPidDeletion(this._params.pidFile);\n }\n\n async restart() {\n await this.kill();\n if (this._params.maxRestarts !== undefined && this._restarts >= this._params.maxRestarts) {\n this._err('Max restarts number is reached');\n } else {\n log('Restarting...');\n this._restarts++;\n await this.start();\n }\n }\n\n async _killWithSignal(signal: number | NodeJS.Signals) {\n invariant(this._child?.pid, 'Child process has no pid.');\n this._child.kill(signal);\n this._child = undefined;\n }\n\n private _log(message: string | Uint8Array) {\n writeFileSync(this._params.logFile, message + '\\n', {\n flag: 'a+',\n encoding: 'utf-8',\n });\n }\n\n private _err(message: string | Uint8Array) {\n this._log(message);\n writeFileSync(this._params.errFile, message + '\\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,CAAA,GAAI;MAAEpE,UAAU;IAAQ,CAAA;AAEjG,UAAMF,kCAAkC,KAAKiD,QAAQvD,OAAO;EAC9D;;;;EAKA,MACM+C,OAAO;AACX,QAAI,CAAC,KAAKe,QAAQ;AAChB;IACF;AAEA,UAAM,KAAKe,gBAAgB,SAAA;AAE3B,YAAI1E,gBAAAA,YAAW,KAAKoD,QAAQvD,OAAO,GAAG;AACpCoD,0BAAAA,YAAW,KAAKG,QAAQvD,OAAO;IACjC;AAEA,UAAMD,mBAAmB,KAAKwD,QAAQvD,OAAO;EAC/C;EAEA,MAAMsE,UAAU;AACd,UAAM,KAAKvB,KAAI;AACf,QAAI,KAAKQ,QAAQuB,gBAAgBF,UAAa,KAAKpB,aAAa,KAAKD,QAAQuB,aAAa;AACxF,WAAKT,KAAK,gCAAA;IACZ,OAAO;AACL/B,sBAAAA,KAAI,iBAAA,QAAA;;;;;;AACJ,WAAKkB;AACL,YAAM,KAAK3C,MAAK;IAClB;EACF;EAEA,MAAMgE,gBAAgBxC,QAAiC;AACrDY,0BAAAA,WAAU,KAAKa,QAAQlB,KAAK,6BAAA;;;;;;;;;AAC5B,SAAKkB,OAAOf,KAAKV,MAAAA;AACjB,SAAKyB,SAASc;EAChB;EAEQf,KAAKX,SAA8B;AACzC3B,wBAAAA,eAAc,KAAKgC,QAAQvC,SAASkC,UAAU,MAAM;MAClD6B,MAAM;MACNvE,UAAU;IACZ,CAAA;EACF;EAEQ6D,KAAKnB,SAA8B;AACzC,SAAKW,KAAKX,OAAAA;AACV3B,wBAAAA,eAAc,KAAKgC,QAAQtC,SAASiC,UAAU,MAAM;MAClD6B,MAAM;MACNvE,UAAU;IACZ,CAAA;EACF;AACF;;EArFGwE;GAPU3B,SAAAA,WAAAA,SAAAA,IAAAA;;EA8CV2B;GA9CU3B,SAAAA,WAAAA,QAAAA,IAAAA;",
6
+ "names": ["import_node_fs", "import_node_child_process", "import_async", "import_invariant", "import_log", "WATCHDOG_START_TIMEOUT", "WATCHDOG_STOP_TIMEOUT", "WATCHDOG_CHECK_INTERVAL", "waitForPidDeletion", "pidFile", "waitForCondition", "condition", "existsSync", "timeout", "interval", "waitForPidFileBeingFilledWithInfo", "readFileSync", "encoding", "includes", "error", "Error", "Phoenix", "start", "params", "stop", "logFile", "errFile", "forEach", "filename", "mkdirSync", "dirname", "recursive", "writeFileSync", "watchdogPath", "join", "pkgUp", "sync", "cwd", "__dirname", "watchDog", "fork", "JSON", "stringify", "detached", "on", "code", "signal", "log", "disconnect", "unref", "info", "force", "fileContent", "pid", "parse", "process", "kill", "err", "invariant", "message", "name", "unlinkSync", "WatchDog", "constructor", "_params", "_restarts", "shell", "env", "command", "args", "_log", "_child", "spawn", "stdio", "stdout", "data", "String", "stderr", "_err", "restart", "childInfo", "started", "Date", "now", "restarts", "undefined", "_killWithSignal", "maxRestarts", "flag", "synchronized"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"packages/common/phoenix/src/defs.ts":{"bytes":1201,"imports":[],"format":"esm"},"packages/common/phoenix/src/utils.ts":{"bytes":3673,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"packages/common/phoenix/src/defs.ts","kind":"import-statement","original":"./defs"}],"format":"esm"},"packages/common/phoenix/src/phoenix.ts":{"bytes":10490,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"pkg-up","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/common/phoenix/src/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"packages/common/phoenix/src/watchdog.ts":{"bytes":14356,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/common/phoenix/src/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"packages/common/phoenix/src/index.ts":{"bytes":987,"imports":[{"path":"packages/common/phoenix/src/phoenix.ts","kind":"import-statement","original":"./phoenix"},{"path":"packages/common/phoenix/src/watchdog.ts","kind":"import-statement","original":"./watchdog"}],"format":"esm"}},"outputs":{"packages/common/phoenix/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14488},"packages/common/phoenix/dist/lib/node/index.cjs":{"imports":[{"path":"node:child_process","kind":"require-call","external":true},{"path":"node:fs","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true},{"path":"pkg-up","kind":"require-call","external":true},{"path":"@dxos/invariant","kind":"require-call","external":true},{"path":"@dxos/log","kind":"require-call","external":true},{"path":"node:fs","kind":"require-call","external":true},{"path":"@dxos/async","kind":"require-call","external":true},{"path":"node:child_process","kind":"require-call","external":true},{"path":"node:fs","kind":"require-call","external":true},{"path":"@dxos/async","kind":"require-call","external":true},{"path":"@dxos/invariant","kind":"require-call","external":true},{"path":"@dxos/log","kind":"require-call","external":true}],"exports":[],"entryPoint":"packages/common/phoenix/src/index.ts","inputs":{"packages/common/phoenix/src/index.ts":{"bytesInOutput":147},"packages/common/phoenix/src/phoenix.ts":{"bytesInOutput":3063},"packages/common/phoenix/src/utils.ts":{"bytesInOutput":646},"packages/common/phoenix/src/defs.ts":{"bytesInOutput":101},"packages/common/phoenix/src/watchdog.ts":{"bytesInOutput":3933}},"bytes":9727}}}
1
+ {"inputs":{"packages/common/phoenix/src/defs.ts":{"bytes":1196,"imports":[],"format":"esm"},"packages/common/phoenix/src/utils.ts":{"bytes":3668,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"packages/common/phoenix/src/defs.ts","kind":"import-statement","original":"./defs"}],"format":"esm"},"packages/common/phoenix/src/phoenix.ts":{"bytes":10485,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"pkg-up","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/common/phoenix/src/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"packages/common/phoenix/src/watchdog.ts":{"bytes":14351,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/common/phoenix/src/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"packages/common/phoenix/src/index.ts":{"bytes":982,"imports":[{"path":"packages/common/phoenix/src/phoenix.ts","kind":"import-statement","original":"./phoenix"},{"path":"packages/common/phoenix/src/watchdog.ts","kind":"import-statement","original":"./watchdog"}],"format":"esm"}},"outputs":{"packages/common/phoenix/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14451},"packages/common/phoenix/dist/lib/node/index.cjs":{"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"pkg-up","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["Phoenix","WatchDog"],"entryPoint":"packages/common/phoenix/src/index.ts","inputs":{"packages/common/phoenix/src/phoenix.ts":{"bytesInOutput":2775},"packages/common/phoenix/src/utils.ts":{"bytesInOutput":586},"packages/common/phoenix/src/defs.ts":{"bytesInOutput":101},"packages/common/phoenix/src/index.ts":{"bytesInOutput":0},"packages/common/phoenix/src/watchdog.ts":{"bytesInOutput":3749}},"bytes":7531}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/phoenix",
3
- "version": "0.3.8-next.f4e0086",
3
+ "version": "0.3.8",
4
4
  "description": "Basic node daemon.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -14,14 +14,14 @@
14
14
  ],
15
15
  "dependencies": {
16
16
  "pkg-up": "^3.1.0",
17
- "@dxos/async": "0.3.8-next.f4e0086",
18
- "@dxos/context": "0.3.8-next.f4e0086",
19
- "@dxos/invariant": "0.3.8-next.f4e0086",
20
- "@dxos/keys": "0.3.8-next.f4e0086",
21
- "@dxos/lock-file": "0.3.8-next.f4e0086",
22
- "@dxos/log": "0.3.8-next.f4e0086",
23
- "@dxos/node-std": "0.3.8-next.f4e0086",
24
- "@dxos/util": "0.3.8-next.f4e0086"
17
+ "@dxos/async": "0.3.8",
18
+ "@dxos/context": "0.3.8",
19
+ "@dxos/keys": "0.3.8",
20
+ "@dxos/invariant": "0.3.8",
21
+ "@dxos/lock-file": "0.3.8",
22
+ "@dxos/node-std": "0.3.8",
23
+ "@dxos/log": "0.3.8",
24
+ "@dxos/util": "0.3.8"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/node": "^18.11.9",