Not sure this is an bug or mistake of me so first put it in the category "support request"

I have a question about an error I get while downloading files that are stored in my Rackspace cloud storage container.

My Drupal 7 installation is installed on my own domain. I use the module cloud_files 7.x-1.0 version. The module Libraries does have version 7.x-2.0-alpha2+1-dev installed. The github files are also installed. I think correctly because uploading files to my Rackspace Cloud via a created content type (containing file) seems to be succesfull. The API key is installed in the configuration settings of the Cloud module and I've setup the container of my Rackspace.

The theme enabled is the default Bartik 7.12.
For info: do not know what Panels are, so I think I don't use those.

I tried it with both a *jpg file and a simple *txt file both showing the same issue.

For uploading the file I created a simple content type named "file". This content type exists out of

  • a title
  • simple body
  • a file (with field and widget of type "file").
  • Upload destination is set at "Rackspace Cloud Files"
  • Number of values: 1
  • "Enable Display field" is disabled
  • "Files displayed by default" is disabled

Uploading files is as mentioned successful as I can also see the files appearing in the Rackspace container.

I used Views (to experiment) but accessing the created content (of type file) is just content that I put on the homepage. I have to click "Read more" to open to read the (full) body of the content and to be able to click on the file that is attached to the content.

Now what is going wrong: In my Drupal environment, when I click on the file (that is actually stored in Rackspace) in order to download it, it will bring me to my homepage. (hovering over it shows the URL of my homepage in stead of the link to the node or file).

