-
Notifications
You must be signed in to change notification settings - Fork 10
feat: swap to nodemon instead of PM2 #1798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
elibosley
wants to merge
9
commits into
main
Choose a base branch
from
codex/switch-api-process-management-to-nodemon
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+923
−1,226
Draft
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e5e7732
Include nodemon config in build artifact
elibosley f6521d8
Add SUPPRESS_LOGS to environment mocks
elibosley 6d3d623
feat: Refactor nodemon configuration and improve error handling in No…
elibosley b35da13
refactor: Update environment configuration for nodemon paths
elibosley d4f90d6
test: Add unit tests for nodemon path configuration and enhance error…
elibosley 33e88bc
fix: Simplify return type for killSpy in NodemonService tests
elibosley 1d9c76f
feat: Enhance NodemonService with process management and cleanup
elibosley 9253250
feat: Add process termination and management in NodemonService
elibosley a5e9b83
feat: Implement waitForNodemonExit method and enhance restart logic i…
elibosley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "watch": [ | ||
| "dist/main.js" | ||
| ], | ||
| "ignore": [ | ||
| "node_modules", | ||
| "src", | ||
| ".env.*" | ||
| ], | ||
| "exec": "node ./dist/main.js", | ||
| "signal": "SIGTERM", | ||
| "ext": "js,json", | ||
| "restartable": "rs", | ||
| "env": { | ||
| "NODE_ENV": "production" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
222 changes: 0 additions & 222 deletions
222
api/src/__test__/core/utils/pm2/unraid-api-running.integration.test.ts
This file was deleted.
Oops, something went wrong.
54 changes: 54 additions & 0 deletions
54
api/src/__test__/core/utils/process/unraid-api-running.integration.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'; | ||
| import { tmpdir } from 'node:os'; | ||
| import { join } from 'node:path'; | ||
|
|
||
| import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from 'vitest'; | ||
|
|
||
| describe('isUnraidApiRunning (nodemon pid detection)', () => { | ||
| let tempDir: string; | ||
| let pidPath: string; | ||
|
|
||
| beforeAll(() => { | ||
| tempDir = mkdtempSync(join(tmpdir(), 'unraid-api-')); | ||
| pidPath = join(tempDir, 'nodemon.pid'); | ||
| }); | ||
|
|
||
| afterAll(() => { | ||
| rmSync(tempDir, { recursive: true, force: true }); | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| vi.resetModules(); | ||
| }); | ||
|
|
||
| async function loadIsRunning() { | ||
| vi.doMock('@app/environment.js', async () => { | ||
| const actual = | ||
| await vi.importActual<typeof import('@app/environment.js')>('@app/environment.js'); | ||
| return { ...actual, NODEMON_PID_PATH: pidPath }; | ||
| }); | ||
|
|
||
| const module = await import('@app/core/utils/process/unraid-api-running.js'); | ||
| return module.isUnraidApiRunning; | ||
| } | ||
|
|
||
| it('returns false when pid file is missing', async () => { | ||
| const isUnraidApiRunning = await loadIsRunning(); | ||
|
|
||
| expect(await isUnraidApiRunning()).toBe(false); | ||
| }); | ||
|
|
||
| it('returns true when a live pid is recorded', async () => { | ||
| writeFileSync(pidPath, `${process.pid}`); | ||
| const isUnraidApiRunning = await loadIsRunning(); | ||
|
|
||
| expect(await isUnraidApiRunning()).toBe(true); | ||
| }); | ||
|
|
||
| it('returns false when pid file is invalid', async () => { | ||
| writeFileSync(pidPath, 'not-a-number'); | ||
| const isUnraidApiRunning = await loadIsRunning(); | ||
|
|
||
| expect(await isUnraidApiRunning()).toBe(false); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Verify the import path change for getDeploymentVersion.
The import path changed from
'./get-deployment-version.js'(resolving toapi/scripts/get-deployment-version.js) to'@app/../scripts/get-deployment-version.js'(resolving toscripts/get-deployment-version.jsat repo root). This suggests the file was moved from the api/scripts directory to a root-level scripts directory.Run the following script to verify the file exists at the expected location:
🏁 Script executed:
Length of output: 77
The file doesn't exist at either location. Let me search the entire repository to determine where this file actually is:
🏁 Script executed:
Length of output: 632
Let me verify the module alias configuration to understand how
@appresolves:🏁 Script executed:
Length of output: 885
Let me check the specific
tsconfig.jsonin the api directory wherebuild.tsis located:🏁 Script executed:
Length of output: 4417
Fix broken import path and extension in build.ts line 10.
The import path is incorrect on multiple levels:
@app/../scripts/get-deployment-version.jsresolves to./scripts/get-deployment-version.js(repo root) via the@appalias mapping ("@app/*": ["./src/*"]inapi/tsconfig.json)api/scripts/get-deployment-version.ts(same directory asbuild.ts)Change line 10 to:
🤖 Prompt for AI Agents