Problems rebooting due to Nginx taking port 80


(kirsten greed) #1

I am a total newbie on docker and 'nix
I managed to install Discourse at Linode using the “under 30 minutes” instructions and ran it for a few weeks.
I was able to upgrade a few times using the Upgrade link inside Discourse.
Recently however the upgrade message mentioned something about upgrading Docker and then left a message for me to do something by SSH
Unfortunately I did not save what it said.
I connected into Linnode’s Graphical Web Console and Shut down the Virtual Machine
When I started the VM again I got the “Site cannot be reached” message trying to go to my Discourse site.

Then I ran ./launcher rebuild app
This did a lot of things

now if I run docker ps -a I see only one container with image name local_discourse/app
When I try to

docker run local_discourse/app I get a message ‘undefined method’

What should I do?


(Jay Pfaffman) #2

Your data are not lost.

wget -qO- https://get.docker.com/ | sh

Ignore the scary warning. Wait 20 seconds.

Then rebuild.


(kirsten greed) #3

thank you this is what I have been looking at for a few minutes now. The screen dump does not show the wide flashing cursor.
Is something happening or has it locked up?
Capture2


(kirsten greed) #4

Ah the process finished


(kirsten greed) #5

But how do I rebuild?
I don’t even know how to log out and login. I guess I could restart the VM ?


(kirsten greed) #6

ah, I typed
exit
now I have a login prompt
entered
./launcher rebuild app
lots happening…


(Joshua Rosenfeld) #7

That’s good. Should take a few minutes (depending on your server speed). Once “lots happening” stops, you should be good.


(kirsten greed) #8

Here is where it is up to now.
since deleted pic and pasted edited version below


(Jeff Atwood) #10

Can you paste in the relevant console text? Screenshots are invisible to google (at least the text on them is) and hard for us to read.


(kirsten greed) #11

Here is the end messages of the rebuild followed by my attempts at docker commands

ha256:5f3f82545a10e1d90c446eeac5f5b2c0a3b5567d7fa36f414688304666d5a273
88266b5bcf6b2af9a1d3a9374755632ba7a51ca4a9c3f63eb1409b903e35bc95
Removing old container
+ /usr/bin/docker rm app
app

+ /usr/bin/docker run -d --restart=always -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=4 -e UNICORN_SI
DEKIQS=1 -e RUBY_GLOBAL_METHOD_CACHE_SIZE=131072 -e RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000 -e RUBY_GC_HEAP_INIT_SLOTS=40000
0 -e RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOUR
SE_DB_PORT= -e LETSENCRYPT_DIR=/shared/letsencrypt -e DISCOURSE_HOSTNAME=****** -e DISCOURSE_
DEVELOPER_EMAILS=***** -e DISCOURSE_SMTP_ADDRESS=smtp.mailgun.org -e DISCOURSE_SMTP_PORT=587 -e DISCOU
RSE_SMTP_USER_NAME=**** -e DISCOURSE_SMTP_PASSWORD=**** -e LET
SENCRYPT_ACCOUNT_EMAIL=***** -h localhost-app -e DOCKER_HOST_IP=172.17.0.1 --name app -t -p 80:80 -p 4
43:443 -v /var/discourse/shared/standalone:/shared -v /var/discourse/shared/standalone/log/var-log:/var/log --mac-addres
s 02:78:00:1c:c3:10 local_discourse/app /sbin/boot
e0e0ba04da26d6b462c6d5729fac93b584329feb32006bb77b2bfd67881d4970
/usr/bin/docker: Error response from daemon: driver failed programming external connectivity on endpoint app (195c5c5ebd
1592c4188e8fd41da6c5cddeb8c0664c99119530212fbda78fa939): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: add
ress already in use.
root@localhost:/var/discourse# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS
NAMES
root@localhost:/var/discourse# docker ps -a
CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS                         PO
RTS               NAMES
e0e0ba04da26        local_discourse/app   "/sbin/boot"             8 minutes ago       Created
                  app
bca6975a9904        32ed00d59976          "/bin/bash -c 'cd ..."   About an hour ago   Exited (1) About an hour ago
                  objective_goldwasser
root@localhost:/var/discourse#

(kirsten greed) #12

I should have read what I pasted more carefully. I just had to update my SMTP Password


(kirsten greed) #13

(kirsten greed) #14

netstat -tulpn | grep :80

returns

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      4256/nginx -g daemo
tcp6       0      0 :::80                   :::*                    LISTEN      4256/nginx -g daemo

(Sam Saffron) #15
apt-get remove nginx

(kirsten greed) #16

Pasting from the screen

root@localhost:/var/discourse# apt-get remove nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  nginx
0 upgraded, 0 newly installed, 1 to remove and 130 not upgraded.
After this operation, 37.9 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 29873 files and directories currently installed.)
Removing nginx (1.10.3-0ubuntu0.16.04.2) ...
root@localhost:/var/discourse# netstat -tulpn | grep :80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      4256/nginx -g daemo
tcp6       0      0 :::80                   :::*                    LISTEN      4256/nginx -g daemo

(Sam Saffron) #17

Try rebooting. :recycle:


(kirsten greed) #18

I am re running ./launcher rebuild app

I probably should not have done that… the output ended with

Error response from daemon: driver failed programming external connectivity on endpoint app (4c8b7e58e1
27decd60648fe9523fcd407d3465b6f9e1a52cc4c19c841792332d): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: add
ress already in use.

I will repeat the earlier instruction


(kirsten greed) #19
root@localhost:/var/discourse# netstat -tulpn | grep :80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      4256/nginx -g daemo
tcp6       0      0 :::80                   :::*                    LISTEN      4256/nginx -g daemo
root@localhost:/var/discourse# apt-get remove nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'nginx' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 130 not upgraded.

Now I will try reboot


(kirsten greed) #20

Site still cannot be reached


(kirsten greed) #21

trying

sudo lsof -t -i tcp:80 -s tcp:listen | sudo xargs kill