-
Notifications
You must be signed in to change notification settings - Fork 224
Make bind address configurable for app dev server #6396
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
base: main
Are you sure you want to change the base?
Conversation
- Introduced a new `host` flag in the dev command to specify the network interface for the web server, defaulting to 'localhost'. - Updated the `DevOptions` interface to include the `host` property. - Modified the setup of proxy server processes to utilize the new `host` option. - Renamed `startProxyServer` to `proxyService` for clarity in the proxy server function.
- Add missing directory and update properties to DevOptions test objects - Add missing config property to TestAppWithConfigOptions calls - Add missing partnerUrlsUpdated property to DevConfig setupDevProcesses calls - Update CLI documentation and manifest for --host flag
c885c87 to
c5fae9c
Compare
|
any eta when this will be looked at? It's blocking me working on an app that uses docker |
|
This PR seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. |
|
can someone review this PR please? |
karreiro
left a comment
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.
Thank you very much for this PR, @lmcrean!
I've made just one suggestion to ensure the flags are consistent. :)
Additionally, could you please run pnpm changeset add? This will allow us to include a changeset for this feature.
Thanks again for your contribution! 🚀
|
Thank you for the professional notes @karreiro @isaacroldan Just confirming that this is in my pipeline, it appears to be nearly there, I'll be engaging with it during end of December/ early Jan |
|
This PR seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. |
|
still relevant -- looking at it now actually |
…documentation. This change ensures consistency across the application and improves clarity for users regarding the network interface settings.
…eters in setPortsAndAddProxyProcess call
…est to enhance readability and maintain consistency in configuration formatting.
|
Ready for review! Kept Also fixed the lint errors and added a changeset. |
Adds configurable bind address support to the
shopify app devcommand to enable Docker container development workflows.Problem
localhostbinding for app dev servers for security0.0.0.0binding to accept connections from host machine--hostflag, but app dev server does notSolution
--hostflag toshopify app devcommand withSHOPIFY_FLAG_HOSTenv var support'localhost'127.0.0.1) while enabling Docker flexibilityChanges Made
1. Added host flag to app dev command
packages/app/src/cli/commands/app/dev.ts--hostflag with environment variable support127.0.0.1(maintains security)0.0.0.0(enables Docker containers)2. Updated proxy server to use configurable host
packages/app/src/cli/services/dev/processes/setup-dev-processes.ts'localhost'to use passed host parameterUsage Examples
For Docker containers:
SHOPIFY_FLAG_HOST=0.0.0.0 shopify app dev # or shopify app dev --host=0.0.0.0For normal development (default):
shopify app dev # Still binds to localhost by defaultTesting
Unit Tests
Added comprehensive unit test coverage in
packages/app/src/cli/services/dev/processes/setup-dev-processes.test.ts:New Test:
proxy server process includes host parameter when configured for Docker0.0.0.0for Docker compatibilityhost: '0.0.0.0'simulating Docker usageUpdated Existing Tests
All existing tests were updated to include the required
host: 'localhost'parameter incommandOptionsto satisfy TypeScripts' requirements for the Devoptions interface. Users get localhost by default so no action needed.Test Commands
Manual Testing
--host=0.0.0.0enables external connectionsSHOPIFY_FLAG_HOSTenvironment variable worksNo Breaking Changes
This is a feature addition that maintains 100% backward compatibility. Users who don't need Docker support will see zero changes in behavior. Only users who specifically want to bind to a different network interface need to use the new --host flag.