TroubleShooting

I get redirected to http://127.0.0.1:8888/some/url/ when I use the WSGI daemon and the reverse proxy.

You need to add a ProxyPreserveHost directive to your virtualhost configuration. Here is an example:

# vim: set filetype=apache:
<VirtualHost *:80>

    DocumentRoot "/var/www/ecm-instance" 
    ServerName "ecm.yourcorp.url" 

    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    ProxyPreserveHost On
    ProxyPass /static/ !
    ProxyPass / http://127.0.0.1:8888/

    <Directory "/var/www/ecm-instance/static">
        Order deny,allow
        Allow from all
        Options -Indexes
    </Directory>

</VirtualHost>

I get errors IOError: sys.stdout access restricted by mod_wsgi in the logs

2012-05-07 18:49:14,601 [ERROR] django.request - Internal Server Error: /editapi/
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/Django-1.4-py2.6.egg/django/core/handlers/base.py", line 111, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.6/dist-packages/Django-1.4-py2.6.egg/django/contrib/auth/decorators.py", line 20, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/ecm/views/common.py", line 99, in edit_apikey
process.run_async(*tasks_to_execute)
File "/usr/local/lib/python2.6/dist-packages/ecm/apps/scheduler/process.py", line 44, in run_async
proc.start()
File "/usr/lib/python2.6/multiprocessing/process.py", line 104, in start
self._popen = Popen(self)
File "/usr/lib/python2.6/multiprocessing/forking.py", line 90, in init
sys.stdout.flush()
IOError: sys.stdout access restricted by mod_wsgi

You need to add a directive to your apache httpd config

WSGIRestrictStdout Off

It needs to be outside of any VirtualHost configuration. More info here.

Blueprints, Pricecalculation of T2-Components and other Blueprint-related things wont work.

We had some bugs in the SQL-Statements and the generation of the internal database. This is fixed in SVN now. After updating make sure to do a

ecm-admin upgrade <instance> --eve-db-url=http://releases.eve-corp-management.org/eve/eve_ecm.sqlite-5.zip

Change the file according to your database-system (see http://releases.eve-corp-management.org/eve/ for a list).

Wont run with errors referring to python egg cache.

this can happen if you are using a non standard version of python for your system by using altinstall. you can fix it by adding the following to your apache_mod_wsgi.py

import os
os.environ.setdefault("PYTHON_EGG_CACHE", "/tmp/")

[SOLVED in 2.0.2] Upgrading from 1.4.9 to 2.0.0/2.0.1 fails with error: Unknown command: 'migrate'

There is a bug in the migration routine of ecm-admin. If you are migrating from 1.4.9 it is very likely that you will encounter this error:

[ECM] Migrating from ECM 1.4.9...
[ECM] $ /usr/bin/python manage.py migrate hr 0001 --noinput
Unknown command: 'migrate'
Type 'manage.py help' for usage.

As there is no fix at the moment, you need to apply the migration by hand. In order to do that, run these commands:

$ ecm-admin manage <instance directory> migrate hr 0001 --noinput
....
$ ecm-admin manage <instance directory> migrate common 0001 --noinput --fake
....
$ ecm-admin manage <instance directory> migrate corp 0001 --noinput --fake
....
$ ecm-admin manage <instance directory> migrate scheduler 0001 --noinput --fake
....
$ ecm-admin manage <instance directory> migrate assets 0001 --noinput --fake
....
$ ecm-admin manage <instance directory> migrate accounting 0001 --noinput --fake
....
$ ecm-admin manage <instance directory> shell

The last command will open a python shell. You need to type some code to clean up deprecated data from 1.4.9:

1>>> from ecm.apps.common.models import UrlPermission
2>>> UrlPermission.objects.all().delete()
3>>> from ecm.apps.scheduler.models import ScheduledTask
4>>> ScheduledTask.objects.all().delete()
5>>> exit()

Once this is done, you can run the standard upgrade:

$ ecm-admin upgrade <instance directory>
...

I'm getting a strange ImportError: cannot import name template_filters

$ ecm-admin run ecm-instance/
[ECM] Starting...
[ECM] GEvent WSGI server listening on 127.0.0.1:8888.
[ECM] Hit CTRL + C to stop.
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/gevent/pywsgi.py", line 438, in handle_one_response
    self.run_application()
  File "/usr/lib64/python2.7/site-packages/gevent/pywsgi.py", line 424, in run_application
    self.result = self.application(self.environ, self.start_response)
  File "/usr/lib64/python2.7/site-packages/Django-1.4-py2.7.egg/django/core/handlers/wsgi.py", line 241, in __call__
    response = self.get_response(request)
  File "/usr/lib64/python2.7/site-packages/Django-1.4-py2.7.egg/django/core/handlers/base.py", line 179, in get_response
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File "/usr/lib64/python2.7/site-packages/Django-1.4-py2.7.egg/django/core/handlers/base.py", line 224, in handle_uncaught_exception
    if resolver.urlconf_module is None:
  File "/usr/lib64/python2.7/site-packages/Django-1.4-py2.7.egg/django/core/urlresolvers.py", line 323, in urlconf_module
    self._urlconf_module = import_module(self.urlconf_name)
  File "/usr/lib64/python2.7/site-packages/Django-1.4-py2.7.egg/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/usr/lib64/python2.7/site-packages/ecm-2.0.1-py2.7.egg/ecm/urls.py", line 25, in <module>
    from ecm.views.auth.forms import PasswordChangeForm, PasswordResetForm, PasswordSetForm
  File "/usr/lib64/python2.7/site-packages/ecm-2.0.1-py2.7.egg/ecm/views/__init__.py", line 37, in <module>
    from ecm.views import template_filters
ImportError: cannot import name template_filters
<WSGIServer fileno=4 address=127.0.0.1:8888>: Failed to handle request:
  request = GET / HTTP/1.1 from ('127.0.0.1', 57747)
  application = <django.core.handlers.wsgi.WSGIHandler object at 0x2cde110>

Sometimes with a database connection error first.

psql: could not connect to server: Permission denied
      Is the server running locally and accepting
      connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

This can happen with postgresql when the user that runs ecm has the same name than the user in postgres and that user has no rights to access the database via the unix-socket.

You can solve that:

  • by adding the user to the "postgres" group (recommended)
  • by giving read/execute access to everyone on the unix-socket (not recommended)

Setting INNODB as the default database engine

in your my.cnf which is probably located in /etc/mysql/my.cnf
you need to search for hte [mysqld] section. then add hte following line

default-storage-engine = INNODB

Converting your MySQL database tables to INNODB

here is a couple of commands that you can use to convert your database quickly and easily.

Note: You might want to Restart your MySQL server after this change as sometimes wild locks appear!!!

mysql -u [USER_NAME] -p -e "SHOW TABLES IN [DATABASE_NAME];" | tail -n +2 | xargs -I '{}' echo "ALTER TABLE {} ENGINE=INNODB;" > alter_table.sql
perl -p -i -e 's/(search_[a-z_]+ ENGINE=)INNODB/\1MYISAM/g' alter_table.sql
mysql -u [USER_NAME] -p [DATABASE_NAME] < alter_table.sql