Discourse setup assumes netcat is installed

I’ve just managed to setup my first discourse instance with success, though I had some struggles along the way. I run Debian Stretch and was following the Docker install guide.

During the setup the script checks to see if the domain name you filled in actually ends up on that machine. It does so by using nc (netcat). I found out that this was my issue, I didn’t have netcat installed, a simple install fixed this.

I do however think this is a bug in the installer script, a simple function to check if nc is installed should remedy this, or maybe you can even give the user the freedom to skip the check altogether which would fix the issue as well.

This has come up before, though netcat discourse-setup fails to find it.

The check merely issues a warning, which you are free to ignore, so I don’t consider this a bug.


I’ve considered having discourse-setup installing nc, but having discourse-setup install something that might never be needed seems like something to avoid.

Perhaps the thing to do if nc is missing is to skip the test and suggest that if the test is desired to install nc yourself, perhaps even offering apt install nc.


I have to respectfully disagree, this really smells like bug material right here. Yes you’re printing a warning message which can be ignored but for someone installing discourse for the first time you want to make it as easy as possible to do, which means not having to dig into the source and finding out that you need to install netcat to make this work without errors. Any error will confuse the user/sysadmin which will make them spend time figuring out why it doesn’t work and git blame-ing the person who wrote it. :stuck_out_tongue:

This can be easily sidestepped with a simple check before you run the IP check, like so:

  1. Check if netcat is installed
  2. Continue if it is
  3. If it’s not print a warning message and give the user a yes/no option to continue without the check or to abort so they can install netcat (or even offer to apt/yum/pacman install it for them).

Another option that would work on more systems (though not all) then currently would be to use the /dev/tcp stack. More info on how to do this can be found here. This would fix it for Debian, and works under Ubuntu, I haven’t tried it on other distros.

@pfaffman I made a first stab at this and created a pull request for this. :tada:


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.