Port already in use, what to do?

This (port conflict) was handled in the script a while ago. Needing to proxy is a whole other deal there are #howto topics on that.

This is the guide that the script links to but I donā€™t want to tear down my production website just to install discourse.

This guide assumes you already have Discourse working - if you don't, it may be hard to tell whether or not the configuration is working.
1 Like

Since this topic was helpful Iā€™ll just add to it even if itā€™s 3 years old. I encountered the port in use problem today and am somewhat baffled by what happened. Just showing order of events in case someone else runs into it.

Background: Running Ubuntu 16.04.3 LTS (far too scared to upgrade to 18.04) and Discourse 2.3.x (not sure which, reason for that later :slight_smile: ).

Did a change (irrelevant) to app.yml and rebuilt the app.

Also noticed Ubuntu wanted to restart (didnā€™t check the reason) so rebooted Ubuntu as well.

And ended up with the port error problem.

Figured out Apache2 was suddenly running so I disabled it:
root@Discourse:~# sudo update-rc.d apache2 disable
insserv: warning: current start runlevel(s) (empty) of script apache2' overrides LSB defaults (2 3 4 5). insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script apache2ā€™ overrides LSB defaults (0 1 6).

And got the forum back up eventually as the port was now free.

What I cannot figure out is why this happened? Where did Apache2 come from?

I should have tested the forum immediately after the restart, dang. Now I donā€™t know whether the Discourse upgrade or the Ubuntu restart was responsible for this (I can probably find that in some log but Iā€™m not any good with Linux anymore). Even tried to find on the forum if Discourse 2.5 installs Apache2 these days.

Good thing is, upgrading Discourse was long overdue. Iā€™m just very reluctant to upgrade nowadays since Iā€™ve had problems like this every second time or so in the past 5 years. Still love Discourse thoughā€¦

1 Like

From your description, the best way to know if another upgrade is going to cause a problem is to upgrade three days in a row - it really should be easy enough that that is workable!

In general, expect that if itā€™s been a year+ since your last Discourse upgrade, youā€™ll need ./launcher rebuild app . I recommend visiting /admin/upgrade more frequently of course :slight_smile:

2 Likes

If you app.yml called something else you need to

  ./launcher stop irrelevant 

Or rename it and rebuild that.

2 Likes

Discourse installs nothing outside the container aside from docker as an installation prerequisite.

Itā€™s likely Apache2 was installed after the last reboot and couldnā€™t take the port until you restarted the machine. Grep your bash history to check what packages have been installed by hand.

1 Like

Thanks for the ideas everyone.

I did use rebuild app. And if Discourse installs nothing extra (was thinking nginx and Apache2 would come by default because of something new)ā€¦ hmmm. I certainly havenā€™t added Apache2 myself.

Ah. After having this DigitalOcean Ubuntu for Discourse only for years and years I actually installed Subversion in January, apparently without rebooting. That install apparently adds Apache although disabling it still leaves me with the functionality I need.

Guess Iā€™m not so used to installs adding garbage (yes Iā€™m sure Apache is needed for something). That more commonly happens on like, Windows or Android :smiley: .

Sorry for the trouble. Then again, this is a real use case scenario, always good to read those as a developer.

1 Like