[Patch] Using another S3 provider

Ask all your questions regarding OC 5.x Please read the Support Forum Rules
Forum rules
ownCloud 5.x reached end of life and is officially unsupported. For details see Wiki page.

Please upgrade your ownCloud.
Denis_
Newbie
Posts: 1
Joined: Mon Sep 10, 2012 3:59 pm

[Patch] Using another S3 provider

Postby Denis_ » Mon Sep 10, 2012 4:44 pm

Hello all,

I'm playing with Ceph RADOSGW (http://ceph.com/ceph-storage/object-storage/) and I made a patch to allow ownCloud to connect to that storage :

Code: Select all

diff -ru /root/owncloud/apps/files_external/lib/amazons3.php /var/www/owncloud/apps/files_external/lib/amazons3.php
--- /root/owncloud/apps/files_external/lib/amazons3.php 2012-09-10 15:33:57.000000000 +0200
+++ /var/www/owncloud/apps/files_external/lib/amazons3.php      2012-09-10 16:28:42.000000000 +0200
@@ -34,6 +34,15 @@

        public function __construct($params) {
                $this->s3 = new AmazonS3(array('key' => $params['key'], 'secret' => $params['secret']));
+               if ($params['server']) {
+                       $this->s3->set_vhost($params['server']);
+                       $this->s3->allow_hostname_override(false);
+                       $this->s3->enable_path_style();
+               }
+               if ($params['secure']) {
+                       $this->s3->disable_ssl(true);
+
+               }
                $this->bucket = $params['bucket'];
        }

@@ -233,4 +242,4 @@

 }
diff -ru /root/owncloud/apps/files_external/lib/config.php /var/www/owncloud/apps/files_external/lib/config.php
--- /root/owncloud/apps/files_external/lib/config.php   2012-09-10 15:33:57.000000000 +0200
+++ /var/www/owncloud/apps/files_external/lib/config.php        2012-09-10 16:09:13.000000000 +0200
@@ -40,7 +40,7 @@
        public static function getBackends() {
                return array(
                        'OC_Filestorage_Local' => array('backend' => 'Local', 'configuration' => array('datadir' => 'Location')),
-                       'OC_Filestorage_AmazonS3' => array('backend' => 'Amazon S3', 'configuration' => array('key' => 'Key', 'secret' => '*Secret', 'bucket'
 => 'Bucket')),
+                       'OC_Filestorage_AmazonS3' => array('backend' => 'Amazon S3', 'configuration' => array('server' => '&Server', 'key' => 'Key', 'secret'
 => '*Secret', 'bucket' => 'Bucket', 'secure' => '!Secure')),
                        'OC_Filestorage_Dropbox' => array('backend' => 'Dropbox', 'configuration' => array('configured' => '#configured','app_key' => 'App ke
y', 'app_secret' => 'App secret', 'token' => '#token', 'token_secret' => '#token_secret'), 'custom' => 'dropbox'),
                        'OC_Filestorage_FTP' => array('backend' => 'FTP', 'configuration' => array('host' => 'URL', 'user' => 'Username', 'password' => '*Pas
sword', 'root' => '&Root', 'secure' => '!Secure ftps://')),
                        'OC_Filestorage_Google' => array('backend' => 'Google Drive', 'configuration' => array('configured' => '#configured', 'token' => '#to
ken', 'token_secret' => '#token secret'), 'custom' => 'google'),
@@ -280,4 +280,4 @@

 }


The only problem comes from the AWS-SDK. I need to update constants with the name of my server :

Code: Select all

diff -ru /root/owncloud/3rdparty/aws-sdk/services/s3.class.php /var/www/owncloud/3rdparty/aws-sdk/services/s3.class.php
--- /root/owncloud/3rdparty/aws-sdk/services/s3.class.php       2012-09-10 15:33:57.000000000 +0200
+++ /var/www/owncloud/3rdparty/aws-sdk/services/s3.class.php    2012-09-10 16:26:46.000000000 +0200
@@ -63,7 +63,8 @@
        /**
         * Specify the queue URL for the US-Standard (Northern Virginia & Washington State) Region.
         */
-       const REGION_US_E1 = 's3.amazonaws.com';
+       //const REGION_US_E1 = 's3.amazonaws.com';
+       const REGION_US_E1 = 'mygw.myceph.tld';

        /**
         * Specify the queue URL for the US-Standard (Northern Virginia & Washington State) Region.


Regards,
Denis

michalefty
Newbie
Posts: 1
Joined: Wed Mar 13, 2013 7:39 am
ownCloud version: 4.5.7
Webserver: Apache
Database: SQLite
OS: Linux
PHP version: 5.3

Re: [Patch] Using another S3 provider

Postby michalefty » Wed Mar 13, 2013 8:00 am

Hi Denis,

hopfully you or anybody else can help me.
I'm new to owncloud and want to use external storage [RADOSGW / CEPH/ S3] to provide storage to my owncloud. I have used your patch to connect to my ceph-cluster. But the result is kind of strange:
1. I can upload files to owncloud. They appear in UI [Web] but if I reload they disappear.
2. On radosgw I get an Error 404 [File not found] if OC try to load the HEAD of the object - this is not strange because there is no object inside ceph.
3. What I can do is to create a new folder. These objects appear inside the ceph-cluster.
4. It is possible to create objects [with same user] inside radosgw by using external commands and they appear in OC-UI.

I tried both OC 5.0 beta2 and 4.5.7.
Ceph [RADOS-GW] version is 0.56.
Ubuntu 12.04. [standard packages]

If you need anyother info you shoot on me.

Thanks

Michael

alvarex
Newbie
Posts: 7
Joined: Fri Aug 09, 2013 10:11 am

Re: [Patch] Using another S3 provider

Postby alvarex » Thu Oct 03, 2013 4:43 pm

Hi Denis,

i've tried your manuel, but i'm getting a white page after i changed the files :(. The amazons3.php looks a little bit different in owncloud 5.0.11 than in your description. I think, there must be the something wrong and i'm not able to change it in the right way.

I've changed the php files into txt files, so you can maybe see whats wrong in my config

https://ssl.webpack.de/alvarex.de/owncl ... azons3.txt
https://ssl.webpack.de/alvarex.de/owncl ... config.txt
https://ssl.webpack.de/alvarex.de/owncl ... .class.txt

The logfile of owncloud says nothing about an error or anything like that. Just an empty page. The address of my bucket ist ownc.cs.hosteurope.de. I've installed owncloud via Webinstaller on an Webspace L Paket on a HostEurope Server and i use MySQL.

Thanks

alvarex


  • Similar Topics
    Replies
    Views
    Last post

Return to “ownCloud Community Edition 5.x and older”

Who is online

Users browsing this forum: Google [Bot] and 0 guests