Repository navigation
Restart a workspace application that has only a start script when the checkout changes - #22
Merged
Merged
Conversation
… checkout changes In a development workspace workspace-node start runs the package's dev script, which watches the files itself, or its start script, which runs the application once. With only a start script a change to the code was served only after the container was restarted. workspace-node now watches the checkout for a start script. When a file changes it stops the application and starts it again, in the same container. Files are polled, because file events don't reach a shared volume; installed packages, Git's own files and the usual build output are left out. The script's processes get a session of their own, so the application the package manager started is stopped with it. An application that ends by itself still ends the container, and stopping the container stops the application at once. A dev script, WORKSPACE_NODE_COMMAND and WORKSPACE_NODE_WATCH=0 run without the watcher.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In a development workspace, a Node.js application whose package has only a
startscript was started once. After a change to the code you had to restart the container to see it.workspace-node startnow watches the checkout for such a package: when a file changes, it stops the application and starts it again, in the same container.Behavior
devscript is run as before: adevscript watches the files itself.startscript is run under the watcher. Files are polled everyWORKSPACE_POLL_INTERVALmilliseconds (1000 by default), because file events don't reach a shared volume.node_modules,.git,.wodby-workspace,.pnpm-store,.next,dist,buildandcoverage.WORKSPACE_NODE_WATCH=0turns the watcher off, andWORKSPACE_NODE_COMMANDis run as it is.Validation
tests/workspace-reload.sh, whichtests/run.shalready runs for development images, has new cases. Run againstwodby/node:24-dev-r5with this script: the Vite and Next.js cases still pass; for astartscript a second container's edit was served by the same container with one application process left, the container stopped in under ten seconds with exit code 143, an application that exited took the container with it, and neitherWORKSPACE_NODE_WATCH=0nor adevscript got the watcher.tests/workspace-runtime.shpasses in the same image.