telegraphy icon indicating copy to clipboard operation
telegraphy copied to clipboard

Deploying telegraphy

Open Brandl opened this issue 11 years ago • 3 comments

I'm not a Twisted expert and unfortunately I haven't found any explanation in the docs on which is the best setup to use telegraphy in production?

Your recommendation would really help me out.

Kind regards

Brandl avatar Feb 21 '14 22:02 Brandl

Sorry for the late answer. Telegraphy, in its current state, must run in a different process than gunicorn/uWSGI, or whatever wsgi server your're using. The process is started as a django management process. You must keep this process alive with some sort of process monitor (ie: superivosrd). Although is written on top of twisted, it does not use twisted's twistd.

Fornt end configuration could be done with something like http://nginx.org/en/docs/http/websocket.html.

D3f0 avatar Mar 10 '14 13:03 D3f0

Thanks. We decided to run the telegraphy management command with supervisord, so this was a lucky guess. :)

But I've got another question: It's best practice to run websockets on port 80 to avoid getting blocked by a firewall. Which makes this kinda tricky, because (I hope I don't get this wrong) the telegraphy websocket locations have no particular prefix (for the nginx location)? Another possibility to a prefixe would be a ws.example.com subdomain.

Which would be the simplest setup to run telegraphy behind nginx on port 80?


If anyone comes across the same question, this is our supervisord config file:

$ cat /etc/supervisor/conf.d/telegraphy.conf 

[program:run_telegraphy] 
command=/webapps/[app]/bin/python /webapps/[app]/Django/manage.py run_telegraph 
directory=/webapps/[app]/Django
environment=PYTHONPATH='/webapps/[app]/Django' 
user=[restricted_user]
numprocs=1 
stdout_logfile=/webapps/[app]/logs/telegraphy.log 
stderr_logfile=/webapps/[app]/logs/telegraphy.log 
autostart=true 
autorestart=true 
startsecs=10 
stopwaitsecs=30

Brandl avatar Mar 10 '14 14:03 Brandl

@Brandl indeed, one of the this I have to change is to add a Prefix for telegraphy's WS entry point URLs.

D3f0 avatar Mar 10 '14 18:03 D3f0