Skip to content
Snippets Groups Projects
Verified Commit 498aa113 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Initial channels integration

parent 63620ede
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,7 @@ ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS')
# APP CONFIGURATION
# ------------------------------------------------------------------------------
DJANGO_APPS = (
'channels',
# Default Django apps:
'django.contrib.auth',
'django.contrib.contenttypes',
......@@ -253,9 +254,9 @@ MEDIA_URL = env("MEDIA_URL", default='/media/')
# URL Configuration
# ------------------------------------------------------------------------------
ROOT_URLCONF = 'config.urls'
# See: https://docs.djangoproject.com/en/dev/ref/settings/#wsgi-application
WSGI_APPLICATION = 'config.wsgi.application'
ASGI_APPLICATION = "config.routing.application"
# AUTHENTICATION CONFIGURATION
# ------------------------------------------------------------------------------
......@@ -284,6 +285,17 @@ CACHES = {
}
CACHES["default"]["BACKEND"] = "django_redis.cache.RedisCache"
from urllib.parse import urlparse
cache_url = urlparse(CACHES['default']['LOCATION'])
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {
"hosts": [(cache_url.hostname, cache_url.port)],
},
},
}
CACHES["default"]["OPTIONS"] = {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
"IGNORE_EXCEPTIONS": True, # mimics memcache behavior.
......
......@@ -59,3 +59,5 @@ pyacoustid>=1.1.5,<1.2
raven>=6.5,<7
python-magic==0.4.15
ffmpeg-python==0.1.10
channels>=2,<2.1
channels_redis>=2.1,<2.2
......@@ -28,6 +28,11 @@ http {
#gzip on;
proxy_cache_path /tmp/funkwhale-transcode levels=1:2 keys_zone=transcode:10m max_size=1g inactive=24h use_temp_path=off;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 6001;
charset utf-8;
......@@ -40,6 +45,9 @@ http {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host localhost:8080;
proxy_set_header X-Forwarded-Port 8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_redirect off;
location /_protected/media {
......
......@@ -32,6 +32,7 @@ module.exports = {
'/api': {
target: 'http://nginx:6001',
changeOrigin: true,
ws: true
},
'/media': {
target: 'http://nginx:6001',
......
......@@ -17,6 +17,7 @@
"dependencies": {
"axios": "^0.17.1",
"dateformat": "^2.0.0",
"django-channels": "^1.1.6",
"js-logger": "^1.3.0",
"jwt-decode": "^2.2.0",
"lodash": "^4.17.4",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment