cloudfoundry-vagrant icon indicating copy to clipboard operation
cloudfoundry-vagrant copied to clipboard

Having trouble accessing deployed apps, when accessing them from host machine

Open mrchrisadams opened this issue 12 years ago • 4 comments

I'm creating a new issue to address the second issue I mentioned in #2, as requested.

Only the cloud_controller responds to port 9022; the router, and thus your apps, are on port 80. However in the current config that's not mapped out of the VM, so you can't access it from your > host OS.

Try a couple of things:

access your application over curl inside the VM. That should work out of the box, as I test for it > often;

This is definitely working for me when I try curl env.vcap.me on the command line from inside the vagrant box.

add to the Vagrantfile something like:

config.vm.forward_port 80, 9080 That should make it available as env.vcap.me:9080

This one gives me a 404 error when I hit env.vcap.me:9080 from the host machine (if I was viewing it from a browser for example).

I'm not getting any logging when I run tail -f /var/log/cloudfoundry/*.log and hit that env.vcap.me:9080 from the host machine, so it looks like the request isn't making it to the cloudfoundry router at all.

I'm not au fait with that's happening between hitting nginx listening at env.vcap.me:9080, and cloudfoundry - let me know if there are any places it's help to share logs on the vagrant box, to help shed light on what's happening here.

mrchrisadams avatar Jan 20 '13 22:01 mrchrisadams

I should be able to reproduce pretty easily, but I'll let you know if I need more info.

Thanks for reporting these bugs, appreciate it!

andreacampi avatar Jan 20 '13 23:01 andreacampi

Uhm OK, just forwarding the port is not going to work either: the router is not going to like that. Besides, my goal is to have a "preview" that is as similar to a production setup as possible; and this kind of port forwarding is not really common in the "real world".

So I have two options, neither of which I particularly like:

  • run nginx and the router on a port > 1024, so that we can keep using .vcap.me; or
  • add an extra network interface and give its own IP address.

The former is nice in that it doesn't require you to mess with the DNS or /etc/hosts, it just works. The disadvantage is that use of a port that is not 80, making for inconvenient URLs. The latter has the only advantage of using port 80, but it requires way too much manual work.

Neither is especially appealing, but maybe it's ok for a development / preview setup. Chris, what do you think?

The ideal solution would be to use Vagrant and Pow together (on Mac); and look, it seems that is a thing! https://github.com/BerlinVagrant/vagrant-dns

andreacampi avatar Jan 21 '13 23:01 andreacampi

Vagrant-dns does indeed look idea - I'll give that a go, and report back.

Thanks Andrea!

mrchrisadams avatar Jan 22 '13 23:01 mrchrisadams

Hey Chris, can you try now? Note that I've kind of deprecated port 9022 for the CC API; you should use port 9080. See single-node/README.md.

andreacampi avatar Jan 26 '13 23:01 andreacampi