SOLVED: "The connection was reset" with Discourse Vagrant

(Marcus Baw) #1


I’m looking to start playing around with hacking a plugin for Discourse, so I dutifully followed the Vagrant Install guide here: discourse/ at master · discourse/discourse · GitHub

I’ve used Vagrant before and things appeared to work well however after running bundle exec rails s (and getting standard Rails server startup output including ‘Listening on localhost:3000, CTRL+C to stop’, I am unable to connect to the Discourse server at the forwarded port at in a browser in the host machine. I get the browser error ‘The connection was reset’.

Am I right in thinking that the guest’s port 3000 is forwarded to the host’s port 4000 so I should be able to connect at in the host?

Using curl in Bash in the host returns ‘curl: (56) Recv failure: Connection reset by peer’
curl in the guest returns HTML code as expected

The host is Linux Mint 17.2 running Virtualbox 5.0.2 with the VBox Extras added
uname -r on host: 3.16.0-38-generic
The guest is the standard Discourse Vagrant install of Ubuntu 32 bit with the correct 5.0 Guest Additions in there (I upgraded from the stock VBox 4.2 Guest Additions because I thought it might solve the problem)
uname -r on guest: 3.13.0-65-generic

netstat -ntlp on host shows it is listening on port 4000: (tcp 0 0* LISTEN -)
netstat -ntlp on guest shows it is listening on it’s own port 3000: (tcp 0 0* LISTEN 1832/ruby2.2) which should receive forwarded traffic from

I tried Chrome with the same result.

Anybody any thoughts? Could this be a RAM/performance issue? The vagrant box (guest) is running as per the Vagrantfile’s declaration, with 8 cores, but I did notice it only had 1Gb RAM, which is not much for Discourse and wouldn’t be enough for one my VPS Docker installs. The setting for this RAM value seems to come from an environment variable ‘DISCOURSE_VM_MEM’ - anyone know where this is assigned? (I could hack it in the Vagrantfile but it seems wrong)

It’s driving me mad. It’s probably something ridiculously simple. I tried googling & SO but nothing seemed to be relevant.

`vagrant up` not from command line?
(Mittineague) #2

This has come up a few times here. Maybe the recent change needs to be better documented in the “starting rails” section?

(Marcus Baw) #3

@Mittineague thank you that has fixed it! Apologies for the duplicated question. Marked as solved.

(Matt Palmer) #4

Thanks for the pointer, @Mittineague. I’ve updated the rails s command to include -b, so this should make life a lot easier for new users from now on.

(Jeff Atwood) #5