Skip to content

Instantly share code, notes, and snippets.

@lo48576
Last active December 15, 2018 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lo48576/70525e2cd48a191ce4fa270ed4ad694f to your computer and use it in GitHub Desktop.
Save lo48576/70525e2cd48a191ce4fa270ed4ad694f to your computer and use it in GitHub Desktop.
A patch to use ConoHa object storage from Nextcloud 14.0.0

Nextcloud 14.0.0 で ConoHa のオブジェクトストレージを使うためのパッチと設定サンプル。 無保証

config.php.sample は、プライマリの記憶域をオブジェクトストレージとして使う設定のサンプルである。 単なる外部ストレージとして web UI から ConoHa のオブジェクトストレージを設定できるかは、知らないし試してもいない。

<?php
$CONFIG = array (
// Your configs here
'objectstore' =>
array (
'class' => 'OC\\Files\\ObjectStore\\Swift',
'arguments' =>
array (
'serviceName' => 'Object Storage Service',
'url' => 'https://identity.tyo1.conoha.io/v2.0',
'region' => 'tyo1',
'tenantName' => 'gnct********',
'username' => 'gncu********',
'password' => '********',
'bucket' => 'nextcloud',
// `catalogName` is used by the code patched with `support-conoha-object-storage.patch`.
// For detail, see <https://qiita.com/yuuAn/items/35c55109d800640470e6>.
'catalogName' => 'Object Storage Service',
),
),
FROM nextcloud:14.0.0-apache
COPY support-conoha-object-storage.patch /support-conoha-object-storage.patch
RUN cd /usr/src/nextcloud && patch -p1 --force </support-conoha-object-storage.patch
diff --git a/lib/private/Files/ObjectStore/SwiftFactory.php b/lib/private/Files/ObjectStore/SwiftFactory.php
index 3ff534b4e647..23c2284d3a3a 100644
--- a/lib/private/Files/ObjectStore/SwiftFactory.php
+++ b/lib/private/Files/ObjectStore/SwiftFactory.php
@@ -187,7 +187,9 @@ class SwiftFactory {
*/
private function createContainer() {
$client = $this->getClient();
- $objectStoreService = $client->objectStoreV1();
+ // To use ConoHa object storage, `catalogName` should be customizable by the admin.
+ // See <https://qiita.com/yuuAn/items/35c55109d800640470e6> for detail.
+ $objectStoreService = $client->objectStoreV1($this->params);
$autoCreate = isset($this->params['autocreate']) && $this->params['autocreate'] === true;
try {
@lo48576
Copy link
Author

lo48576 commented Sep 9, 2018

いけたと思ったが、これでもまだ不完全らしく、十分に動いてくれない……

@lo48576
Copy link
Author

lo48576 commented Dec 15, 2018

@lo48576
Copy link
Author

lo48576 commented Dec 15, 2018

Nextcloud 15 で試したが、 external files の web UI からでは (やはり) ConoHa の object storage は使えなかった。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment