Site's down - app won't start, port 443 conflict?

AI-generated summary

danb35 reported that their Discourse site went down after a TLS certificate expired and subsequent attempts to rebuild the app failed due to a port 443 conflict. The error indicated that port 443 was already allocated, with docker-proxy listening on it. pfaffman suggested checking for recent rebuilds or PostgreSQL upgrade messages, while Simon_Manning recommended verifying if other Discourse containers (like import) were running and interfering. danb35 confirmed that the import container was indeed active, stopped it, rebuilt the app, and successfully restored the site. The Let’s Encrypt certificate was also automatically renewed. pfaffman later advised permanently removing the unused import container via ./launcher destroy import to prevent recurrence. The issue was resolved by identifying and stopping the conflicting container, allowing the main app to bind to port 443.

I have Discourse installed in a Ubuntu 18.04 VPS following the standard install instructions. It’s been running well for a couple of years now, but when I went to my site this afternoon, the TLS cert was expired–and since it uses HSTS, that means I was completely locked out of the site. Easy enough, I thought, SSH into the server, install updates (just because), run ./launcher rebuild app, and she’ll be right, mate.

Nope, it didn’t work that way; I got an “oops” page. So I decided to reboot the system, and now I’m getting a 502 page when I try to browse there. I can’t start app:

root@talk:/var/discourse# ./launcher start app
x86_64 arch detected.

starting up existing container
+ /usr/bin/docker start app
Error response from daemon: driver failed programming external connectivity on endpoint app (e5db356e19c947c3e1e20a337aea7ee4bdcfa9bc5f3eac485e76439f3ed3a0e9): Bind for 0.0.0.0:443 failed: port is already allocated
Error: failed to start containers: app

…and there is indeed something listening on port 443:

root@talk:/var/discourse# netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      906/docker-proxy    
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      427/systemd-resolve 
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      918/docker-proxy    
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      892/docker-proxy    
tcp6       0      0 :::9936                 :::*                    LISTEN      578/sshd            
udp        0      0 127.0.0.53:53           0.0.0.0:*                           427/systemd-resolve 

I’m afraid I’m stumped–what should I check next?

Has it need a long time since you did a rebuild? Were there any errors? Did it say something about upgrading postgres? Maybe rebuild again.

Another thing you could check is whether a different Discourse container is running, e.g. import. Running the following command and if there are additional containers, looking at the status and ports columns will answer that:

docker container ls

I’ve been keeping the site up-to-date; I recall the postgres upgrade some time back and I handled that then. I don’t recall seeing anything about it this time around, but it’s easy enough to run another rebuild. But while doing that, I saw:

…and indeed import is running. So I stopped that, and once the rebuild finished, the site came back up.

And the Let’s Encrypt cert is renewed (it seems several were issued today, which is a little troublesome), so all’s back now. Thanks for the quick response.

Then you want to.

  ./launcher destroy import