Page 1 of 1

CLOSED:4.1 -> 4.2 upgrade : web MOD_PYTHON problem

PostPosted: Fri Jul 30, 2010 7:03 pm
by bdezonia
Hello,

I'm new to OMERO and am having some trouble. I've been trying to upgrade an omero installation from 4.1 to 4.2. The 4.1 server was configured to use apache. I was able to backup my old installation, install 4.2, and successfully upgrade the database. However when I try to access my server (via a web browser) I get this python dump:

Code: Select all
MOD_PYTHON ERROR

ProcessId:      3269
Interpreter:    '127.0.1.1'

ServerName:     '127.0.1.1'
DocumentRoot:   '/var/www'

URI:            '/'
Location:       '/'
Directory:      None
Filename:       '/var/www/'
PathInfo:       ''

Phase:          'PythonHandler'
Handler:        'django.core.handlers.modpython'

Traceback (most recent call last):

  File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1537, in HandlerDispatch
    default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1229, in _process_target
    result = _execute_target(config, req, object, arg)

  File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1128, in _execute_target
    result = object(arg)

  File "/home/omero/omero/lib/python/django/core/handlers/modpython.py", line 228, in handler
    return ModPythonHandler()(req)

  File "/home/omero/omero/lib/python/django/core/handlers/modpython.py", line 191, in __call__
    self.load_middleware()

  File "/home/omero/omero/lib/python/django/core/handlers/base.py", line 33, in load_middleware
    for middleware_path in settings.MIDDLEWARE_CLASSES:

  File "/home/omero/omero/lib/python/django/utils/functional.py", line 269, in __getattr__
    self._setup()

  File "/home/omero/omero/lib/python/django/conf/__init__.py", line 40, in _setup
    self._wrapped = Settings(settings_module)

  File "/home/omero/omero/lib/python/django/conf/__init__.py", line 73, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)

  File "/home/omero/omero/lib/python/django/utils/importlib.py", line 35, in import_module
    __import__(name)

  File "/home/omero/omero/lib/python/omeroweb/settings.py", line 44, in <module>
    sys.exit(1)

SystemExit: 1


This is the exact same error that a previous user was having: viewtopic.php?f=5&t=427.

