From a54c6570350d3d969a575473f9c6911758b3a09a Mon Sep 17 00:00:00 2001 From: Rohan Rangray Date: Wed, 20 May 2015 12:47:55 -0700 Subject: [PATCH] Changed nginx.conf and run_production.sh to run the websockets server --- nginxconf/flashy.cards | 11 +++++++++++ scripts/run_production.sh | 1 + 2 files changed, 12 insertions(+) diff --git a/nginxconf/flashy.cards b/nginxconf/flashy.cards index 78958fb..6bf86c6 100644 --- a/nginxconf/flashy.cards +++ b/nginxconf/flashy.cards @@ -3,6 +3,10 @@ upstream backend_production { server localhost:7002; } +upstream websocket_production { + server localhost:7001; +} + server { server_name flashy.cards; @@ -30,6 +34,13 @@ server { try_files $uri /app/home.html; } + location /ws/ { + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_pass http://websocket_production; + } + location ~ /(api|admin|api-auth)/ { add_header 'Access-Control-Allow-Origin' 'http://localhost'; add_header 'Access-Control-Allow-Credentials' 'true'; diff --git a/scripts/run_production.sh b/scripts/run_production.sh index 50ab1a7..b57da49 100755 --- a/scripts/run_production.sh +++ b/scripts/run_production.sh @@ -2,4 +2,5 @@ source secrets.sh source venv/bin/activate # newrelic-admin run-program /srv/flashy-backend/venv/bin/gunicorn --pid /run/flashy/gunicorn.pid -w 6 -n flashy -b 127.0.0.1:7002 flashy.wsgi +uwsgi /etc/uwsgi/websocket.ini --touch-reload=/etc/uwsgi/websocket.ini & newrelic-admin run-program uwsgi /etc/uwsgi/flashy.ini --touch-reload=/etc/uwsgi/flashy.ini -- 1.9.1