Merge pull request #3429 from FinnStutzenstein/NginxInstructions
Instructions for using Nginx in big mode
This commit is contained in:
commit
6d791c7828
@ -85,8 +85,7 @@ Core:
|
||||
- Added custom translations in config [#3383].
|
||||
- Added dynamic webpage title [#3404].
|
||||
- Added 'go to top'-link [#3404].
|
||||
- Added caching for the index views. When using a Webserver for serving
|
||||
static files see the example configuration in the PR [#3419].
|
||||
- Added caching for the index views [#3419].
|
||||
- Added projector prioritization [#3425].
|
||||
|
||||
Mediafiles:
|
||||
|
@ -193,9 +193,12 @@ Populate your new database::
|
||||
4. Run OpenSlides
|
||||
-----------------
|
||||
|
||||
First start e. g. four workers::
|
||||
First start e. g. four workers (do not use the `--threads` option, because the threads will not spawn across all cores)::
|
||||
|
||||
$ python manage.py runworker --threads 4
|
||||
$ python manage.py runworker&
|
||||
$ python manage.py runworker&
|
||||
$ python manage.py runworker&
|
||||
$ python manage.py runworker&
|
||||
|
||||
To start Daphne as protocol server run::
|
||||
|
||||
@ -207,3 +210,52 @@ To use Geiss instead of Daphne, just download Geiss and start it::
|
||||
|
||||
$ python manage.py getgeiss
|
||||
$ ./personal_data/var/geiss
|
||||
|
||||
5. Use Nginx (optional)
|
||||
|
||||
When using Nginx as a proxy for delivering staticfiles the performance of the setup will increase very much. For delivering staticfiles you have to collect those::
|
||||
|
||||
$ python manage.py collectstatic
|
||||
|
||||
This is an example configuration for a single Daphne/Geiss listen on port 8000::
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name _;
|
||||
|
||||
location /static {
|
||||
alias <your path to>/collected-static;
|
||||
}
|
||||
location ~* ^/(?!ws|wss|webclient|core/servertime|users/whoami|users/login|users/logout|users/setpassword|motions/docxtemplate|projector|real-projector|static|media|rest).*$ {
|
||||
rewrite ^.*$ /static/html/index.html;
|
||||
}
|
||||
location ~* ^/projector.*$ {
|
||||
rewrite ^.*$ /static/html/projector-container.html;
|
||||
}
|
||||
location ~* ^/real-projector.*$ {
|
||||
rewrite ^.*$ /static/html/projector.html;
|
||||
}
|
||||
location ~* ^/webclient.*$ {
|
||||
rewrite ^/webclient/(site|projector).*$ /static/js/webclient-$1.js;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:8000;
|
||||
proxy_read_timeout 5m;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Scheme $scheme;
|
||||
}
|
||||
}
|
||||
|
||||
Using Nginx as a load balancer is fairly easy. Just start multiple Daphnes/Geiss on different ports, change the `proxy_pass` to `http://openslides/` and add this on top of the Nginx configuration::
|
||||
|
||||
upstream openslides {
|
||||
server localhost:2001;
|
||||
server localhost:2002;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ from .models import (
|
||||
|
||||
# Special Django views
|
||||
|
||||
class IndexView(utils_views.CSRFMixin, utils_views.IndexView):
|
||||
class IndexView(utils_views.CSRFMixin, utils_views.TemplateView):
|
||||
"""
|
||||
The primary view for OpenSlides using AngularJS.
|
||||
|
||||
@ -64,7 +64,7 @@ class IndexView(utils_views.CSRFMixin, utils_views.IndexView):
|
||||
template_name = 'templates/index.html'
|
||||
|
||||
|
||||
class ProjectorView(utils_views.IndexView):
|
||||
class ProjectorView(utils_views.TemplateView):
|
||||
"""
|
||||
The primary view for OpenSlides projector using AngularJS.
|
||||
|
||||
@ -74,7 +74,7 @@ class ProjectorView(utils_views.IndexView):
|
||||
template_name = 'templates/projector-container.html'
|
||||
|
||||
|
||||
class RealProjectorView(utils_views.IndexView):
|
||||
class RealProjectorView(utils_views.TemplateView):
|
||||
"""
|
||||
The original view without resolutioncontrol for OpenSlides projector using AngularJS.
|
||||
|
||||
|
@ -50,9 +50,9 @@ class APIView(_APIView):
|
||||
del method_call
|
||||
|
||||
|
||||
class IndexView(View):
|
||||
class TemplateView(View):
|
||||
"""
|
||||
A view to serve a single cached template file. Subclasses has to provide 'template_name'.
|
||||
A view to serve a single cached template file. Subclasses have to provide 'template_name'.
|
||||
"""
|
||||
template_name = None # type: str
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user