Commit 69010b4978c24ae7ee8e971d6116825dea59e5d7

Authored by Andrew Buss
Exists in master

Merge branch 'master' of git.ucsd.edu:110swag/flashy-backend

Showing 5 changed files Side-by-side Diff

flashy/wsgi.py View file @ 69010b4
... ... @@ -8,7 +8,6 @@
8 8 """
9 9  
10 10 import os
11   -
12 11 from django.core.wsgi import get_wsgi_application
13 12  
14 13 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "flashy.settings")
flashy/wsgi_django.py View file @ 69010b4
  1 +import os
  2 +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "flashy.settings")
  3 +from django.core.wsgi import get_wsgi_application
  4 +application = get_wsgi_application()
flashy/wsgi_websocket.py View file @ 69010b4
  1 +import os
  2 +import gevent.socket
  3 +import redis.connection
  4 +redis.connection.socket = gevent.socket
  5 +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "flashy.settings")
  6 +from ws4redis.uwsgi_runserver import uWSGIWebsocketServer
  7 +application = uWSGIWebsocketServer()
nginxconf/flashy.cards View file @ 69010b4
... ... @@ -3,6 +3,10 @@
3 3 server localhost:7002;
4 4 }
5 5  
  6 +upstream websocket_production {
  7 + server localhost:7001;
  8 +}
  9 +
6 10 server {
7 11  
8 12 server_name flashy.cards;
... ... @@ -28,6 +32,13 @@
28 32 location ^~ /app/ {
29 33 alias /srv/flashy-frontend/;
30 34 try_files $uri /app/home.html;
  35 + }
  36 +
  37 + location /ws/ {
  38 + proxy_http_version 1.1;
  39 + proxy_set_header Upgrade $http_upgrade;
  40 + proxy_set_header Connection "upgrade";
  41 + proxy_pass http://websocket_production;
31 42 }
32 43  
33 44 location ~ /(api|admin|api-auth)/ {
scripts/run_production.sh View file @ 69010b4
... ... @@ -2,5 +2,6 @@
2 2 source secrets.sh
3 3 source venv/bin/activate
4 4 # 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
  5 +uwsgi /etc/uwsgi/websocket.ini --touch-reload=/etc/uwsgi/websocket.ini &
5 6 newrelic-admin run-program uwsgi /etc/uwsgi/flashy.ini --touch-reload=/etc/uwsgi/flashy.ini