...
Code Block |
---|
$ sudo service nginx restart |
SAML SP
If you want to set up NOCLook as a SAML SP you need to install the following packages and Python modules.
Code Block |
---|
$ sudo apt-get install libffi-dev xmlsec1 $ sudo -u ni -i $ sudo vim /var/opt/norduni/norduni/src/niweb/.env # Add SAML_ENABLED=true # Set the login url to point to your IDP LOGIN_URL=/saml2/login/?idp=https://idp.nordu.net/idp/shibboleth # If you want to disable normal django login then add DJANGO_LOGIN_DISABLED=true |
...
There is not a lot that needs to be done when updating from 3 to 3.3, mostly you need to update your `.env` config.
Follow After updating .env follow the General Upgrade NI guide, only be aware that you should nuke your `urls.py`.
...
Code Block |
---|
$ rm -r /tmp/django_cache $ sudo service uwsgi restart |
...
Troubleshooting
If you run into problems you can use `python src/niweb/manage.py -h` to see if there are errors.
- `AttributeError: 'NoneType' object has no attribute 'session'` is caused by wrong credentials (or missing configuration there of)
- `ImportError: cannot import name contextmanager` or `ImportError: cannot import name IntegrityError` - you need to delete `src/niweb/norduniclient`
- `ImportError: No module named django.core.exceptions` (you need to source your virtual environment)
- `ImportError: No module named neo4j.v1.exceptions` - Problems with virtualenv installed dependencies, delete your virtualenv and install again
- `neo4j.exceptions.AuthError: The client is unauthorized due to authentication failure.` - your password contains some characters that got mangled, e.g. # or @, remove
- `IOError: [Errno 13] Permission denied: '/tmp/django_cache/'` - the directory is probably owned by ni user, and not www-data, which uwsgi runs as. Remove the dir, and restart uwsgi
Example configs
.env
Code Block |
---|
# Neo4j settings
NEO4J_RESOURCE_URI=bolt://localhost:7687
NEO4J_MAX_DATA_AGE=24
NEO4J_MAX_POOL_SIZE=50
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=<%= $neo4j_password %>
# Report settings
REPORTS_TO=<%= $reports_to %>
# Optional CC and BCC and EXTRA_REPORT_TO
REPORTS_CC=<%= $reports_cc %>
REPORTS_BCC=<%= $reports_bcc %>
EXTRA_REPORT_TO=<%= $extra_reports_to %>
SECURITY_REPORTS_TO=<%= $security_reports_to %>
# Database settings
DB_ENGINE=django.db.backends.postgresql_psycopg2
DB_NAME=norduni
DB_USER=ni
DB_PASSWORD=<%= $postgres_password %>
DB_HOST=localhost
DB_PORT=5432
# Cache settings
CACHE_BACKEND=django.core.cache.backends.filebased.FileBasedCache
CACHE_LOCATION=/tmp/django_cache
# General settings
ALLOWED_HOSTS=<%= $server_name %> <%= $allowed_hosts %> localhost
# If using sentry
SENTRY_DSN=<%= $sentry_dsn %>
DEFAULT_FROM_EMAIL=django@<%= $server_name %>
EMAIL_HOST=localhost
#EMAIL_HOST_PASSWORD=
#EMAIL_HOST_USER=
#EMAIL_PORT=
# Secret key
SECRET_KEY=<%= $secret_key %>
# Google apis key
GOOGLE_MAPS_API_KEY=<%= $google_api_key %>
# Login
# if $saml_enabled:
LOGIN_URL=/saml2/login/?idp=https://idp.nordu.net/idp/shibboleth
SAML_ENABLED=true
# if $django_login_disabled
DJANGO_LOGIN_DISABLED=true |