I have followed the debugging steps outlined there and the expected solution (delete .java directory from omero user's home directory) does not fix things. Can someone assist me in debugging this?

Here is some relevant data below. Let me know if you need any log files or a dump of bin/omero admin diagnostics. Thanks for any assistance.

- OS : Ubuntu 9.04

- omero installed in /home/omero/OMERO.server-Beta-4.2.0

- the link /home/omero/omero was created which points to /home/omero/OMERO.server-Beta-4.2.0. the link is owned by the omero user and was chmoded to 777.

omero user home directory:
Code: Select all
omero@open:~$ ls -al
total 193432
drwxr-xr-x  8 omero    omero         4096 2010-07-30 13:02 ./
drwxr-xr-x  9 root     root          4096 2010-07-23 16:08 ../
drwx------  2 omero    omero         4096 2010-07-27 11:04 .aptitude/
-rwxr-xr-x  1 omero    omero          281 2010-07-23 15:31 backupOmeroSql.sh*
-rw-------  1 omero    omero         6062 2010-07-30 13:01 .bash_history
-rw-r--r--  1 omero    omero          220 2009-10-23 16:15 .bash_logout
-rw-r--r--  1 omero    omero         4055 2009-10-23 16:19 .bashrc
-rw-r--r--  1 omero    omero     10059044 2010-07-26 13:20 before_upgrade.db.dump
drwxr-xr-x  2 omero    omero         4096 2010-07-27 11:04 .debtags/
-rw-r--r--  1 omero    omero          357 2009-10-23 16:15 examples.desktop
lrwxrwxrwx  1 omero    omero           23 2010-07-26 16:00 omero -> OMERO.server-Beta-4.2.0/
drwxr-xr-x 10 omero    omero         4096 2010-03-26 09:22 omero-Beta4.1.0-old/
-rw-r--r--  1 omero    omero    101185206 2009-10-23 15:06 omero-Beta4.1.0.tar.bz2
-rw-r--r--  1 omero    omero     86515929 2010-07-26 15:16 omero-Beta4.2.0.tar.bz2
drwxr-xr-x 10 omero    omero         4096 2010-07-27 17:18 OMERO.server-Beta-4.2.0/
-rw-r--r--  1 omero    omero          675 2009-10-23 16:15 .profile
-rw-r--r--  1 omero    omero        14325 2010-07-26 15:42 upgradeDbOutput
-rw-------  1 omero    omero         7951 2010-07-30 12:12 .viminfo
drwxr-xr-x  2 www-data www-data      4096 2010-05-31 14:00 webdb/
drwxr-xr-x  2 www-data www-data     12288 2010-07-26 09:12 weblog/


custom_settings.py contents

Code: Select all
omero@open:~/omero$ cat var/lib/custom_settings.py
#!/usr/bin/env python
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #              Django custom settings for OMERO.web project.          # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
#
# Copyright (c) 2009 University of Dundee.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Author: Aleksandra Tarkowska <A(dot)Tarkowska(at)dundee(dot)ac(dot)uk>, 2008.
#
# Version: 1.0

# Notification
# Application allows to notify user about new shares

LOGDIR = '/home/omero/weblog/'

SERVER_LIST = (
    ('localhost', 4064, 'omero'),
)

ADMINS = (
    # ('Name', 'email'),
)

SERVER_EMAIL = 'omero@loci.wisc.edu'
EMAIL_HOST = 'smtp.wiscmail.wisc.edu'

APPLICATION_HOST='http://open.microscopy.wisc.edu/'



****** var/lib permissions ***************************************************************

[/code]
omero@open:~/omero$ ls -al var/lib
total 16
drwxr-xr-x 2 omero omero 4096 2010-07-29 16:52 ./
drwx------ 6 omero omero 4096 2010-07-27 10:58 ../
-rw-r--r-- 1 www-data www-data 1389 2010-07-27 16:52 custom_settings.py
-rw-r--r-- 1 omero omero 433 2010-07-27 16:57 custom_settings.pyc
[/code]

ls -al lib/python/omeroweb/media

Code: Select all
omero@open:~/omero$  ls -al lib/python/omeroweb/media
total 16
drwxr-xr-x  3 omero omero 4096 2010-07-27 16:09 ./
drwxr-xr-x 12 omero omero 4096 2010-07-27 16:09 ../
drwxr-xr-x  6 omero omero 4096 2010-07-14 09:39 omeroweb/
lrwxrwxrwx  1 omero omero   72 2010-07-27 16:09 webgateway -> /home/omero/OMERO.server-Beta-4.2.0/lib/python/omeroweb/webgateway/media/


/etc/apache2/httpd.conf contents

Code: Select all
<Location "/">
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE omeroweb.settings
    PythonDebug On
    PythonPath "['/home/omero/omero/lib/python', '/home/omero/omero/var/lib', '/home/omero/omero/lib/python/omeroweb'] + sys.path"
</Location>

Re: 4.1 -> 4.2 upgrade : web MOD_PYTHON problem

PostPosted: Fri Jul 30, 2010 8:03 pm
by bdezonia
I moved the contents of /etc/apache2/httpd.conf (listed above) to the end of /etc/apache2/sites-available/default. This was what we did for OMERO 4.1. Still getting the same error.

Re: 4.1 -> 4.2 upgrade : web MOD_PYTHON problem

PostPosted: Mon Aug 02, 2010 7:18 pm
by bdezonia
I noticed the web log files have not been getting updated since my upgrade.

I decided to try to get OMERO.web working with Django as an intermediate step. When I first tried bin/omero web start I'd get an error regarding permissions to web log. So I did some hacking.

I can get OMERO accessible from the web if I:
- change the owner of the weblog directory from www-data user to omero user.
- chmod the permissions of the weblog dir to 777.
- change the owner of the OMEROweb.log file itself to the omero user account

Now, using Django, I can reach the server from a web broswer and from the Insight client.

However, if I do not run Django and just use the Apache setup present but with <Location> info added to the apache conf files I get this error:

when accessing http://open.microscopy.wisc.edu:8000/:

web browser unable to connect

when accessing http://open.microscopy.wisc.edu/

Code: Select all
MOD_PYTHON ERROR

ProcessId:      3254
Interpreter:    '127.0.1.1'

ServerName:     '127.0.1.1'
DocumentRoot:   '/var/www'

URI:            '/'
Location:       '/'
Directory:      None
Filename:       '/var/www/'
PathInfo:       ''

Phase:          'PythonHandler'
Handler:        'django.core.handlers.modpython'

Traceback (most recent call last):

  File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1537, in HandlerDispatch
    default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1229, in _process_target
    result = _execute_target(config, req, object, arg)

  File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1128, in _execute_target
    result = object(arg)

  File "/home/omero/omero/lib/python/django/core/handlers/modpython.py", line 228, in handler
    return ModPythonHandler()(req)

  File "/home/omero/omero/lib/python/django/core/handlers/modpython.py", line 191, in __call__
    self.load_middleware()

  File "/home/omero/omero/lib/python/django/core/handlers/base.py", line 33, in load_middleware
    for middleware_path in settings.MIDDLEWARE_CLASSES:

  File "/home/omero/omero/lib/python/django/utils/functional.py", line 269, in __getattr__
    self._setup()

  File "/home/omero/omero/lib/python/django/conf/__init__.py", line 40, in _setup
    self._wrapped = Settings(settings_module)

  File "/home/omero/omero/lib/python/django/conf/__init__.py", line 73, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)

  File "/home/omero/omero/lib/python/django/utils/importlib.py", line 35, in import_module
    __import__(name)

  File "/home/omero/omero/lib/python/omeroweb/settings.py", line 44, in <module>
    sys.exit(1)

SystemExit: 1



All configuration listed in previous post. Any suggestions?

Re: 4.1 -> 4.2 upgrade : web MOD_PYTHON problem

PostPosted: Mon Aug 02, 2010 10:17 pm
by bdezonia
We were able to get things working. It involved changing various file permissions:
- transferred ownership of all omero directories that were owned by www-data to omero user
- only allowed www-data ownership of the weblog directory
- permissions on the var directory in omero were changed from 700 to 755

Note that the instructions to allow the apache user to own var/lib breaks things for us.

Re: 4.1 -> 4.2 upgrade : web MOD_PYTHON problem

PostPosted: Mon Aug 09, 2010 3:06 pm
by atarkowska
Hi, Thanks for your contribution in building our documentation. You comment will be attached to the documentation.