Giter Club home page Giter Club logo

ckanext-cloudstorage's Introduction

ckanext-cloudstorage

Implements support for using S3, Azure, or any of 15 different storage providers supported by libcloud to CKAN.

Setup

After installing ckanext-cloudstorage, add it to your list of plugins in your .ini:

ckan.plugins = stats cloudstorage

If you haven't already, setup CKAN file storage or the file upload button will not appear.

Every driver takes two options, regardless of which one you use. Both the name of the driver and the name of the container/bucket are case-sensitive:

ckanext.cloudstorage.driver = AZURE_BLOBS
ckanext.cloudstorage.container_name = demo

You can find a list of driver names here (see the Provider Constant column.)

Each driver takes its own setup options. See the libcloud documentation. These options are passed in using driver_options, which is a Python dict. For most drivers, this is all you need:

ckanext.cloudstorage.driver_options = {"key": "<your public key>", "secret": "<your secret key>"}

Support

Most libcloud-based providers should work out of the box, but only those listed below have been tested:

Provider Uploads Downloads Secure URLs (private resources)
Azure YES YES YES (if azure-storage is installed)
AWS S3 YES YES YES (if boto is installed and host key added to driver_options)
Rackspace YES YES No

What are "Secure URLs"?

"Secure URLs" are a method of preventing access to private resources. By default, anyone that figures out the URL to your resource on your storage provider can download it. Secure URLs allow you to disable public access and instead let ckanext-cloudstorage generate temporary, one-use URLs to download the resource. This means that the normal CKAN-provided access restrictions can apply to resources with no further effort on your part, but still get all the benefits of your CDN/blob storage.

ckanext.cloudstorage.use_secure_urls = 1

This option also enables multipart uploads, but you need to create database tables first. Run next command from extension folder:

ckan db upgrade -p cloudstorage

With that feature you can use cloudstorage_clean_multipart action, which is available only for sysadmins. After executing, all unfinished multipart uploads, older than 7 days, will be aborted. You can configure this lifetime, example:

 ckanext.cloudstorage.max_multipart_lifetime  = 7

One-time URLs generated by CKAN are expired in an hour. This behaviour can be changed by setting expected lifetime(in seconds) as ckanext.cloudstorage.secure_ttl option:

# make one-time links valid only for 1 minute
ckanext.cloudstorage.secure_ttl = 60

Migrating From FileStorage

If you already have resources that have been uploaded and saved using CKAN's built-in FileStorage, cloudstorage provides an easy migration command. Simply setup cloudstorage as explained above, enable the plugin, and run the migrate command. Provide the path to your resources on-disk (the ckan.storage_path setting in your CKAN .ini + /resources), and cloudstorage will take care of the rest. Ex:

paster cloudstorage migrate <path to files> -c ../ckan/development.ini

Notes

  1. You should disable public listing on the cloud service provider you're using, if supported.
  2. Currently, only resources are supported. This means that things like group and organization images still use CKAN's local file storage.

FAQ

  • DataViews aren't showing my data! - did you setup CORS rules properly on your hosting service? ckanext-cloudstorage can try to fix them for you automatically, run:

      paster cloudstorage fix-cors <list of your domains> -c=<CKAN config>
    
  • Help! I can't seem to get it working! - send me a mail! [email protected]

ckanext-cloudstorage's People

Contributors

smotornyuk avatar tktech avatar espona avatar zharktas avatar fanjinfei avatar iaroslav13 avatar jeverling avatar ostyhar avatar chris48s avatar mutantsan avatar xx70235 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.