datagovuk/dgu-vagrant-puppet

togo branch: Had to allow apache to access wsgi_app.py and friends

CarlQLange opened this issue · 9 comments

On the togo branch: Had to do

sudo su co
chown -R www-data:www-data ./ckan

to stop apache getting permissions errors trying to execute wsgi_app.py and company. I'm sure there's a better way to do that.

Apache just needs read access to /var/ckan/wsgi_app.py (as mentioned in the issue title) so I think that shouldn't be an issue. I think in your command you are refering to /src/ckan/ckan which mod_wsgi will just need read permission to.

Perhaps you could provide more details:

  1. whether you are using vagrant or a fresh box
  2. full error message you saw
  3. before and after ownership and permissions
  4. full path to the files you changed

cheers

Ah, is this the same as this: #51 ?

It looks broadly similar to #51, though the exact logs I had were different - I suspect the issue could be fixed the same way.

whether you are using vagrant or a fresh box

Vagrant, precise64.

full error message you saw

This was the second coming of this issue - I fixed the permission on wsgi_app.py but still had to do so on activate_this.py. Unfortunately no longer have the log of the initial error - similar to this though.

[Wed Jan 07 10:39:08 2015] [error] [client 192.168.11.1] mod_wsgi (pid=6207): Target WSGI script '/var/ckan/wsgi_app.py' cannot be loaded as Python module.
[Wed Jan 07 10:39:08 2015] [error] [client 192.168.11.1] mod_wsgi (pid=6207): Exception occurred processing WSGI script '/var/ckan/wsgi_app.py'.
[Wed Jan 07 10:39:08 2015] [error] [client 192.168.11.1] Traceback (most recent call last):
[Wed Jan 07 10:39:08 2015] [error] [client 192.168.11.1]   File "/var/ckan/wsgi_app.py", line 5, in <module>
[Wed Jan 07 10:39:08 2015] [error] [client 192.168.11.1]     execfile(activate_this, dict(__file__=activate_this))
[Wed Jan 07 10:39:08 2015] [error] [client 192.168.11.1] IOError: [Errno 13] Permission denied: '/home/co/ckan/bin/activate_this.py'

before and after ownership and permissions

Unfortunately I can't remember the before, wsgi_app.py may have been root:root or co:co. After was www-data:www-data.

full path to the files you changed

/var/ckan/wsgi_app.py and home/co/ckan/ with chown -R, the latter for the 'activate_this.py' error seen above and to prevent any more.

Just went through this again, here's the exact steps I followed:

screen shot 2015-01-27 at 11 53 53

and

screen shot 2015-01-27 at 11 59 19

I think the fix I did today for #51 would do it?

I think you're probably right. I'll have a look to confirm in the next few days but I had a very similar fix (which was broken for unrelated reasons).
I felt that I also had to chown /var/ckan/wsgi_app.py but I might well be wrong.

Yep, your fix at 5667b6f solved the issue. Thanks a lot!!

Great, cheers for helping out with all this @CarlQLange

Well, thank you for open-sourcing such useful stuff!