[recoll-user] Re: Getting recoll working via python module behind apache

  • From: Ciaran Farrell <ciaran@xxxxxxxxxx>
  • To: recoll-user@xxxxxxxxxxxxx
  • Date: Wed, 23 Apr 2014 16:22:55 +0200

On Wed, 23 Apr 2014 16:02:49 +0200
Jean-Francois Dockes <jfd@xxxxxxxxxx> wrote:

> Ciaran Farrell writes:
>  > Hi again,
>  > 
>  > I have recoll working fine when called from a web.py script (i.e.
>  > local user starts script which uses ~/.recoll.conf from local
>  > user's home directory).
>  > 
>  > I now want my web.py script working as wsgi behind apache. I have
>  > this working. However, when my server script tries to connect to
>  > recoll (recoll.connect(confdir='/home/localuser/.recoll/')) I get:
>  > 
>  > EnvironmentError: Configuration could not be built:, referer:
>  > https://myscript.com/mypage.html
>  > Explicitly specified configuration directory must exist (won't be
>  > automatically created). Use mkdir first, referer:
>  > https://myscript.com/mypage.html
>  > 
>  > I also tried copying the entire .recoll folder to /tmp and
>  > chmodding it to 777 to make sure it wasn't (obviously) a
>  > permissions problem. Still doesn't work. The apache user is wwwrun
>  > (no login according to /etc/passwd).
>  > 
>  > Given that I can't create a .recoll directory in wwwrun's home (as
>  > there isn't any), what could I do to get it working?
>  > 
>  > Ciaran
> 
> I am really not sure of what is happening here. As a test, I'd first
> try to access a file inside the /home/localuser/.recoll directory
> from the python program (independantly of recoll), to check that this
> is really Recoll having trouble. 

From the python console it seems to work. That is python running as
user cfarrell though. The python web.py script is located in my home
directory too. If I run it locally (python mywebpyscript.py) it starts
a webserver on port 8080. I make ajax queries back to that script.
Those queries are turned into recoll queries. This works perfectly.

However, instead of having the python script running as a local user on
port 8080 I want to have it running on port 80. Typically, using wsgi
(apache's mod_wsgi) you can write a vhost config to have apache pass
requests coming in on port 80 to the web.py script in the home
directory. However, the user for apache is wwwrun with group www (on
suse). I assume that it looks for recoll in /home/wwwrun/.recoll and
doens't find it (as wwwrun has no login shell). That's why I put the
recoll config directory in /tmp instead and called it with
recoll.connect(confdir='/tmp/.recoll').

Incidentally, when I use recoll.connect(confdir='/tmp') the error
message is different: 'failed to open index' than when I use
recoll.connect(confdir='/tmp/.recoll'). There, the error is something
like the directory doesn't exist (it does). Use mkdir before connecting.

Where exactly is the index that recoll wants to open? Is it the
xapiandb/ directory inside .recoll? What permissions is it expecting on
the relevant files?

>>> fd = open('/home/cfarrell/.recoll/recoll.conf','r')
>>> x = fd.read()
>>> x
>>>'# The system-wide configuration files for recoll are located
>>>in:\n#   /usr/share/recoll/examples\n# The default configuration
>>>files
>>>are commented, you should take a look\n# at them for an explanation
>>>of
>>>what can be set (you could also take a look\n# at the manual
>>>instead).\n# Values set in this file will override the system-wide
>>>values for the file\n# with the same name in the central directory.
>>>The
>>>syntax for setting\n# values is identical.\n\ntopdirs
>>>= /home/cfarrell/comema/processed\nidxflushmb = 50\nloglevel =
>>>1\nindexedmimetypes = application/pdf  \nidxmetastoredlen = 1500 #
>>>see
>>>http://is.gd/lxxu2P\n'
>>> fd.close()
>>>

 
> 
> I don't know much either about running Apache. Is there any chance
> that httpd might run chroot'ed ?

Not in this case...

Ciaran



-- 

Attachment: signature.asc
Description: PGP signature

Other related posts: