numbas / numbas-lti-provider

An LTI tool provider to run Numbas exams
https://docs.numbas.org.uk/lti/en/latest/
Other
11 stars 12 forks source link

Install failing on Ubuntu 16.04 #9

Closed markolly closed 7 years ago

markolly commented 7 years ago

Had a few issues with the install on a bare ubuntu 16.04 server. Firstly the database commands wouldn't work for me. For the database to get created I had to alter both commands in setup_apache.sh too:

sudo -u postgres psql -c "CREATE USER numbas_lti WITH PASSWORD '????' CREATEDB;" createdb -U numbas_lti numbas_lti -h localhost

When I run the deploy.sh file I then get the following output:

#########

root@zombie:/home/ubuntu/numbas-lti-provider/doc# ./deploy.sh Traceback (most recent call last): File "/usr/lib/python3.5/logging/config.py", line 756, in add_handlers logger.addHandler(self.config['handlers'][h]) File "/usr/lib/python3.5/logging/config.py", line 318, in getitem value = dict.getitem(self, key) KeyError: 'file'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.5/logging/config.py", line 612, in configure self.configure_logger(name, loggers[name]) File "/usr/lib/python3.5/logging/config.py", line 781, in configure_logger self.common_logger_config(logger, config, incremental) File "/usr/lib/python3.5/logging/config.py", line 773, in common_logger_config self.add_handlers(logger, handlers) File "/usr/lib/python3.5/logging/config.py", line 758, in add_handlers raise ValueError('Unable to add handler %r: %s' % (h, e)) ValueError: Unable to add handler 'file': 'file'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "manage.py", line 10, in execute_from_command_line(sys.argv) File "/opt/numbas_lti_python/lib/python3.5/site-packages/django/core/management/init.py", line 350, in execute_from_command_line utility.execute() File "/opt/numbas_lti_python/lib/python3.5/site-packages/django/core/management/init.py", line 324, in execute django.setup() File "/opt/numbas_lti_python/lib/python3.5/site-packages/django/init.py", line 17, in setup configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) File "/opt/numbas_lti_python/lib/python3.5/site-packages/django/utils/log.py", line 71, in configure_logging logging_config_func(logging_settings) File "/usr/lib/python3.5/logging/config.py", line 795, in dictConfig dictConfigClass(config).configure() File "/usr/lib/python3.5/logging/config.py", line 615, in configure '%r: %s' % (name, e)) ValueError: Unable to configure logger 'django': Unable to add handler 'file': 'file' Traceback (most recent call last): File "/usr/lib/python3.5/logging/config.py", line 756, in add_handlers logger.addHandler(self.config['handlers'][h]) File "/usr/lib/python3.5/logging/config.py", line 318, in getitem value = dict.getitem(self, key) KeyError: 'file'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.5/logging/config.py", line 612, in configure self.configure_logger(name, loggers[name]) File "/usr/lib/python3.5/logging/config.py", line 781, in configure_logger self.common_logger_config(logger, config, incremental) File "/usr/lib/python3.5/logging/config.py", line 773, in common_logger_config self.add_handlers(logger, handlers) File "/usr/lib/python3.5/logging/config.py", line 758, in add_handlers raise ValueError('Unable to add handler %r: %s' % (h, e)) ValueError: Unable to add handler 'file': 'file'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "manage.py", line 10, in execute_from_command_line(sys.argv) File "/opt/numbas_lti_python/lib/python3.5/site-packages/django/core/management/init.py", line 350, in execute_from_command_line utility.execute() File "/opt/numbas_lti_python/lib/python3.5/site-packages/django/core/management/init.py", line 324, in execute django.setup() File "/opt/numbas_lti_python/lib/python3.5/site-packages/django/init.py", line 17, in setup configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) File "/opt/numbas_lti_python/lib/python3.5/site-packages/django/utils/log.py", line 71, in configure_logging logging_config_func(logging_settings) File "/usr/lib/python3.5/logging/config.py", line 795, in dictConfig dictConfigClass(config).configure() File "/usr/lib/python3.5/logging/config.py", line 615, in configure '%r: %s' % (name, e)) ValueError: Unable to configure logger 'django': Unable to add handler 'file': 'file'

Thanks

christianp commented 7 years ago

Thanks for reporting this. I'll have another look at the setup script, but it would help if you could tell me your operating system and PostgreSQL versions.

The other error looks like Django can't set up logging. Have you added any logging settings to pretendlti/settings.py? By default, it shouldn't try to log to a file.

christianp commented 7 years ago

Whoops, just noticed you put the OS version in the title! I assume you're on the latest Postgres. I'll create a VM and see if I get the same problem.

markolly commented 7 years ago

we're you able to replicate the issue? I didn't touch the logging settings by the way.

christianp commented 7 years ago

Sorry, I've been busy. I'll try to do this today.

christianp commented 7 years ago

Whoops, didn't mean to close this! I've found the problem - I was setting LOGGING, I just missed it when I first looked. I've updated the instructions. Please have another go and tell me if anything's still missing, or if you manage to get it working.

markolly commented 7 years ago

Unfortunately still having issues. I've installed it using vagrant on ubuntu/xenial64. The app appears to run however, with debug = true, when I go to create the super user i get the following error:

untitled

I then can't sign in using that user.

christianp commented 7 years ago

Aha! The next problem is that I didn't update the settings.py in the docs when I added a feature. You need to add 'django.contrib.auth.backends.ModelBackend' to the AUTHENTICATION_BACKENDS list. I also spotted that there's a reference to one of our servers in STATIC_URL - change that to '/static/'.

I've updated the copy of settings.py in the docs, so you should be able to just copy that over your existing version.

markolly commented 7 years ago

I think thats done it! All appears to be working, thanks!

For info, I had to make a few tweeks to the deploy.sh & setup_apache.sh files to get them to run....

!/usr/bin/bash needed changing to #/bin/bash

I had to add "-h localhost" to the createdb string in setup_apache.sh so it read: createdb -U numbas_lti numbas_lti -h localhost

in the deploy.sh file, at the end it reads: sudo service apache

should this be? sudo service apache2 restart

christianp commented 7 years ago

Phew! Glad we finally got there. I must have tested the deploy script at some point - no idea how the shebang is wrong. I got away with not adding -h localhost to the createdb call - not sure what's going on there. Thanks for the fixes.