背景
個人用で, PC間のファイル共有っぽいのにnextCloudを使ってるんですが, ココ最近メンテをサボっていました.
naosuke2dx.hatenablog.com naosuke2dx.hatenablog.com
で, 久しぶりにWebでアクセスすることがあったので, アップデートボタンを深く考えずポチッと押したら画像のような状態になりました.
泣きながらトラシューしたのでメモ
構成
ConohaのVPSにnextCloud version 13を配置. Storageとして, ConohaのObject Storageをつなげて, 実ファイルデータはそっちに投げてる. (↓のような感じの設定をかいてます)
<?php $CONFIG = array ( 'objectstore' => array ( 'class' => 'OC\\Files\\ObjectStore\\Swift', 'arguments' => array ( 'serviceName' => 'Object Storage Service', 'url' => 'https://identity.tyo1.conoha.io/v2.0/tokens', 'region' => 'tyo1', 'tenantName' => 'XXX', 'username' => 'XXX', 'password' => 'XXX', 'bucket' => 'bucket-name, ), ), : );
起こったエラー
log/nextcloud.log
にはこんな感じでlogが書かれてました.
{"reqId":"XXX","level":3,"time":"2019-08-31T00:00:15+00:00","remoteAddr":"192.168.100.2","user":"--","app":"objectstore","method":"GET","url":"\/remote.php\/webdav\/","message":{"Exception":"RuntimeException","Message":"Endpoint URL could not be found in the catalog for this service.\nName: swift\nType: object-store\nRegion: tyo1\nURL type: publicURL","Code":0,"Trace":[{"file":"\/path\/to\/nextcloud\/3rdparty\/php-opencloud\/openstack\/src\/Identity\/v2\/Service.php","line":37,"function":"getServiceUrl","class":"OpenStack\\Identity\\v2\\Models\\Catalog","type":"->","args":["swift","object-store","tyo1","publicURL"]},{"file":"\/path\/to\/nextcloud\/lib\/private\/Files\/ObjectStore\/SwiftV2CachingAuthService.php","line":32,"function":"authenticate","class":"OpenStack\\Identity\\v2\\Service","type":"->","args":[{"autocreate":false,"urlType":"publicURL","catalogName":"swift","catalogType":"object-store","serviceName":"Object Storage Service","url":"https:\/\/identity.tyo1.conoha.io\/v2.0","region":"tyo1","tenantName":"XXX","username":"XXX","password":"XXX","bucket":"bucket-name","container":"XXX","cachedToken":null,"identityService":{"__class__":"OC\\Files\\ObjectStore\\SwiftV2CachingAuthService"},"authUrl":"https:\/\/identity.tyo1.conoha.io\/v2.0"}]}, 8X---(snip)---X8
Endpoint URL could not be found in the catalog for this service.
ふむ〜.
原因と解決方法
エラーログで調べてると, 下記のページを発見. qiita.com
要するに, Conohaはサービスとして swift
という名前ではなく, Object Storage Service
という名前で提供しているっぽく, そのままではサービスが見つからんと言うことらしい.
Qiitaの記事では, 与えるparamを増やしてたけど, phpわからんマンなので, lib/private/Files/ObjectStore/SwiftFactory.php
を雑に手組み修正.
private function createContainer() { $client = $this->getClient(); // ここを - $objectStoreService = $client->objectStoreV1(); // こうじゃ + $objectStoreService = $client->objectStoreV1($this->params);
で設定にこんな感じでKeyとValueを追加.
<?php $CONFIG = array ( 'objectstore' => array ( 'class' => 'OC\\Files\\ObjectStore\\Swift', 'arguments' => array ( 'serviceName' => 'Object Storage Service', + 'catalogName' => 'Object Storage Service', 'url' => 'https://identity.tyo1.conoha.io/v2.0/tokens', 'region' => 'tyo1', 'tenantName' => 'XXX', 'username' => 'XXX', 'password' => 'XXX', 'bucket' => 'bucket-name, ), ), 8X---(snip)---x8 );
これで無事に動きました. めでたしめでたし.
ただし, これをするとアップデートをするたびに手組の修正が必要になります. どうするのがいいのかなー.