Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note
titleWork in progress
Below is not done yet.

Deploying NOCLook

...

Install nginx and uwsgi.

Code Block
$ sudo apt-get install uwsgi nginx-full

uwsgi

Create a uwsgi configuration file.

Code Block
$ sudo vi /etc/uwsgi/apps-available/noclook.ini

The following configuration should be a good start.

[uwsgi]
# Django-related settings
plugins = python
protocol = uwsgi
# the base directory (full path)
chdir           = /var/opt/norduni/norduni/src/niweb/
# Django's wsgi file
wsgi-file       = /var/opt/norduni/norduni/src/niweb/niweb/wsgi.py
env             = DJANGO_SETTINGS_MODULE=niweb.settings
# the virtualenv (full path)
home            = /var/opt/norduni/norduni_environment
# logging
daemonize       = /var/log/uwsgi/app/noclook.log
# process-related settings
# master
master          = true
# maximum number of worker processes
processes       = 5
#threads        = 2
max-requests    = 5000
# the socket (use the full path to be safe
socket          = 127.0.0.1:8001
# clear environment on exit
vacuum          = true

Link the configuration in to the correct directory.

Code Block
sudo ln -s /etc/uwsgi/apps-available/noclook.ini /etc/uwsgi/apps-enabled/noclook.ini

nginx

Configure nginx.

Code Block
title/etc/nginx/sites-available/default
server {$ sudo vi /etc/nginx/sites-available/default

The following configuration should be a good start.

upstream django {    
    listen 80;
    root /opt/norduni/src/niweb;server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}

server {
    server_name ni.examplenordu.net;

    access_loglocation /var/log/ni/noclook-access.log;
static/ {
		include    error_log /varetc/log/ni/noclook-error.lognginx/uwsgi_params;

    location /static/ {
        root  root   /opt/norduni/src/niweb/;
        autoindex on;
        access_log   off;
        expires      30d; 
    }

    location / {
        proxy_pass_header Server;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_connect_timeout 10;
        proxy_read_timeout 10;
        proxy_pass http://localhost:8000/;
    }   
}

...