Reputation: 1148
I set up the local file storage according to these steps
http://docs.ckan.org/en/latest/filestore.html
Create location
sudo mkdir -p /var/lib/ckan/default
I confirm the location exists and is in the right location
I uncomment the lines
ofs.impl = pairtree
ofs.storage_dir = /var/lib/ckan/default
I confirmed I have pairtree and argparse installed
I am using jetty as the web server not Apache so I do
sudo chown jetty /var/lib/ckan/default
sudo chmod u+rwx /var/lib/ckan/default
sudo service jetty restart
Then I run this command to start my site
paster serve /etc/ckan/default/development.ini
I then get this stack trace back, I am doing all of these commands inside my virtual environment
2013-12-04 17:39:46,369 WARNI [ckan.lib.uploader] Please use config option ckan.storage_path instaed of
ofs.storage_path
Traceback (most recent call last):
File "/usr/lib/ckan/default/bin/paster", line 9, in <module>
load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')()
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 104, in run
invoke(command, command_name, options, args[1:])
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 143, in invoke
exit_code = runner.run(args)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 238, in run
result = self.command()
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/serve.py", line 284, in command
relative_to=base, global_conf=vars)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/serve.py", line 321, in loadapp
**kw)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
return loadobj(APP, uri, name=name, **kw)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
return context.create()
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 710, in create
return self.object_type.invoke(self)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
return fix_call(context.object, context.global_conf, **context.local_conf)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/util.py", line 56, in fix_call
val = callable(*args, **kw)
File "/usr/lib/ckan/default/src/ckan/ckan/config/middleware.py", line 156, in make_app
os.makedirs(path)
File "/usr/lib/ckan/default/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/var/lib/ckan/default/storage'
Upvotes: 6
Views: 2908
Reputation: 311
Sample 500 error in ckan 2.9
File "/usr/lib/python3.8/os.py", line 223, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/var/lib/ckan/default/webassets/.webassets-cache'
To remove the permission error;
Set the permission and ownership. The docs on filestore misses out on the ownership and recursive mode
sudo chown www-data:www-data -R /var/lib/ckan/default
sudo chmod u+rwx -R /var/lib/ckan/default
Finally restart your server:
sudo supervisorctl restart ckan-uwsgi:*
Upvotes: 0
Reputation: 1312
For those stumbling on this years later...
I ran into this when trying to setup datastore and run the paster --plugin=ckan datastore set-permissions -c /etc/ckan/default/production.ini
command.
I had already setup FileStore as per the docs. What I ended up having to do was upload a resource in the web UI then re-run the command above and the error no longer appeared and the output worked as expected. After uploading a resource the /var/lib/ckan/default/resources
and /var/lib/ckan/default/storage
directories were created with the proper permissions and the paster command didn't need to try and create them (or so I'm assuming).
Here's some additional resources in case you have a slightly different issue that's causing this error:
Upvotes: 0
Reputation: 14640
Permission denied: '/var/lib/ckan/default/storage'
It looks like you don't have permission to read and write to this directory. Try running these commands in a terminal:
sudo chown -R `whoami` /var/lib/ckan/default
sudo chmod -R u+rwx /var/lib/ckan/default
Upvotes: 11