Access discourse installation in a VM


I managed to install discourse on Ubuntu 12.04 inside a VM with vagrant.

I used the updated Vagrantfile that works with Ruby 2.0:

So now: How can I access the discourse instance that is running inside the VM?

TheIP address doesen’t work, the IP the VM has, when I log in:

even inside the VM there seems to be running no service on port 80.

What am i missing?

Do I have to start services inside the VM? Or forward ports somehow?

I use 14.10 on my host. Does that matter?

(Mittineague) #2

work for you?


Ah I see this is the line that forwards the port 3000 to 4000: :forwarded_port, guest: 3000, host: 4000

But it seems like the Vagrant file doesn’t go all the way through. At least with a Ubuntu 15.04 vagrant box discourse does not installed completely.

It crashes when calling the chef script:

ERROR: Cookbook loaded at path(s) [/tmp/vagrant-chef-3/chef-solo-1/cookbooks/vim] has invalid metadata: The `name' attribute is required in cookbook metadata
==> default: [2015-04-12T01:11:32+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

I started a discussion here: Update Vagrantfile to install ruby 2.0 by rubo77 · Pull Request #3363 · discourse/discourse · GitHub

(Mittineague) #4

I don’t know how much help I can be. I’m guessing it might be an Ubuntu version thing or maybe your GEM_HOME / GEM_PATH are messed up.

In the CLI I see

vagrant up
default: /tmp/vagrant-chef-2/chef-solo-1/cookbooks => C:/VirtualBox/discourse/chef/cookbooks

vagrant ssh
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic-pae i686)

And in my VAGRANT file

  config.vm.provision :shell, :inline => "apt-get -qq update && apt-get -qq -y install ruby1.9.3 build-essential && gem install chef --no-rdoc --no-ri --conservative"

  chef_cookbooks_path = ["chef/cookbooks"]

  # This run uses the updated chef-solo and does normal configuration
  config.vm.provision :chef_solo do |chef|
    chef.binary_env = "GEM_HOME=/opt/chef/embedded/lib/ruby/gems/1.9.1/ GEM_PATH= "
    chef.binary_path = "/opt/chef/bin/"
    chef.cookbooks_path = chef_cookbooks_path

    chef.add_recipe "recipe[apt]"
    chef.add_recipe "recipe[build-essential]"
    chef.add_recipe "recipe[vim]"
    chef.add_recipe "recipe[java]"
    chef.add_recipe "recipe[imagemagick]"
    chef.add_recipe "discourse"


So did you use rhe standard Vagrantfile, that is in github?

Or did you adapt it a bit? if so can you post your Vagrantfile please?

(Mittineague) #6

It’s the Vagrantfile GitHub loaded from source.

I did not hack it in any way (I almost always avoid hacking Core files)

I imagine your Vagrantfile is OK, but if it isn’t your Ubuntu version causing the problem it might be something to do with your set-up that is throwing off the GEM_PATH


The Vagrantfile is uprated in the latest git