Paster does not work when installing DB

1.2k views Asked by At

I have tried to use the below forum to item to fix the problem but it did not seam to work for me

https://stackoverflow.com/questions/21955234/ckan-install-paster-error

Amazingly I got the same issue when I tried to install CKAN on windows.

paster db init -c XXXX/development.ini not working for CKAN-command 'db' not know This time I am trying to install CKAN on Ubuntu 12.04 (actually 12.04.5 as I couldn't get 12.0.4) as instructed in

http://docs.ckan.org/en/latest/maintaining/installing/install-from-source.html

I am having to install everything using a PROXY

I have added the password to the SQL Chemistry and the Development.ini does exist. This is my error (below)

Is this a proxy issue? I have used the chmod to change the access to the ini file as the other forum recommended. I also set the virtual path. The database base does exist as I check it. :

(default)root@UbuntaDataServer:/usr/lib/ckan/default/src/ckan# paster db init -c /etc/ckan/default/development.ini
    Traceback (most recent call last):
      File "/usr/lib/ckan/default/bin/paster", line 9, in <module>
        load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')()
      File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 104, in run
        invoke(command, command_name, options, args[1:])
      File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 143, in invoke
        exit_code = runner.run(args)
      File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 238, in run
        result = self.command()
      File "/root/ckan/lib/default/src/ckan/ckan/lib/cli.py", line 156, in command
        self._load_config()
      File "/root/ckan/lib/default/src/ckan/ckan/lib/cli.py", line 98, in _load_config
        load_environment(conf.global_conf, conf.local_conf)
      File "/root/ckan/lib/default/src/ckan/ckan/config/environment.py", line 232, in load_environment
        p.load_all(config)
      File "/root/ckan/lib/default/src/ckan/ckan/plugins/core.py", line 124, in load_all
        unload_all()
      File "/root/ckan/lib/default/src/ckan/ckan/plugins/core.py", line 182, in unload_all
        unload(*reversed(_PLUGINS))
      File "/root/ckan/lib/default/src/ckan/ckan/plugins/core.py", line 210, in unload
        plugins_update()
      File "/root/ckan/lib/default/src/ckan/ckan/plugins/core.py", line 116, in plugins_update
        environment.update_config()
      File "/root/ckan/lib/default/src/ckan/ckan/config/environment.py", line 270, in update_config
        search.check_solr_schema_version()
      File "/root/ckan/lib/default/src/ckan/ckan/lib/search/__init__.py", line 291, in check_solr_schema_version
        res = urllib2.urlopen(req)
      File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
        return _opener.open(url, data, timeout)
      File "/usr/lib/python2.7/urllib2.py", line 406, in open
        response = meth(req, response)
      File "/usr/lib/python2.7/urllib2.py", line 519, in http_response
        'http', request, response, code, msg, hdrs)
      File "/usr/lib/python2.7/urllib2.py", line 444, in error
        return self._call_chain(*args)
      File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
        result = func(*args)
      File "/usr/lib/python2.7/urllib2.py", line 527, in http_error_default
        raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
    urllib2.HTTPError: HTTP Error 503: Service Unavailable
4

There are 4 answers

0
Ross On

This part of the stacktrace:

File "/root/ckan/lib/default/src/ckan/ckan/lib/search/init.py", line 291, in check_solr_schema_version

res = urllib2.urlopen(req)

Suggests that there is a problem connecting to Solr. You should make sure solr is running, that you can connect to it, and that the setting in your .ini file for the location and port that solr is running on is correct.

0
Alex On

This is not the complete answer. Maybe close.

This is what I see on http:||localhost|solr|

Solr Admin (ckan)
UbuntaDataServer:8983
cwd=/var/cache/jetty/tmp SolrHome=/usr/share/solr/

This is what is running on the URL. I assume this is close or correct?

Any more suggestions?

0
Marvpel On

Using CKAN 2.2 I had the same problem with proxies that require authentication

If you are installing CKAN from sources, I suggest to move to 2.2.1 version (or newer). In these versions I found no issues with auth proxy.

Anyway, if you're bound to a specific, older version of CKAN, you can manually add a proxy handler.

First of all, set your http_proxy env vars (both uppercase and lowercase)

Now you can edit the file ckan/ckan/lib/search/__init__.py and get your hands dirty.

We need to declare a handle_proxy() function:

import os
def handle_proxy():
    proxy_settings = dict()
    for k,v in os.environ.items():
        if k.rfind('_proxy') > -1:
            proxy_settings[k] = v
    proxy_handler = urllib2.ProxyHandler(proxy_settings)
    opener = urllib2.build_opener(proxy_handler)
    urllib2.install_opener(opener)

Now we can call it in the check_solr_schema_version() function just before sending the request.
Replace

res = urllib2.urlopen(req)

with

handle_proxy()
res = urllib2.urlopen(req)

NOTE: this is a temporary workaround, just in case upgrading to newer versions (i currently use the 2.2.2 branch) does not fix the problem for you. I wouldn't suggest it for a production environment :)

0
Alex On

I found another answer, if the above does not work, try: Install this again:

sudo -E apt-get install python-pastescript

. /usr/lib/ckan/default/bin/activate

cd /usr/lib/ckan/default/src/ckan

paster make-config ckan /etc/ckan/default/development.ini

Change SOLR to your IP number and not localhost

paster db init -c /etc/ckan/default/development.ini

Hope that fixes your problem