This module provides access to HPCloud's service architecture. The following services are supported by this module:
- Identity Services: Authentication, authorization, and access to the service catalog.
- Object Storage (Swift): Access to containers, objects, and all related services.
- CDN (SOS): Edge-side caching of objects from Object Storage.
Note that you will have to have a valid HPCloud account and have subscribed to these services.
Storing Files on the HPCloud
Object Storage (Swift, in its OpenStack parlance) provides a cloud-based mechanism for storing objects.
This module provides the capability not only to access remote object storage, but to use object storage as the primary location for public and private files. (Public files are stored in a public container, private files are stored in a private container).
- Download the module, uncompress it, and place it in the module directory.
- Inside of the module's directory, use Composer to install the HPCloud library.
- From within Drupal, install the module.
Example from the CLI with Drush:
$ drush dl hpcloud $ cd sites/all/modules/hpcloud $ php path/to/composer.phar install $ drush en hpcloud
There are several other ways to install the HPCloud-PHP bindings, and you may prefer one of those to Composer. That is fine. The module attempts to facilitate PEAR, hand-installs, and Library API (Though we don't recommend Library API, as it does not ensure version consistency, nor is it known to work reliably with autoloaders.)
Direct Downloads To Module Folder
You can download the PHP library from https://github.com/hpcloud/HPCloud-PHP
When directly downloaded to the module folder the path structure would look like:
hpcloud/ hpcloud/hpcloud.module hpcloud/HPCloud-PHP/src/HPCloud/Bootstrap.php
Usage with Libraries Module
When used as part of the libraries module the HPCloud-PHP library should be
loaded to the location /path/to/libraries/HPCloud-PHP. Inside this directory
should be the src directory.
Usage with the Composer Module
The Drupal composer module enables the use of composer with Drupal. This module
is not required for Drupal support of composer. For the 3rd step from above you
can substitute p'hp path/to/composer.phar install' with 'drush componser install'
if you are using the composer module.
Backup and Migrate
Support to backup your sites database and filesystem are included through integration with the Backup and Migrate module and the Backup and Migrate Files module. For more information see the documentation.
The rule of thumb for this module is: *read is fast, write is slow.*
The module is designed to accomplish two things (performance-wise):
- Keep a consistent copy of files that can be shared across multiple servers in a cluster.
- Deliver files as fast as possible for read requests.
In particular, it is designed with page caching in mind, so that page cached assets will be served efficiently.
The reasons for the read fast/write slow mantra are simple:
- Reading files is accelerated by HPCloud's object storage and CDN services.
- Writing is complicated by Drupal's elaborate process of checking the file, and it's bias toward local file systems. Writing a thumbnail image may result in 10 or more HTTP requests to HPCloud.
That said, when logged in as an administrator, sometimes reading files
will be slow simply because there are some additional tasks going on.
Q: Why do you require PHP 5.3.x or greater?
A: Two reasons: (1) HPCloud-PHP requires it, and (2) it is the current stable release of PHP. 5.2 is unmaintained, and the developers of this project do not use it.
PHP 5.4 should work.
Q: Can HPCloud be used for public:// and private:// storage?
A: Yes. It has been tested with both.
Q: Does HPCloud provide a stream wrapper for direct use?
A: Yes, two wrappers.
One is a Drupal wrapper: `hpcloud://path/to/file`. This requires you to associated the `hpcloud` handler with a container on the remote server.
The lower level `swift://CONTAINER/OBJECT` structure is also supported, but it does not interface with Drupal's stream wrapper library.
Q: Why do you implement a different stream wrapper than in HPCloud-PHP?
A: HPCloud-PHP comes with a complete stream wrapper implementation that supports operations like file_get_contents('swift://foo/bar.gif').
Unfortunately, Drupal's stream wrapper implementation is incompatible with standard PHP stream wrappers. It requires that a stream wrapper have extra methods, and it utterly fails to support context objects.
For that reason we had to write a completely new stream wrapper to provide Drupal support.
Q: Can we use swift:// URLs?
A: Yes. The swift:// stream wrappers are loaded, too, and you can use them to your heart's content. Just don't use Drupal's file IO functions to access them.
Q: Can we use the HPCloud-PHP OO API directly?
Two patches are provided with this module to operate with Backup and Migrate.
- #1452462: To Use the native PHP funtions for decompression and provide to fail cleanly for the case where these functions are not available. This has been comitted to the Backup and Migrate project and should be avaiable in the next release. At that time we will no longer ship with a patch.
- #1450966: There is a case where Backup and Migrate Files attempts to generate a system path. A system path won't exist for a remote file system. This patch uses stream wrappers to generate this path.
- Maintenance status: Actively maintained
- Development status: Under active development
- Module categories: File Management, Media, Third-party Integration, Utility
- Reported installs: 1 site currently reports using this module. View usage statistics.
- Downloads: 2,313
- Last modified: 27 November 2014
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.