Putting NeutronIDE behind another server

65 views
Skip to first unread message

iamonotyourdatas

unread,
May 16, 2012, 4:29:26 PM5/16/12
to Neutron IDE
Hello

First many thanks to the author for this amazing product.

I am trying to get NeutronIDE to work on https behind another server,
apache in my case.

The reason is that I want to serve from that server many services and
from port 443 preferably because I want to access it from everywhere
and ports 80 and 443 are nearly always open, 8000 and 8001 much much
less often.

I have full control over the server configuration (private server) but
I am fighting with my lack of knowledge about django, even though I
know a bit of python.

I saw two options :

- Use mod_rewrite or mod_proxy to forward every requests to the
tornado server on port 8000/8001
I was never able to get the configuration right, I have at best access
to some configuration pages but without reliability (meaning some
parts of the page seems not to be rendered, some actions fail).
I wonder if NeuronIDE is "proxy-able" or not and if somebody was able
to get the right http.conf stanza already ...

- Serve the django app through mod_wsgi, but there I severely lack the
django knowledge do achieve it even if it should be simple. I read
https://docs.djangoproject.com/en/1.3/howto/deployment/modwsgi/ but
since I can't quite figure how the mentionned parts maps to the
NeutronIDE ones I am a bit stuck(for instance is the
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' referring to
settings.py from neutronIDE or some other django concept etc ..).
Moreover I suppose one need to turn off the Tornado server from the
NeutronIDE setting.py and such ...
Maybe somebody already wrote a NeutronIDe.wsgi script and would share
it ?

I think that providing one sample NeutronIDe.wsgi would make proxying
NeutronIDE much easier since installing mod_wsgi or an equivalent is
then something one can do even if is not familiar with dajngo and wsgi
servers in full.

Sorry if I did not do my research well enough, but trust me I tried :)

Thanks a lot for you time on this anyway.

Paul Bailey

unread,
May 16, 2012, 5:05:05 PM5/16/12
to neutr...@googlegroups.com
If you put Neutron behind Apache that will work but it is going to kill web sockets which will kill the web terminal.  I'm pretty sure Apache has a web socket mod now but I have no clue how to set that up.

So if you want the web terminal, the easiest thing to do is to get Neutron running on port 80 and 443.  First make sure anything running on 443 or 80 is stopped or uninstalled.  Then do the following:
  1. sudo apt-get install authbind
  2. touch /etc/authbind/byport/80 /etc/authbind/byport/443
  3. chmod 500 /etc/authbind/byport/80 /etc/authbind/byport/443
  4. chown user:group /etc/authbind/byport/80 /etc/authbind/byport/443
  5. In the file Neutron-IDE/neutron/settings_local.py put:
    HTTP_PORT = 443
    IMG_EDITOR_PORT = 80
To start Neutron run: authbind --deep Neutron-IDE/neutron/neutronide.py start

If you don't care about the terminal and just want to turn it off and still want to use Apache probably the easiest thing is to use a proxy.
  1. Use the same settings as above but add:
    TERMINAL_ON = False
  2. pip install gunicorn or sudo pip install gunicorn
  3. cd Neutron-IDE/neutron
  4. gunicorn_django --workers=1 -p /some/path/neutron.pid -t 10 -D -b 127.0.0.1:7777
Change the port to whatever port you want to use with your proxy.  And you only need only one worker since the IDE is not handling a lot of traffic.

For both setups don't forget to turn on Celery if you want the directory searching capability:
  1. cd Neutron-IDE/neutron
  2. ./manage.py celeryd
There are many alternative setups but these are probably the easiest two.

In the future we'll definitely add a wsgi.py file.  Neutron started out in Django 1.2 or 1.3 and that was not a standard file in Django.  Since it is using Django 1.4 now it probably should have one.

iamonotyourdatas

unread,
May 16, 2012, 6:04:45 PM5/16/12
to Neutron IDE
Thanks for the prompt answer, very nice of you.

I saw the tutorial about running NeutronIDE on 443/80 but since that
particular FreeBSD jail is serving other web services it is not an
option.
The plan is to evaluate a dev server with editor, DVCS, code review
and such and so making them work on the same host is a goal. :)

When you say websocket you mean (http://www.websocket.org/) or just
"web sockets has connections (ip:port)", for my own education.

I'll try to look into your second solution, you seem to install
another webserver gunicorn to replace Tornado and serve DJango ,
right ?

Making NeutronIDE play nicely with other web servers would be cool
indeed, after the "playtest" stage it is the next stage for
"evaluators" like me, and having a complete remote toolset would be
great, NeutronIDE being a key piece.

Thanks a lot for your time.


On May 16, 11:05 pm, Paul Bailey <paul.m.bai...@gmail.com> wrote:
> If you put Neutron behind Apache that will work but it is going to kill web
> sockets which will kill the web terminal.  I'm pretty sure Apache has a web
> socket mod now but I have no clue how to set that up.
>
> So if you want the web terminal, the easiest thing to do is to get Neutron
> running on port 80 and 443.  First make sure anything running on 443 or 80
> is stopped or uninstalled.  Then do the following:
>
>    1. sudo apt-get install authbind
>    2. touch /etc/authbind/byport/80 /etc/authbind/byport/443
>    3. chmod 500 /etc/authbind/byport/80 /etc/authbind/byport/443
>    4. chown user:group /etc/authbind/byport/80 /etc/authbind/byport/443
>    5. In the file Neutron-IDE/neutron/settings_local.py put:
>    HTTP_PORT = 443
>    IMG_EDITOR_PORT = 80
>
> To start Neutron run: authbind --deep Neutron-IDE/neutron/neutronide.py
> start
>
> If you don't care about the terminal and just want to turn it off and still
> want to use Apache probably the easiest thing is to use a proxy.
>
>    1. Use the same settings as above but add:
>    TERMINAL_ON = False
>    2. pip install gunicorn or sudo pip install gunicorn
>    3. cd Neutron-IDE/neutron
>    4. gunicorn_django --workers=1 -p /some/path/neutron.pid -t 10 -D -b
>    127.0.0.1:7777
>
> Change the port to whatever port you want to use with your proxy.  And you
> only need only one worker since the IDE is not handling a lot of traffic.
>
> For both setups don't forget to turn on Celery if you want the directory
> searching capability:
>
>    1. cd Neutron-IDE/neutron
>    2. ./manage.py celeryd

Paul Bailey

unread,
May 16, 2012, 6:19:32 PM5/16/12
to neutr...@googlegroups.com
Yes when I say web sockets I mean a persistent bidirectional connection.  This makes the web terminal very speedy since it doesn't need to setup and tear down Http requests constantly.

And now that you mention it, yes gunicorn is another web server technology.  So really you could just use the built in Tornado server to do the proxy too.  Just run ./neutronide.py -n start

And set the ports to 80 and 443.  -n tells Neutron to turn off SSL which is not needed if your running a proxy.

Other options: -l log to screen instead of log file and -f run in the foreground instead of being a daemon.

I just thought of the gunicorn method because that is how the demo runs which has the terminal turned off:

Paul Bailey

unread,
May 16, 2012, 6:22:15 PM5/16/12
to neutr...@googlegroups.com
Actually I said one thing wrong set the ports to:
HTTP_PORT = 7777  #this will be your proxy port
IMG_EDITOR_PORT = 80 
Reply all
Reply to author
Forward
0 new messages