PowderWeb icon indicating copy to clipboard operation
PowderWeb copied to clipboard

Set Custom Port for Dev Env

Open Maddy-dev03 opened this issue 5 years ago • 7 comments

I'm using an online ide at the moment and every time I start the app it runs on localhost. is there any way I could use it without hosting locally.

Maddy-dev03 avatar Nov 09 '20 15:11 Maddy-dev03

It's usually the online ide that automatically exposes apps on a subdomain, but not all do.. In lack of that the options can be limited in your scenario.. are you sure that they are exposing the app ports externally? because if it doesn't then i can't think of ways you can do this.. free reverse proxy services will crack under the pressure of media streaming..

jaruba avatar Nov 09 '20 16:11 jaruba

I am pretty sure they are coz generally I use express and in that I add a simple app.listen with process.env variables like .id and .port and it works fine. In this case you have used get-port instead and I cant figure out an alternative to the above process.

Maddy-dev03 avatar Nov 09 '20 17:11 Maddy-dev03

You can set a port by using process.env.PWFRONTPORT, see here: https://github.com/jaruba/PowderWeb/blob/2f961010f44504b55eb38276a54e9c3390db44cc/server/index.js#L141

jaruba avatar Nov 09 '20 17:11 jaruba

I did set the export value of PWFRONTPORT=3000 and now its showing that port 3000 is already being used.

Maddy-dev03 avatar Nov 10 '20 09:11 Maddy-dev03

But 3000 is already the default port: https://github.com/jaruba/PowderWeb/blob/05e54de482735e7fcb0ef902f65e241c89f85670/server/utils/config.js#L29

Does it need to be 3000? Try not setting process.env.PWFRONTPORT and changing the default port from the ./server/utils/config.js to something else instead of 3000. You will probably need to initiate a new project for this on the online IDE, as the config may already be saved to another file in the current project you are working in.

jaruba avatar Nov 10 '20 11:11 jaruba

Btw, i can't be sure of this, but you should probably try installing the headless branch: https://github.com/jaruba/PowderWeb/tree/headless

It should work better then the master branch for deploying on online servers.

jaruba avatar Nov 10 '20 11:11 jaruba

The correct way of using the headless branch (at least locally) would be:

git clone -b headless https://www.github.com/jaruba/PowderWeb.git
cd PowderWeb
npm install
cd public
bower install
cd ..
npm run build-front
npm run start-headless

And port 3000 (currently the default port) would need to be exposed on the server.

jaruba avatar Nov 10 '20 12:11 jaruba