Skip to content
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

Set 3000 as the default web port #1215

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alagos
Copy link

@alagos alagos commented Sep 30, 2024

Having by default PORT= only assigns to that variable 0, which is interpreted by puma to start the web app in a random port when bin/dev is called.
Also exporting the port in this file is useless, as in the foreman context, it's eventually overriden by the settings of your default .env file that has just been copied from .env.example.

@alagos
Copy link
Author

alagos commented Sep 30, 2024

Worth to mention, I've just started playing with this repo following the setup guide and I faced with the issue where the app was running in a random port every time that I started it (it took me a while to figure out that was because I didn't set the PORT value in the .env file).
For a newcomer as me, will be easier to simply run the app in 3000 instead of trying to figure out where to set this by default (the reason of this PR).

@zachgoll
Copy link
Collaborator

@alagos I think we should leave the bin/dev script as-is so that PORT is an optional variable to set in .env

I agree that given the setup instructions, it could be confusing to include PORT=, so definitely willing to accept that change to PORT=3000

@zachgoll
Copy link
Collaborator

It's worth mentioning—many of the variables in .env.example are 100% optional to get this app running locally.

The goal with that file is to be a comprehensive overview of all the variables that can be used.

We may just need to specify this a bit more clearly in the dev setup guides as I can see where this would be confusing.

Having by default `PORT=` only assigns to that variable `0`, which is
interpreted by puma to start the web app in a random port when `bin/dev`
is called.
@alagos
Copy link
Author

alagos commented Oct 1, 2024

we should leave the bin/dev script as-is so that PORT is an optional variable to set in .env

That's the thing, it doesn't really matter if you call PORT=8080 bin/dev or you change the file to explicitely use

export PORT="8080"

as this script eventually calls foreman, that completely ignores that variable value, as it's already defined in .env.
Might be nice to have just a single place where to set the port and avoid further confusion, but anyway, I've restored the change for bin/dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants