[ckan-dev] uWSGI and Nginx with CKAN

Talat Chaudhri talat.chaudhri at gmail.com
Thu Mar 27 11:34:26 UTC 2014


Hello all,

Some time ago I set up CKAN on Apache using modwsgi with Solr on Tomcat7
and provided instructions in a blog post, as suggested by Adrià Mercader
in the (old) thread below on this list. The reason that I provided these
instructions at the time was because I was unable at the time to use
Jetty (with dependencies on Tomcat6) and had to discover how to mod the
instructions to use only Tomcat7 without Jetty. I felt it might be
helpful to some people :-)

http://blog.talatchaudhri.net/2013/09/06/installing-ckan-ubuntu-13-04-tomcat7/

(Some of the instructions it relied on have disappeared, so I have
pointed the links at those pages on the Internet Archive's Wayback
Machine instead.)

However, I wanted to test the possibility of migrating from Apache 2.4
to Nginx and could not find specific instructions to set up CKAN with
uWSGI and Nginx. As a result, I have produced a new blog post with my
best recollections of the process involved, and many in-line notes about
what didn't work:

http://blog.talatchaudhri.net/2014/03/27/uwsgi-nginx-ckan/

If anybody has any helpful suggestions/corrections, I'd be most
grateful. Anyway, I hope these posts are of some use :-)

All the best,


Talat

