Integrate Owncloud or Seafile?



  • Is there a howto to integrate Kolab File Backend with Owncloud or Seafile?
    Is it even possible?



  • Yes, it is. You can find a guide in the docs.



  • Notice that guide was written with Kolab 3.4 in mind (I'm the original author), and I'm not sure how it applies to 16 and Manticore (I haven't upgraded yet).


  • Global Moderator

    @einar said:

    Notice that guide was written with Kolab 3.4 in mind (I'm the original author), and I'm not sure how it applies to 16 and Manticore (I haven't upgraded yet).

    Manticore uses Chwala to interface with the storage (as per the configuration file / name of the storage driver).



  • I just tried to set it up using Kolab 16 but when using "Add storage" all I got was:

    "AN ERROR OCCURRED!
    Unable to authenticate user"

    I cannot exactly tell what happened since I could not find anything directly related to that in the logs.

    My configuration looks like this:

    /home/seafile/conf/seafdav.conf:

    [WEBDAV]
    enabled = false
    port = 8080
    fastcgi = false
    share_name = /
    

    /home/seafile/conf/seafile.conf:

    [fileserver]
    port = 8082
    
    [database]
    type = mysql
    host = 127.0.0.1
    port = 3306
    user = seafile
    password = <mysql_seafile_password>
    db_name = seafile-db
    connection_charset = utf8
    

    /home/seafile/conf/ccnet.conf:

    [General]
    USER_NAME = Kolab
    ID = 0123456789abcdef0123456789abcdef01234567
    NAME = Kolab
    SERVICE_URL = http://example.org:8000
    
    [Client]
    PORT = 13419
    
    [Database]
    ENGINE = mysql
    HOST = 127.0.0.1
    PORT = 3306
    USER = seafile
    PASSWD = <mysql_seafile_password>
    DB = ccnet-db
    CONNECTION_CHARSET = utf8
    
    [LDAP]
    HOST = ldap://localhost
    BASE = ou=People,dc=example,dc=org
    USER_DN = uid=kolab-service,ou=Special Users,dc=example,dc=org
    PASSWORD = <kolab_service_password>
    LOGIN_ATTR = mail
    
    [LDAP_SYNC]
    ENABLE_GROUP_SYNC = true
    SYNC_INTERVAL = 60
    

    /etc/roundcubemail/config.inc.php:

    $config['fileapi_backend'] = 'kolab';
    $config['fileapi_drivers'] = array('seafile');
    $config['fileapi_seafile_host'] = 'http://localhost';
    $config['fileapi_seafile_ssl_verify_peer'] = false;
    $config['fileapi_seafile_ssl_verify_host'] = false;
    $config['fileapi_seafile_cache'] = '14d';
    $config['fileapi_seafile_debug'] = false;
    

    /home/seafile/conf/seahub_settings.py:

    SECRET_KEY = "01234567-89ab-cdef-0123-456789abcdef0123"
    
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.mysql',
            'NAME': 'seahub-db',
            'USER': 'seafile',
            'PASSWORD': '<mysql_seafile_password>',
            'HOST': '127.0.0.1',
            'PORT': '3306',
            'OPTIONS': {
                'init_command': 'SET storage_engine=INNODB',
            }
        }
    }
    

  • Kolabian

    I never installed Seafile server, but connecting to seacloud.cc service works for me. Hmm... $config['fileapi_seafile_host'] = 'http://localhost'; does not look correct to me. Also, you have the debug option, use it.



  • @alec said:

    I never installed Seafile server, but connecting to seacloud.cc service works for me. Hmm... $config['fileapi_seafile_host'] = 'http://localhost'; does not look correct to me. Also, you have the debug option, use it.

    The SeaFile server is running on the same host. If I am not missing something then http://localhost should be a valid value for $config['fileapi_seafile_host'].

    May I ask you to provide me with the (analogous) values that you entered into the ADD STORAGE form? I want to be sure that I am at least not stupidly entering the wrong values.


  • Kolabian

    Maybe the option name is misleading, but Chwala connects to SeaFile server over HTTP API, so it has to be real location. From the source code I see that http:// prefix there is not valid. So, in your case it might be 'example.org:8000'. Note that https:// prefix will be added automatically.



  • @alec said:

    Maybe the option name is misleading, but Chwala connects to SeaFile server over HTTP API, so it has to be real location. From the source code I see that http:// prefix there is not valid. So, in your case it might be 'example.org:8000'. Note that https:// prefix will be added automatically.

    I changed $config['fileapi_seafile_host'] to the value you suggested and tried to add the storage using the following values:

    /var/log/chwala/errors:

    [23-Feb-2016 11:32:19,348700 +0100]: <0pdhvmda> PHP Error: Curl error: I/O operation timed out in /usr/share/pear/HTTP/Request2/Adapter/Curl.php on line 149 (POST /chwala//api/?method=folder_create)
    

    The response of this POST is:

    {
        reason:"Unable to authenticate user",
        status:"ERROR",
        code:580
    }
    

    Any ideas?


  • Kolabian

    Enable seafile conversation debugging and check Chwala logs to see what's going on. Check SeaFile error log.



  • I was not sure what you were meaning by telling me to

    Enable seafile conversation debugging

    so I tried to understand what Chwala was doing when told to add the storage. In /var/log/chwala/console I found the following POST which I could not successfully replicate:

    [23-Feb-2016 12:04:13,311100 +0100]: <0pdhvmda> SeaFile POST: https://example:8000/api2/auth-token/, POST: {"username":"john.doe@example.org","password":"*"}
    

    In fact since I had not configured SSL anywhere, I was quite surprised to find https:// in the URI and therefore replaced it. The resulting request (curl -d 'username=john.doe@example.org&password=<password>' 'http://example.org:8000/api2/auth-token/') succeeded and returned

    {"token": "720fb3ad95cf29137a774a905152517912385661"}
    

    which looked promising to me. You told me to

    Note that https:// prefix will be added automatically.

    but Is there a possibility to use http:// instead? I want to successfully configure the whole system before securing it in order to be able to distinguish which problems are related to SSL and which of them are not.


  • Kolabian

    This is hardcoded here https://git.kolab.org/diffusion/C/browse/master/lib/drivers/seafile/seafile_api.php;1bb096e2a2fa64e63746f23df5326cfc52b59f3c$86 I suppose we could modify the code to accept the protocol prefix in host option. For now you can just change the code.



  • That would be awesome! ;-)


  • Kolabian



  • Your changes seem to be correct, however $config['host'] is modified elsewhere and reaches your code without the http://. The URI therefore gets prepended the unwanted https://.


Log in to reply