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

[DOCS / LINTING ISSUE] Provide clear steps if port 3000 is in use #209

Open
corinthian13 opened this issue May 19, 2022 · 9 comments
Open

Comments

@corinthian13
Copy link

https://v3.docs.apostrophecms.org/guide/setting-up.html#creating-a-project

Why in the hell did you choose port 3000 for the ApostropheCMS server ?

If you work with Node.js you will know that most web app back ends use port 3000 (http) and 3001 (https) for their user-event servers.

But you just went ahead and created a conflict between the app backend and the app's CMS servers over access to port 3000 . . .

Thanks, Ernie & Bert.

@boutell
Copy link
Member

boutell commented May 19, 2022

Hi, Bert & Ernie,

Port 3000 is the default port for most Express applications. Apostrophe is, in fact, a web app back end. So I'm a little puzzled by your question.

But you can set the PORT environment variable, or the port option of the @apostrophecms/express module, to anything you like. This is covered in the documentation of the module.

So if port 3000 isn't convenient for you, you can choose whatever meets your needs.

Closing because there is no bug or missing documentation here, but I am interested to understand better what backend Apostrophe is in conflict with in your particular environment, so feel free to follow up with more on that if you wish.

@boutell boutell closed this as completed May 19, 2022
@corinthian13
Copy link
Author

Consider a small business website.
It has its own back end for things like online ordering of services/products and user reviews of the business. This back end runs from ports 3000 (http) & 3001 (https).
It also has a Node.js based CMS, e.g. Apostrophe, which also run from ports 3000 and 3001.
On the web server machine, both of these servers would be started up when the app is launched, one of them inevitably before the other.

Now, my experience in running a Node.js app locally tells me that any time I try to start a Node user-event server on say port 5000 when another Node service is already running on that same port 5000, then the attempt to launch the former server will crash owing to port 5000 being already engaged. (This can happen when the terminal window used to launch the first Node service was not closed - despite the app being exited - and the service is seen to persist when I review the System Monitor processes.)
An error message to that effect is logged onto my console.

I would expect at least the same thing to occur if two Node services were running simultaneously on a web app.

But even if the two services could coexist on the same port, surely it would be better to put them on separate ports if one wanted each type of request, CMS update or user action, to be accorded equal priority at times of high demand. Node can be configured to put different types of request into separate threads so that CPU intensive requests (e.g. business logic processing) do not wall out for long periods simpler requests, e.g. authorization.

That concern apart, I still do not see why an app with 2 (or more) services on Node should have them on the same port.
What would be the gain from doing this ?

PS: Ernie and Bert are Sesame Street characters. Ernie always did things in an unintended way, Bert tried in vain to make him do things the orthodox way.

@boutell
Copy link
Member

boutell commented May 20, 2022 via email

@corinthian13
Copy link
Author

I'm using Apostrophe CLI v3.1.1 on an Intel i5-7XXX CPU on Ubuntu 20.04.2 LTS.

You suggest that most of your users would have their CMS running before getting their back end going ?
I wonder about this.
If it's run as a headless CMS they will populate their web pages with some plausible text and images/videos.
Otherwise how will they know from the off whether rendering problems are down to the CSS or the CMS ?
In any case they'd surely like to see how things actually look (as opposed to any wireframes they used for mock-ups) before connecting the CMS into it all.

Maybe your intended clientele is the large enterprise sector.
My own clientele is the small business sector.
In this arena all site owners really want is some convenient and intuitive way to change essential content on the site - prices, products/services, images, blurbs, etc - without calling a web designer and paying them at the professional rate for time spent on trivia. The Apostrophe in-context editor readily allows this. That's why I went for your CMS over Strapi and other Node.js based ones.
But maybe this is not a sector that your company wishes to engage with.

@boutell
Copy link
Member

boutell commented May 22, 2022 via email

@corinthian13
Copy link
Author

Of course I do.

It's extra work that should not be imposed on any existing site owners by the company whose package they are good enough to try out. It is hardly fair of your company to add to their complications - especially when your company could (and should) well have set the CMS on some other non-popular port numbers at no extra inconvenience to themselves.

i doubt if you won the commercial hand of clients like Michelin by forcing their back end out of 3000/3001.

What is your functional issue with the resolution that I propose, i.e porting ApostropheCMS to say 5000/5001, 6000/6001 or 7000/7001 ?

@boutell
Copy link
Member

boutell commented May 22, 2022 via email

@corinthian13
Copy link
Author

I am sorry - I hadn't thought of the existing users.
If a substantial number of those are using port 3000/3001 for Apos CMS then it's another hassle.
Some of your existing clientele are large sites with millions of users so changeover is asking for trouble.

I have no suggestion beyond what you have said above, customer alerting to the port allocation.

@boutell boutell changed the title [DOCS ISSUE] Page: Setting up [DOCS / LINTING ISSUE] Provide clear steps if port 3000 is in use May 23, 2022
@boutell boutell reopened this May 23, 2022
@boutell
Copy link
Member

boutell commented May 23, 2022

Reopening the ticket with the possible resolution being to document how to address the port number issue closer to the "getting started" steps where it might be first encountered, and to include a hint about it in the error message.

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

No branches or pull requests

2 participants