mirror of https://github.com/zulip/zulip.git
run-dev: Automate passing --interface='' for vagrant environment.
Fixes #877.
This commit is contained in:
parent
69fa60080c
commit
279f805448
|
@ -62,18 +62,12 @@ Once that finishes, you can run the development server as follows:
|
||||||
```
|
```
|
||||||
vagrant ssh
|
vagrant ssh
|
||||||
# Now inside the container
|
# Now inside the container
|
||||||
/srv/zulip/tools/run-dev.py --interface=''
|
/srv/zulip/tools/run-dev.py
|
||||||
```
|
```
|
||||||
|
|
||||||
To get shell access to the virtual machine running the server to run
|
To get shell access to the virtual machine running the server to run
|
||||||
lint, management commands, etc., use `vagrant ssh`.
|
lint, management commands, etc., use `vagrant ssh`.
|
||||||
|
|
||||||
(A small note on tools/run-dev.py: the `--interface=''` option will
|
|
||||||
make the development server listen on all network interfaces. While
|
|
||||||
this is correct for the Vagrant guest sitting behind a NAT, you
|
|
||||||
probably don't want to use that option when using run-dev.py in other
|
|
||||||
environments).
|
|
||||||
|
|
||||||
At this point you should [read about using the development
|
At this point you should [read about using the development
|
||||||
environment][using-dev].
|
environment][using-dev].
|
||||||
|
|
||||||
|
|
|
@ -300,7 +300,7 @@ Next, start the Zulip server:
|
||||||
|
|
||||||
```
|
```
|
||||||
(zulip-venv)vagrant@vagrant-ubuntu-trusty-64:~ $
|
(zulip-venv)vagrant@vagrant-ubuntu-trusty-64:~ $
|
||||||
/srv/zulip/tools/run-dev.py --interface=''
|
/srv/zulip/tools/run-dev.py
|
||||||
```
|
```
|
||||||
|
|
||||||
As you can see above the application's root directory, where you can
|
As you can see above the application's root directory, where you can
|
||||||
|
@ -477,7 +477,7 @@ server:
|
||||||
christie@win10 ~/zulip
|
christie@win10 ~/zulip
|
||||||
$ vagrant up
|
$ vagrant up
|
||||||
$ vagrant ssh
|
$ vagrant ssh
|
||||||
/srv/zulip/tools/run-dev.py --interface=''
|
/srv/zulip/tools/run-dev.py
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Next Steps
|
#### Next Steps
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import optparse
|
import optparse
|
||||||
|
import pwd
|
||||||
import subprocess
|
import subprocess
|
||||||
import signal
|
import signal
|
||||||
import traceback
|
import traceback
|
||||||
|
@ -57,7 +58,7 @@ parser.add_option('--test',
|
||||||
|
|
||||||
parser.add_option('--interface',
|
parser.add_option('--interface',
|
||||||
action='store', dest='interface',
|
action='store', dest='interface',
|
||||||
default='127.0.0.1', help='Set the IP or hostname for the proxy to listen on')
|
default=None, help='Set the IP or hostname for the proxy to listen on')
|
||||||
|
|
||||||
parser.add_option('--no-clear-memcached',
|
parser.add_option('--no-clear-memcached',
|
||||||
action='store_false', dest='clear_memcached',
|
action='store_false', dest='clear_memcached',
|
||||||
|
@ -65,6 +66,18 @@ parser.add_option('--no-clear-memcached',
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
|
if options.interface is None:
|
||||||
|
user_id = os.getuid()
|
||||||
|
user_name = pwd.getpwuid(user_id).pw_name
|
||||||
|
if user_name == "vagrant":
|
||||||
|
# In the Vagrant development environment, we need to listen on
|
||||||
|
# all ports, and it's safe to do so, because Vagrant is only
|
||||||
|
# exposing certain guest ports (by default just 9991) to the host.
|
||||||
|
options.interface = ""
|
||||||
|
else:
|
||||||
|
# Otherwise, only listen to requests on localhost for security.
|
||||||
|
options.interface = "127.0.0.1"
|
||||||
|
|
||||||
base_port = 9991
|
base_port = 9991
|
||||||
if options.test:
|
if options.test:
|
||||||
base_port = 9981
|
base_port = 9981
|
||||||
|
|
Loading…
Reference in New Issue