Apache took port 80 and caused Discourse not to start

I’m still not sure what happened, but basically after updating today, I found my server went down.

staff_user action subject created_at details context
mofosyne custom_staff 2018-03-08 23:12:34 UTC “from_version: b040e11 \n repository: /var/www/discourse”
mofosyne custom_staff 2018-03-08 08:54:32 UTC “from_version: 7570b37 \n repository: /var/www/discourse/plugins/docker_manager”
mofosyne grant_admin xxxx 2018-02-03 11:00:08 UTC
mofosyne change_trust_level xxxx 2018-02-03 10:48:57 UTC “old trust level: 1 \n new trust level: 4”
mofosyne change_site_setting force_https 2018-01-22 11:08:38 UTC
mofosyne custom_staff 2018-01-20 05:16:21 UTC “from_version: 727a451 \n repository: /var/www/discourse”
mofosyne. custom_staff 2018-01-20 05:08:42 UTC “from_version: 59ed646 \n repository: /var/www/discourse/plugins/docker_manager”
… etc …

When I did ./launcher stop app and ./launcher start app it gave this error

root@DesigningOpenDemocracy:/var/discourse# ./launcher start app

starting up existing container
+ /usr/bin/docker start app
Error response from daemon: driver failed programming external connectivity on endpoint app (e99d36a67d2dd83c7f9dd0e0c60452e183306fc03c864c509d905161f8a5ba24): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use
Error: failed to start containers: app

Solution is to shutdown apache2 then run ./launcher start app. This is weird as this server is only hosting this single website. Not sure why apache2 is getting in the way.


root@DesigningOpenDemocracy:~# lsof -n -i
COMMAND    PID            USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
systemd-n  429 systemd-network   13u  IPv4  14595      0t0  UDP 45.76.126.24:bootpc 
systemd-r  513 systemd-resolve   11u  IPv4  16035      0t0  UDP *:hostmon 
systemd-r  513 systemd-resolve   12u  IPv4  16036      0t0  TCP *:hostmon (LISTEN)
systemd-r  513 systemd-resolve   13u  IPv6  16038      0t0  UDP *:hostmon 
systemd-r  513 systemd-resolve   14u  IPv6  16039      0t0  TCP *:hostmon (LISTEN)
systemd-r  513 systemd-resolve   17u  IPv4  16042      0t0  UDP 127.0.0.53:domain 
sshd       758            root    3u  IPv4  17570      0t0  TCP *:ssh (LISTEN)
sshd       758            root    4u  IPv6  17578      0t0  TCP *:ssh (LISTEN)
apache2    787            root    4u  IPv6  17624      0t0  TCP *:http (LISTEN)
apache2    788        www-data    4u  IPv6  17624      0t0  TCP *:http (LISTEN)
apache2    789        www-data    4u  IPv6  17624      0t0  TCP *:http (LISTEN)
sshd      1042            root    3u  IPv4  18435      0t0  TCP 45.76.126.24:ssh->118.127.104.26:60332 (ESTABLISHED)
root@DesigningOpenDemocracy:~# cd /var/discourse/
root@DesigningOpenDemocracy:/var/discourse# ./launcher start app

starting up existing container
+ /usr/bin/docker start app
Error response from daemon: driver failed programming external connectivity on endpoint app (e99d36a67d2dd83c7f9dd0e0c60452e183306fc03c864c509d905161f8a5ba24): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use
Error: failed to start containers: app
root@DesigningOpenDemocracy:/var/discourse# sudo ./launcher start app

starting up existing container
+ /usr/bin/docker start app
Error response from daemon: driver failed programming external connectivity on endpoint app (c9e149a0b9d61fb37b39131f1cc3dda51607b74a39a634c3a2c89cb9e95e998c): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use
Error: failed to start containers: app
root@DesigningOpenDemocracy:/var/discourse# 
root@DesigningOpenDemocracy:/var/discourse# 
root@DesigningOpenDemocracy:/var/discourse# 
root@DesigningOpenDemocracy:/var/discourse# 
root@DesigningOpenDemocracy:/var/discourse# 
root@DesigningOpenDemocracy:/var/discourse# /etc/init.d/apache2 stop
[ ok ] Stopping apache2 (via systemctl): apache2.service.
root@DesigningOpenDemocracy:/var/discourse# lsof -n -i
COMMAND    PID            USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
systemd-n  429 systemd-network   13u  IPv4  14595      0t0  UDP 45.76.126.24:bootpc 
systemd-r  513 systemd-resolve   11u  IPv4  16035      0t0  UDP *:hostmon 
systemd-r  513 systemd-resolve   12u  IPv4  16036      0t0  TCP *:hostmon (LISTEN)
systemd-r  513 systemd-resolve   13u  IPv6  16038      0t0  UDP *:hostmon 
systemd-r  513 systemd-resolve   14u  IPv6  16039      0t0  TCP *:hostmon (LISTEN)
systemd-r  513 systemd-resolve   17u  IPv4  16042      0t0  UDP 127.0.0.53:domain 
sshd       758            root    3u  IPv4  17570      0t0  TCP *:ssh (LISTEN)
sshd       758            root    4u  IPv6  17578      0t0  TCP *:ssh (LISTEN)
sshd      1042            root    3u  IPv4  18435      0t0  TCP 45.76.126.24:ssh->118.127.104.26:60332 (ESTABLISHED)
root@DesigningOpenDemocracy:/var/discourse# ./launcher start app

starting up existing container
+ /usr/bin/docker start app
app
root@DesigningOpenDemocracy:/var/discourse# docker ps
CONTAINER ID        IMAGE                 COMMAND             CREATED             STATUS              PORTS                                      NAMES
a1695959c956        local_discourse/app   "/sbin/boot"        24 minutes ago      Up 10 seconds       0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   app

This may just be some server weirdness, but it would be good to hear if anyone else had the same issue today.

From the error messages you posted, it looks like something on your server (Apache) ganked port 80, nothing weird here.

3 Likes

Not likely.

You should remove or disable Apache. Something like

apt purge apache2
2 Likes

Apache runs on Port 80 so does your Discourse install, they conflict.

1 Like

That sounds about right. I must have accidentally installed Apache while I was trying to work out how to follow the install instructions. Ah well, at least this post would give people some idea how to deal with similar issues in the future.

5 Likes