I tried to see what happened after I uploaded a file to the local filesystem (temporary set "Upload destination to: Public files) it showed me the complete path (and not just www."mydomain".com when uploaded to my Rackspace account) and when clicking on it, it showed me the file.

I switched on the debug option in the Cloud module but the only thing that shows up in the log messages is:

cloud_files 04/16/2012 - 01:15 requesting container from Rackspace (Drupal test)
cloud_files 04/16/2012 - 01:15 loading cached credentials
cloud_files 04/16/2012 - 01:15 executing getExternalUrl (rcf://geit2.jpg)

I don't really have an idea why this is not working. I assume that the cloud module will keep some administration about where the file is put in the cloud storage instead on the local file system?

When I delete the content (containing the file) the file is removed also from my Rackspace environment, giving me the idea that there is indeed some administration.

If you have ideas why this is not working, I love to hear them...

CommentFileSizeAuthor
#2 Hosting-CloudFiles.png88.63 KBquinns

Comments

quinns’s picture

I'm getting the same behavior. Everything seems fine but the once I try to access the uploaded file I'm just taken back to my site's base URL.

quinns’s picture

StatusFileSize
new88.63 KB

I figured it out. You have to make the Cloud Container "public" so it has a URL the website can access. In your Rackspace control panel, navigate to the Cloud Files container and click on it. At the bottom there's a frame with some options, be sure to enable the "Publish to CDN" checkbox. See screenshot.

quinns’s picture

Status: Active » Closed (works as designed)
herbiek’s picture

Status: Closed (works as designed) » Active

Thanks Quinns for helping me out with this and your quick reply. This option did the trick and I'm now able to access the files stored in my Rackspace account.

However the reason why I put it not to public was that the major part of the content on my website is roll depending(you have to login before you can access it). Putting the data to public made it accessible for everyone, even people not visiting my website at all.

I also find it not very professional that my website users would be taken to another domain, some kind of internal conversion table that let the user think they are still at my domain would look nicer. I'll make it a feature request.

quinns’s picture

Status: Active » Closed (works as designed)

Herbiek, I also had these issues and solved them.

First, if you need to use private files (in our case, Ubercart downloads), you will need to mount your Cloud Files to your Cloud Server (I'm assuming you are using a Cloud Server to run your Drupal app).

The problem is that by default Cloud Server and Cloud Files are not integrated and you can't just mount it as if it were an extra drive. I called Rackspace support and they told me they can do this using a service called "CloudFuse". I recommend you call them and ask about that. What happens is, they mount your entire Cloud Files account to your server in a specific location, and then I just had to go in to the site and create file aliases (symlinks) as needed, so the Drupal site could read and write to and from the Cloud Files containers.

I don't know why this CloudFuse option isn't featured prominently on the RS site, maybe they are still rolling it out and you have to ask for it.

As for the external domain (CDN), I agree the 12345.rackcdn.com or whatever is pretty ugly. What you want to do is go to your site's DNS configuration and set up a CNAME entry mapping that to "cdn.yoursite.com" or whatever.

Documentation on that is here: http://www.rackspace.com/knowledge_center/node/1792

herbiek’s picture

I'm assuming you are using a Cloud Server to run your Drupal app

Hi Quinns, my drupal installation is not installed on a Cloud Server but on my own domain. Is this work around not possible if Drupal is not installed on a Cloud server?
Can CloudFuse be used if Drupal is running on my own server?

quinns’s picture

Herbiek, I don't know. You might ask RS if they can give you some assistance getting that to work. CloudFuse is an open source project so it should be possible to use it anywhere.

CloudFuse source code: https://github.com/redbo/cloudfuse

I found this technical document that may be helpful:

http://www.rackspace.com/knowledge_center/node/1873

If you get it working please post a follow-up here with your findings. Good luck!

herbiek’s picture

As for the external domain (CDN), I agree the 12345.rackcdn.com or whatever is pretty ugly. What you want to do is go to your site's DNS configuration and set up a CNAME entry mapping that to "cdn.yoursite.com" or whatever.

I was able to make a DNS forward so that now "files.mysite.com" points to my Rackspace cloud files storage. So i'm able to access a picture in my Rackspace account by entering files.mysite.com/picture.jpg

But how do I prevent that hovering over a download link in my site still the direct URL to my Rackspace cloud storage is shown?

mr.moses’s picture

If you get the latest dev version of this module, there is an option to enter your CNAME on the configuration page.

#1416284: Override default url with CNAME

herbiek’s picture

Great! that worked for me, clean URL without reference to Rackspace container. Now the only thing I have so invest is the possibility to switch off "Publish to CDN". I will ask some support for CloudFuse. I'm not a programmer, so will see how far I will come with this.

herbiek’s picture

I have had a chat with Rackspace support about my wish to have non public files stored on Rackspace and accessed via Drupal
Below you see the (partly edited) transcript of that chat:

Herbiek: I have a question about accessing rackspace files via drupal.. I had some support before.. and finally (via the Drupal community) I was able to acces Rackspace files files via my drupal installation
Herbiek: however I had to switch off.."Publish to CDN"
Herbiek: But that means that everyone can access my files.. I like to control this myself through my Drupal installation.. My question: is it possible to access files externally while Publish to CDN is switched off?
Herbiek: (through the API key ?)
Jason H: The only way is to use Cyberduck, it uses for username and API to access file. It can push/download files from cloudfiles http://cyberduck.ch/. It has the ability to connect to cloudfiles
Herbiek: I think I cannot combine a standalone program like Cyberduck with Drupal CMS
Jason H: I understand, its just another way to access the cloudfiles without publishing to the CDN
Jason H: You can also use the API
Herbiek: From the developer of the module that made it possible to access files on Drupal, i read about CloudFuse...
Jason H: You can make API calls to the cloudfiles environment which uses the API key in this case
Herbiek: is Cyberduck maybe using Cloudfuse?
Jason H: Yes that too. that can mount cloudfiles to the server
Herbiek: I already use the API key to acces the files
Herbiek: but with the API key I cant access files that are Not public
Jason H: Cyberduck is not using cloudfuse, they are 2 separate programs,
Herbiek: Still I don't really understand how Cyberduck can help me accessing files through Drupal?
Jason H: I'm sorry, Cyberduck is just for regular access to cloudfiles. Cloudfuse would probably be the only one that could intergrate with Drupal since it mounts to the cloudserver itself.
Herbiek: Is there a reason why it is possible to access public files but not files that are not public? is it a technical limitation or choice for rackspace?
Herbiek: if Cyberduck is able to do that.. why not another third party program?
Jason H: Cyberduck is third party, that is not our product. It has the ability to access the files with the account log on credentials by doing http calls. In regards to the first question, the file cannot be access publicly, the CDN is the only way you can access files externally, that is the URL the CDN generates when the file it pushed to the CDN edge node.
Herbiek: Ok so if I understand you correctly.. if I use the API key it will not be possible to access non public files.
Herbiek: that is only possible by using http calls (kind of faking a normal user) or by using CloudFuse.
Jason H: No with the API key, it will allow you to access all your files on the Cloudfiles account. What i mean by public, is how the CDN works and it give all files a URL, which it isn't really public unless you have the CDN URL of the file.
Herbiek: ok.. understand that.. but if you have the CDN URL and I have some documentation that I would like to share with others.. I can't prevent that they forward the URL.. and therefore possible get my documents in the wrong hands..
Herbiek: I think I have to look in to CloudFuse.. ..
Jason H: Cloudfuse will mount cloudfiles to the server itself and should be only seen by the server itself. Whoever has access to the server and Cloudfuse is initialized, would be the only ones that can see the files. Cloudfuse is not our product nor do we support it.
Cloudfuse is not our product nor do we support it.
Herbiek: I hoped that you could say that you know that it is likely possible to access non public files by using Cloudfuse
Jason H: With Cloudfuse you should be able to access all files within Cloudfiles

Conclusion, I'm not a programmer, but if I understood correctly, Cyberduck itself is not usable, but maybe the technique it uses to access file is? Can anybody explain in simple words to me?
My Drupal site is not running on a Rackspace server but on my own domain..

mr.moses’s picture

It seems like you should be able to use CloudFuse to have your server mount your Rackspace Cloud Files container (even if its not a Cloud Server). Then you can just set your Drupal Private file system path to where you have Rackspace Cloud Files mounted.

The Cloud Files module would not be necessary.

quinns’s picture

We've used CloudFuse for this purpose and it works. It can be really slow, though.