Discourse-setup: assumes nc is installed

AI-generated summary

The discourse-setup script assumes that nc (Netcat) is installed, but it may not be available on all operating systems. When supermathie ran the script on a fresh Debian 9 installation on DigitalOcean, the script failed to check the domain name due to the absence of nc. The discussion centered around whether to install nc automatically or provide instructions for users to install it manually. pfaffman suggested recommending the installation of nc if users want to run the test, while codinghorror proposed either stopping the script or printing a warning when nc is not installed. Ultimately, pfaffman decided to leave the existing warning message in place, as no further complaints were reported despite the 6-month delay in addressing the issue.

Ran through the install using discourse-setup (I don’t think I ever have yet, so no time like the present!) and the following error showed up:

Checking your domain name . . .
WARNING:: This server does not appear to be accessible at dotest.example.net:443.

A connection to http://dotest.example.net (port 80) also fails.

This suggests that dotest.example.net resolves to the wrong IP address
or that traffic is not being routed to your server.

Google: "open ports YOUR CLOUD SERVICE" for information for resolving this problem.

You should probably answer "n" at the next prompt and disable Let's Encrypt.

This test might not work for all situations,
so if you can access Discourse at http://dotest.example.net, you might try anyway.

I believe this happened as nc isn’t installed so it couldn’t properly run the test. We should ensure nc is available before erroring out on this check.

3 Likes

I totally believe that I assumed that nc was installed and that on some OSs it’s not.

The messages do suggest that it could be wrong. Did Let’s Encrypt work?

What OS is this? What cloud service?

2 Likes

Fresh debian-9 on DO.

Everything else worked A-OK and it’s up and running great! :+1:

3 Likes

Hmm. Then the question becomes, does discourse-doctor install nc just for one test that might not be necessary, or just say, “well, you don’t have nc, so you’re on your own to see that you have ports open and mapped correctly.”?

I don’t like installing software if it’s not necessary. I think I’ll change the message to recommend installing nc if they want it.

@codinghorror? @mpalmer want to weigh in?

Wasn’t this addressed in a different way by @supermathie?

I’m all for this :+1:

I addressed the problem where Discourse’s email test rake task didn’t properly pick up the STARTTLS option. This is separate.

2 Likes

In that case either stop the script and tell them to re-run with nc installed, or print a warning that the check was skipped because nc was not installed?

2 Likes

I was going to let the script continue with the warning, adding the bit about nc. As it is, it does work, it just suggests that it probably won’t.

4 Likes

Can we close this as good @pfaffman?

Well, it’s 6 months later. I haven’t added a “you don’t have nc, so I can’t test your ports” message, but no one else has complained. Perhaps the language:

     Google: \"open ports YOUR CLOUD SERVICE\" for information for resolving this problem.
    
     You should probably answer \"n\" at the next prompt and disable Let's Encrypt.
    
     This test might not work for all situations,
     so if you can access Discourse at http://$HOST, you might try anyway.

is good enough. It was never a :bug: but really an annoyance for someone who had enough sysadmin sense to not want to use Ubuntu. It works as expected on Ubuntu (I haven’t checked other distros to see). I’m inclined to let this sleeping dog lie.

5 Likes