datagovuk / dgu-vagrant-puppet

[unmaintained] Container environment for booting fresh DGU virtual machines. Create VMs with Vagrant, configure them with Puppet.
37 stars 29 forks source link

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

Closed CarlQLange closed 9 years ago

CarlQLange commented 9 years ago

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.

davidread commented 9 years ago

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

davidread commented 9 years ago

Ah, is this the same as this: https://github.com/datagovuk/dgu-vagrant-puppet/issues/51 ?

CarlQLange commented 9 years ago

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.

CarlQLange commented 9 years ago

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

davidread commented 9 years ago

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

CarlQLange commented 9 years ago

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.

CarlQLange commented 9 years ago

Yep, your fix at https://github.com/datagovuk/dgu-vagrant-puppet/commit/5667b6f502f1cd7b62ecacd7dc1f36847f091eaa solved the issue. Thanks a lot!!

davidread commented 9 years ago

Great, cheers for helping out with all this @CarlQLange

CarlQLange commented 9 years ago

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