On 06/09/2013 14:57, Talat Chaudhri wrote:
> Hi Adrià,
>
> Thanks for your reply. I wouldn't expect that, of course :-) In fact, I
> think your instructions are generally very helpful for most distros,
> albeit with people needing to substitute whatever package management
> system for apt-get and all that. It was really just those one or two
> minor points that made it confusing for me, and perhaps I can have a
> look at doing a pull request as you say. Anyway, it's a great system and
> I've already learned quite a lot from installing it, which is why I
> wanted to put up the blog post in case it helps others :-)
>
> Best wishes,
>
>
> Talat
>
> On 06/09/2013 12:07, Adrià Mercader wrote:
>> Hi Talat,
>>
>> Thanks for your long and accurate post. We obviously can't support all
>> platforms and versions on our docs, but if you think that some
>> relevant stuff is missing do please send the details to list or better
>> yet a pull request to the CKAN repo and we'll be happy to add them.
>>
>> Cheers,
>>
>> Adrià
>>
>> On 6 September 2013 10:05, Talat Chaudhri <talat.chaudhri at gmail.com> wrote:
>>> Hi Anders,
>>>
>>> I have just written up my experience on my blog, as well as I could remember
>>> all the steps that differed from the instructions or otherwise confused me.
>>>
>>> http://blog.talatchaudhri.com/2013/09/06/installing-ckan-ubuntu-13-04-tomcat7/
>>>
>>> If anybody has any comments, answers to the various questions raised, or
>>> suggestions for improvement, I'd be very pleased to hear them. Anyway, I
>>> hope that somebody will get something out of my experience setting up CKAN
>>> for the first time on Tomcat 7. Maybe this will help with future
>>> documentation...? :-)
>>>
>>> All the best,
>>>
>>>
>>> Talat
>>>
>>> On 06/09/2013 08:54, Anders Green wrote:
>>>
>>> Hi,
>>> I suspected that permissions were the problem. I will try to pinpoint why
>>> the setup breaks.
>>>
>>> set-permissions seem to fail somehow (and I did a vanilla flavour souce
>>> installation) so I guess more people than us should have experienced this…
>>> but I am a newbie with CKAN, so I'll wait until I figure it out before
>>> posting to the list:)
>>>
>>> cheers
>>> /Anders
>>> --
>>> Senior lecturer
>>> Work phone: +46 8 608 51 44
>>> E-mail: anders.green at sh.se
>>> Visiting address: Moas Båge MD370
>>> Address:
>>> Södertörns högskola
>>> Medieteknik
>>> S - 141 89 HUDDINGE · Sweden
>>>
>>>
>>>
>>>
>>>
>>> On Sep 6, 2013, at 8:06 AM, Talat Chaudhri <talat.chaudhri at gmail.com> wrote:
>>>
>>> Hi Anders,
>>>
>>> It seems like the Tomcat errors were just caused by some lines that needed
>>> commenting out in the default config (and I used plain Tomcat rather than
>>> Jetty because Tomcat7 has newer dependencies than the ones that will
>>> currently work with Jetty on Ubuntu 13.04). I must admit that it was just my
>>> ignorance of postgresql syntax, having only used mysql before, and I was
>>> simply changing the permissions on the wrong database!
>>>
>>> The way I proved to myself that Solr wasn't broken on Tomcat was by breaking
>>> it and then having to put it back together again ;-)
>>>
>>> I'm meaning to write up what I did for anybody else wanting to use Ubuntu
>>> 13.04 and Tomcat7 with CKAN. I'll let you know if I do.
>>>
>>> Best wishes,
>>>
>>>
>>> Talat
>>>
>>> On 05/09/2013 20:04, Anders Green wrote:
>>>
>>> Hi Talat,
>>>
>>> Fixed - cheers :-)
>>>
>>> please let us know how. I experienced the exact same problems and logged
>>> errors (without the Jetty/Tomcat issues you were describing) when installing
>>> the other day. Although the solution probably is simple it would be nice to
>>> know what was the cause of it :)
>>>
>>> best wishes
>>>
>>> /Anders Green
>>> --
>>> Senior lecturer
>>> Work phone: +46 8 608 51 44
>>> E-mail: anders.green at sh.se
>>> Visiting address: Moas Båge MD370
>>> Address:
>>> Södertörns högskola
>>> Medieteknik
>>> S - 141 89 HUDDINGE · Sweden
>>>
>>>
>>>
>>>
>>>
>>> On Sep 5, 2013, at 4:43 PM, Talat Chaudhri <talat.chaudhri at gmail.com> wrote:
>>>
>>> Fixed - cheers :-)
>>>
>>> On 05/09/2013 07:12, Talat Chaudhri wrote:
>>>
>>> Hi,
>>>
>>> Sorry to be a pain and I hope this is a genuine problem rather than me
>>> not doing something obvious that I should have.
>>>
>>> As a newbie here, I've managed to set up CKAN and Solr but I'm getting
>>> some errors that I can't seem to solve. I am running Ubuntu 13.04 and
>>> tomcat7 (on port 8080), so I was not able to run Solr on Jetty because
>>> it required tomcat6 and various dependencies. (I use tomcat7 for other
>>> things.) However, I got it working on tomcat7 without Jetty, as the
>>> instructions suggested is possible. I had to follow third-party
>>> instructions for this part, as there aren't complete instructions on the
>>> CKAN site for Solr on tomcat alone, just the odd reference. I replaced
>>> the schema.xml file via symlink as suggested.
>>>
>>> http://ckan.talatchaudhri.com
>>>
>>> http://localhost:8080/solr points correctly at the Solr admin interface,
>>> which works. I don't see a welcome page, just the admin interface.
>>>
>>> I'm not sure that either the Datastore and/or Solr are working properly.
>>> Symptoms are:
>>>
>>> (1) Internal Server error when going to Explore > Preview in CKAN
>>> (2) These log messages generated in ckan_default.error.log:
>>>
>>> [Thu Sep 05 06:34:24 2013] [error] 2013-09-05 06:34:24,225 INFO
>>> [ckan.lib.base]  /dataset/test-data render time 0.115 seconds
>>> [Thu Sep 05 06:34:27 2013] [error] [client 80.229.138.88] Error - <class
>>> 'sqlalchemy.exc.ProgrammingError'>: (ProgrammingError) permission denied
>>> for relation _table_metadata
>>> [Thu Sep 05 06:34:27 2013] [error] [client 80.229.138.88]  'SELECT 1
>>> FROM "_table_metadata" WHERE name = %s AND alias_of IS NULL'
>>> (u'c7d91b5d-96e0-4c4a-934e-95ea6ede8f1c',)
>>> [Thu Sep 05 06:34:27 2013] [error] 2013-09-05 06:34:27,362 INFO
>>> [ckan.lib.base]
>>> /dataset/test-data/resource/c7d91b5d-96e0-4c4a-934e-95ea6ede8f1c render
>>> time 0.047 seconds
>>> [Thu Sep 05 06:34:27 2013] [error] 2013-09-05 06:34:27,477 INFO
>>> [ckan.lib.base]  /api/i18n/en render time 0.002 seconds
>>>
>>> The only info that I could find that seemed to relate to the SQL error
>>> was at http://lists.okfn.org/pipermail/ckan-dev/2012-October/003227.html
>>> on this list, but running the recommended commands with the users
>>> ckan_default and datastore_default didn't seem to make any difference.
>>>
>>> I did check that the passwords for these users are correctly set in
>>> Postgres, which are also correctly set in production.ini in the places
>>> that are required. (I'm not all that experienced with Postgres, having
>>> previously used MySQL for other projects.)
>>>
>>> (3) Solr is giving errors and the Last Check (under Logging) is then
>>> hanging, after I reboot tomcat. At the time of writing it reads:
>>>
>>> 06:42:13     WARN     SolrResourceLoader     Can't find (or read)
>>> directory to add to classloader: ../../../contrib/extraction/lib
>>> (resolved as: /var/lib/solr/collection1/../../../contrib/extraction/lib).
>>> 06:42:13     WARN     SolrResourceLoader     Can't find (or read)
>>> directory to add to classloader: ../../../dist/ (resolved as:
>>> /var/lib/solr/collection1/../../../dist).
>>> 06:42:13     WARN     SolrResourceLoader     Can't find (or read)
>>> directory to add to classloader: ../../../contrib/clustering/lib/
>>> (resolved as: /var/lib/solr/collection1/../../../contrib/clustering/lib).
>>> 06:42:13     WARN     SolrResourceLoader     Can't find (or read)
>>> directory to add to classloader: ../../../dist/ (resolved as:
>>> /var/lib/solr/collection1/../../../dist).
>>> 06:42:13     WARN     SolrResourceLoader     Can't find (or read)
>>> directory to add to classloader: ../../../contrib/langid/lib/ (resolved
>>> as: /var/lib/solr/collection1/../../../contrib/langid/lib).
>>> 06:42:13     WARN     SolrResourceLoader     Can't find (or read)
>>> directory to add to classloader: ../../../dist/ (resolved as:
>>> /var/lib/solr/collection1/../../../dist).
>>> 06:42:13     WARN     SolrResourceLoader     Can't find (or read)
>>> directory to add to classloader: ../../../contrib/velocity/lib (resolved
>>> as: /var/lib/solr/collection1/../../../contrib/velocity/lib).
>>> 06:42:13     WARN     SolrResourceLoader     Can't find (or read)
>>> directory to add to classloader: ../../../dist/ (resolved as:
>>> /var/lib/solr/collection1/../../../dist).
>>>
>>> Unless I reboot tomcat, it never moves any further from this, and no
>>> more logging happens.
>>>
>>> Sorry if this isn't complete. It's from the interface. Not sure quite
>>> which logfile to look in.
>>>
>>> (4) When I set up the DataStore, I got the following error:
>>>
>>> AttributeError: 'NoneType' object has no attribute 'auth_audit_exempt'
>>>
>>> I'm guessing this one may be trivial but I included it in case I'm
>>> wrong, as I don't know whether or not it's relevant.
>>>
>>> (As far as I can see from the logs in /var/log/tomcat7, there seem to be
>>> no tomcat errors associated with Solr, although TBH it is hard to see
>>> through the confusing mess of errors due to an instance of Guacamole
>>> that I was previously running on tomcat! I have apparently killed it
>>> since I installed Solr - not sure how.)
>>>
>>> Are these details enough to be diagnostic? Thanks in advance for any
>>> time that you can give this.
>>>
>>> Best wishes,
>>>
>>>
>>> Talat
>>>
>>>
>>> --
>>> Dr Talat Chaudhri
>>> ------------------------------------------------------------
>>> Telephone: +44 (0)7759 944485
>>> E-mail: talat.chaudhri at gmail.com   Skype: talat.chaudhri
>>> ------------------------------------------------------------
>>>
>>>
>>> _______________________________________________
>>> ckan-dev mailing list
>>> ckan-dev at lists.okfn.org
>>> http://lists.okfn.org/mailman/listinfo/ckan-dev
>>> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> ckan-dev mailing list
>>> ckan-dev at lists.okfn.org
>>> http://lists.okfn.org/mailman/listinfo/ckan-dev
>>> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev
>>>
>>>
>>> --
>>> Dr Talat Chaudhri
>>> ------------------------------------------------------------
>>> Telephone: +44 (0)7759 944485
>>> E-mail: talat.chaudhri at gmail.com   Skype: talat.chaudhri
>>> ------------------------------------------------------------
>>>
>>>
>>>
>>> --
>>> Dr Talat Chaudhri
>>> ------------------------------------------------------------
>>> Telephone: +44 (0)7759 944485
>>> E-mail: talat.chaudhri at gmail.com   Skype: talat.chaudhri
>>> ------------------------------------------------------------
>>>
>>>
>>> _______________________________________________
>>> ckan-dev mailing list
>>> ckan-dev at lists.okfn.org
>>> http://lists.okfn.org/mailman/listinfo/ckan-dev
>>> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev
>>>
>> _______________________________________________
>> ckan-dev mailing list
>> ckan-dev at lists.okfn.org
>> http://lists.okfn.org/mailman/listinfo/ckan-dev
>> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev

-- 
Dr Talat Chaudhri
------------------------------------------------------------
Telephone: +44 (0)7759 944485
E-mail: talat.chaudhri at gmail.com   Skype: talat.chaudhri
Web site: http://talatchaudhri.info/
------------------------------------------------------------




-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 600 bytes
Desc: OpenPGP digital signature
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140327/b451d6b8/attachment-0002.sig>


More information about the ckan-dev mailing list