ckan / ckan-docker

Scripts and images to run CKAN using Docker Compose
98 stars 181 forks source link

Datapusher failing #17

Closed Analect closed 1 year ago

Analect commented 9 years ago

This is partly related to #16 ... as part of trouble-shooting to get CKAN functioning under this ckan-docker set. Unlike in #16 this is with a blank set-up, as spun up by 'docker-compose up' ... I haven't dropped / recreated databases and haven't restored any existing ckan or datastore databases.

My config details are below. In addition, I've added a bunch of ckanext in the _src/ directory, as per below. Am I right in thinking that the set up of these extensions is handled for me ... or do I have to do the various paster db init etc... for each of these ... such as harvest and spatial?

-rwxrwxr-x 1 user_me user_me 350 Mar 29 10:13 README.md drwxrwxr-x 10 user_me user_me 4096 Mar 29 12:38 ckan drwxrwxr-x 6 user_me user_me 4096 Mar 29 12:38 ckanext-geojsonview drwxrwxr-x 5 user_me user_me 4096 Mar 29 12:38 ckanext-geoview drwxrwxr-x 6 user_me user_me 4096 Mar 29 12:38 ckanext-harvest drwxrwxr-x 6 user_me user_me 4096 Mar 29 12:38 ckanext-pdfview drwxrwxr-x 7 user_me user_me 4096 Mar 29 12:38 ckanext-spatial

config ckan.ini: https://gist.github.com/Analect/471654e6df10915b3318 apache error logs: https://gist.github.com/Analect/27e83e5e5be7200efdc6 error from datapusher: https://gist.github.com/Analect/ebcc6706012637fc1da0

Unlike in #16 with the AWS instance, I am able to run this test upload (https://github.com/ckan/example-add-dataset) without an issue once I change the IP in the url in the *.py file. However, eventhough I have all the relevant view types installed, the 'paster views create' script doesn't appear to work very effectively, for whatever reason.

Problems:

  1. Given that I have datastore and datapusher plugsin enabled ... I would expect that the xls and csv sample files get picked up by the datapusher and get added to the datastore. That isn't happening though. A link to the error generated is above, when I try to manually push to the datastore in the manage resource dialogue-box.

image

  1. When I look in the general error logs, I can see problems related to mod_wsgi, which brings me back to this link. https://ckan.readthedocs.org/en/latest/maintaining/installing/deployment.html I can see one possible source of the problem is permissioning: (default)root@ckan:/etc/ckan/default# ls -ltr total 16 -rwxrwxr-x 1 root root 451 Mar 29 09:13 apache.wsgi lrwxrwxrwx 1 root root 50 Mar 29 11:37 who.ini -> /usr/lib/ckan/default/src/ckan/ckan/config/who.ini -rwxrwxr-x 1 1000 1000 618 Mar 30 15:10 custom_options.ini -rw-r--r-- 1 root root 5886 Mar 30 21:35 ckan.ini

While the ckan.ini appears to have the right permissioning, but perhaps the others do not. The link above says: " The Apache web server needs to have permission to access your WSGI script file and all of its parent directories. The permissions of the file should look like -rw-r--r-- and the permissions of each of its parent directories should look like drwxr-xr-x." Should this permissioning of relevant files/folders ideally be handled by the dockerfiles?

  1. I can see that there are problems with the datapusher container when I exit the 'docker-compose up' process. Stopping ckandocker_nginx_1... Stopping ckandocker_ckan_1... Stopping ckandocker_postgres_1... Stopping ckandocker_data_1... Stopping ckandocker_solr_1... Stopping ckandocker_datapusher_1...

Aborting. Exception in thread Thread-1 (most likely raised during interpreter shutdown): Traceback (most recent call last): File "/code/build/docker-compose/out00-PYZ.pyz/threading", line 552, in __bootstrap_inner File "/code/build/docker-compose/out00-PYZ.pyz/threading", line 505, in run File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.multiplexer", line 41, in _enqueue_output File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.log_printer", line 62, in _make_log_generator File "/code/build/docker-compose/out00-PYZ.pyz/compose.container", line 139, in wait File "/code/build/docker-compose/out00-PYZ.pyz/docker.client", line 999, in wait File "/code/build/docker-compose/out00-PYZ.pyz/docker.client", line 78, in _post File "/code/build/docker-compose/out00-PYZ.pyz/requests.sessions", line 425, in post File "/code/build/docker-compose/out00-PYZ.pyz/requests.sessions", line 383, in request File "/code/build/docker-compose/out00-PYZ.pyz/requests.sessions", line 486, in send File "/code/build/docker-compose/out00-PYZ.pyz/requests.adapters", line 374, in send <type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'error'

  1. When I bring up the CKAN instance, then the effect of running the paster index rebuild earlier has been lost ... so somehow the solr index is not getting persisted. I end up having to re-run it to even be able to see the datasets.

image

Analect commented 9 years ago

I think part of the problem might relate to the set-up not being able to resolve ckan.localdomain

This is /etc/hosts on ckandocker_ckan_1 image

This is an example CSV file ... where clicking on this link fails to resolve ... if I manually replace ckan.localdomain with either 172.17.0.15 or localhost .. it resolves image

This probably explains why the datapusher isn't working and why the data isn't getting push to the datastore. image

Any thoughts on how I might resolve? Thanks

clementmouchet commented 9 years ago

Re-db initialisation, yes it is done for you at runtime.

The domain ckan.localdomain is nothing more than a simple example. If you use it, the host must know how to resolve this. I suspect your network config is causing the issue. Can you give me details on the context? OS, network, proxy, vpn, dns ...

You should not recreate containers every time, I tend to use fig up -d the first time then fig up --no-recreate to just restart them in order.

I'm jumping in a plain and will get back to you later today

jmbarrios commented 9 years ago

I believe that the problem is that the datapusher container is not linked to the ckan container so the ckan container address can't be resolved from the datapusher container. This is /etc/host file of the datapusher container:

172.17.0.144    datapusher.localdomain datapusher
127.0.0.1   localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

I tried to ping ckan.localdomain from the datapusher container and the ping command gives me a unknown host error.

makkus commented 9 years ago

Yup, I'm getting the same error. Once I manually edit /etc/hosts in the datapusher container it works. Not sure what can be done, since adding a link to the ckan container to the datapusher part in docker-compose.yml results in a circular reference.

clementmouchet commented 9 years ago

Depending on your network configuration you may have to change the ckan.localdomain hostname to something more suitable, that can be resolved. As you said we can't link it to the datapusher.

jmbarrios commented 9 years ago

@clementmouchet Docker has announced a new feature to create virtual networks for containers. It could be a possible solution. Check it out: http://blog.docker.com/2015/06/networking-receives-an-upgrade/