Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added upgrade guide

...

You need to configure djangosaml2 to use local metadata, and you will have to add the meta-dataupdater to cron, preferably by running crontab -e as the ni user. Once an hour is reasonable, once a day can be ok, once a week might be tiresome when the cert expires.

Upgrade from NI 2 to 3

NEO4j 3.2

You can choose to either install the debian package of neo4j 3.2 or use the docker version of neo4j.

Code Block
# Stop the old neo4j installation, and remove it from rc.d
$ sudo service neo4j-service stop
$ sudo update-rc.d -f neo4j-service remove

Debian package

 

You can follow the installation steps from the setup guide above.

If you use the debian package, you might want to change your database path, default is `/var/lib/neo4j/data`.

Docker image

You can also choose to run NEO4j as a docker image.

  1. Pull the relevant docker image
  2. Make a data dir
  3. Change the password by connecting to the database
  4. Only expose the ports locally 127.0.0.1:7474:7474 
  5. Setup system.d or other way of keeping NEO4j running all the time.

Migating data

There are two ways of migrating data for ni, either let neo4j handle the database upgrade or restore ni data from backup.

Let neo4j handle the database migration

  1. Stop neo4j service if running
  2. Remove data/databases/graph.db in 3.2 `sudo rm -r /var/lib/neo4j/data/databases/graph.db/`
  3. Enable data migration in neo4j.conf `dbms.allow_format_migration=true` (should probably be disabled after first migration is done)
  4. Import database from 2.x `sudo -u neo4j neo4j-admin import --mode=database --database=graph.db --from=/var/opt/neo4j-community-2.1.8/data/graph.db/``
  5. Set password `sudo -u neo4j neo4j-admin set-default-admin`
  6. Start neo4j service `sudo service neo4j start`
    1.  you can follow along in `logs/neo4j.log`

Import ni backup

  1. First make sure you have a backup of your current ni data (use the src/scripts/noclook_producer.py -O some_dir along with dumping the postgresql database using pg_dump)
  2. Use src/scripts/noclook_consume.py with a conf file that points to noclook data created with noclook_producer

Setup neo4j user password

After migrating your data you need to set a password on you neo4j database.

You might have to remove the old auth settings first: `sudo rm /var/lib/neo4j/data/dbms/auth`

Code Block
$ sudo -u neo4j neo4j-admin set-initial-password your_awesome_password

Upgrade NI

Code Block
# In norduni directory as the NI user
$ git stash
$ git pull origin master
$ git stash apply
$ rm -r src/niweb/norduniclient
 
# Delete old virtualenv and create a new
$ cd ..
$ rm -r norduni_environment
$ virtualenv norduni_environment
$ . norduni_environment/bin/activate
$ pip instal -U pip
$ pip install -U -r norduni/requirements/prod.txt
 
# update norduni/src/niweb/.env to have:
	NEO4J_USERNAME=neo4j
    NEO4J_PASSWORD=your_awesome_password
    NEO4J_RESOURCE_URI=bolt://localhost:7687

Then you can restart uwsgi.

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