pkaramol
pkaramol

Reputation: 19322

Vagrant port not exposed

I am using an ubuntu/xenial64 vagrant box and following the instructions indicated here to set up a readthedocs server.

I am also hard coding a static private net IP in Vagrantfile:

  config.vm.network "private_network", ip: "192.168.33.10"

However, after starting the Django server:

(rtd) vagrant@ubuntu-xenial:~/rtd/checkouts/readthedocs.org$ python manage.py runserver
[14/Mar/2018 05:22:40] root:120[1581]: INFO Generating grammar tables from /usr/lib/python2.7/lib2to3/Grammar.txt
[14/Mar/2018 05:22:40] root:120[1581]: INFO Generating grammar tables from /usr/lib/python2.7/lib2to3/PatternGrammar.txt
[14/Mar/2018 05:22:41] root:120[1585]: INFO Generating grammar tables from /usr/lib/python2.7/lib2to3/Grammar.txt
[14/Mar/2018 05:22:41] root:120[1585]: INFO Generating grammar tables from /usr/lib/python2.7/lib2to3/PatternGrammar.txt
Performing system checks...

System check identified some issues:

WARNINGS:
?: (1_8.W001) The standalone TEMPLATE_* settings were deprecated in Django 1.8 and the TEMPLATES dictionary takes precedence. You must put the values of the following settings into your default TEMPLATES dict: TEMPLATE_DEBUG.
?: (guardian.W001) Guardian authentication backend is not hooked. You can add this in settings as eg: `AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend', 'guardian.backends.ObjectPermissionBackend')`.

System check identified 2 issues (1 silenced).
March 14, 2018 - 05:22:42
Django version 1.9.12, using settings 'readthedocs.settings.dev'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

I am unable to access http://192.168.33.10:8000/

Within the vagrant machine:

vagrant@ubuntu-xenial:~$ netstat -ta
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 *:ssh                   *:*                     LISTEN     
tcp        0      0 localhost:8000          *:*                     LISTEN     
tcp        0      0 localhost:6379          *:*                     LISTEN  

Using

$ vagrant --version
Vagrant 2.0.2

and Virtualbox 5.2.8 r121009 (Qt5.6.1) on Ubuntu 16.04.03 host.

Upvotes: 1

Views: 439

Answers (1)

Frederic Henri
Frederic Henri

Reputation: 53713

Everything is detailed at the end of the document

For builds to properly kick off as expected, it is necessary the port you’re serving on (i.e. runserver 0.0.0.0:8080) match the port defined in PRODUCTION_DOMAIN. You can utilize local_settings.py to modify this. (By default, it’s localhost:8000)

You can do one of the two:

  • start the server with python manage.py runserver 0.0.0.0:8080
  • update local_settings.py and change localhost:8000 with 0.0.0.0:8080

You can also replace 0.0.0.0 with the IP you've configured for the VM

Upvotes: 2

Related Questions