ONLYOFFICE / docker-onlyoffice-owncloud

MIT License
98 stars 32 forks source link

Error when configuring the OnlyOffice application in NC13.0.2 #18

Closed rollanders closed 6 years ago

rollanders commented 6 years ago

Have a fresh install with this docker (fllowed this instructions https://www.linuxbabe.com/docker/onlyoffice-nextcloud-integration-docker

Onlyoffice is already activated when I open Nextcloud. But cannot open a document. There is no icon for opening a document with Onlyoffoce.

I edit the configuration as below: Document Editing Service address -> https://cloud.korskyrkan-intra.se/ds-vpath/ Document Editing Service address for internal requests from the server -> http://onlyoffice-document-server/ Server address for internal requests from the Document Editing Service -> http://nginx-server/

When saving I get an error. In the log is this error.

Error | onlyoffice | CommandRequest on check error: Error occurred in the document service: Error while downloading the document file to be converted.

alexanderonlyoffice commented 6 years ago

@rollanders,

Please disable advanced settings section and use only the first settings field. Enter the address https://cloud.korskyrkan-intra.se/ds-vpath/ in it and save the settings.

rollanders commented 6 years ago

I delete the advanced settings. disengage the advanced settings and save. Same error and the settings remains the same. I cannot delete them. Some permission problem? Should I edit a config-file?

alexanderonlyoffice commented 6 years ago

@rollanders, we will try to reproduce the issue using the instruction you mentioned.

rollanders commented 6 years ago

My OS: Windows 10 - updated, no firewall except windows own, Chrome webbbrowser.

alexanderonlyoffice commented 6 years ago

Please specify the OS of the server where you installed Docker-Compose. Is it Ubuntu 16.04?

rollanders commented 6 years ago

VPS with Ubuntu 16.04. Everything fresh install

alexanderonlyoffice commented 6 years ago

@rollanders, we deployed Docker-Compose with the instruction you mentioned and we got the same issue. If you enter the address of your Nextcloud (with a domain name) in the third address bar (where http://nginx-server/ is stated), then everything will work.

It seems that there is a problem in proxy configuration.

rollanders commented 6 years ago

Thanks. It worked. Do you mean there is an error on my side? An error in the instruction? I guess it would be helpful if you could identify it so we can communicate it further.

alexanderonlyoffice commented 6 years ago

@rollanders, our testing department is analyzing the issue to detect the reason.

Ravinou commented 6 years ago

Hi @alexanderonlyoffice ! I have the same error. My nextcloud is already installed on my host. Onlyoffice is running in a docker container.

Everything works fine until I try to using the JSON Web Tokens. If i use it i have error "CommandRequest on check error: Error occurred in the document service: Error while downloading the document file to be converted."

alexanderonlyoffice commented 6 years ago

Hello @Ravinou,

Please open /etc/onlyoffice/documentserver/default.json in container with Document Server and find the following section:

"secret": {
        "browser": {
          "string": "*****",
          "file": "",
          "tenants": {}
        },
        "inbox": {
          "string": "*****",
          "file": "",
          "tenants": {}
        },
        "outbox": {
          "string": "*****",
          "file": ""
        },
        "session": {
          "string": "*****",
          "file": ""
        }
      },
      "token": {
        "enable": {
          "browser": "true",
          "request": {
            "inbox": "true",
            "outbox": "true"
          }
        },
        "browser": {
          "secretFromInbox": true
        },
        "inbox": {
          "header": "AuthorizationJwt",
          "prefix": "Bearer ",
          "inBody": false

Copy JWT header and secret under *****.

Then open config.php of Nextcloud and add the following section:

'onlyoffice' =>
  array (
    "jwt_secret" => "*****",
    "jwt_header" => "AuthorizationJwt"
)

JWT header and secret should match the ones from default.json

Ravinou commented 6 years ago

Oh thank you very much @alexanderonlyoffice :) It was just missing this section in the nextcloud config.php :

'onlyoffice' => array ( "jwt_secret" => "*****", "jwt_header" => "AuthorizationJwt" )

It is strange because I did not find this section in any documentation, I searched badly?

Is it maybe possible to update your documentation (https://api.onlyoffice.com/editors/owncloud)?

Thank you for your work, onlyoffice works wonderfully :).

Ravinou commented 6 years ago

Hi, i find a better solution for starting my container, better than edit the file. I use env var :

docker run -i -t -d -p XX:XX -e JWT_ENABLED='true' -e JWT_SECRET='mysecret' -e JWT_HEADER="AuthorizationXXX" --name onlyoffice-IS-AMAZING-container onlyoffice/documentserver

DOC : https://github.com/ONLYOFFICE/Docker-DocumentServer/blob/master/README.md

REALLY REALLY GREAT WORK ONLYOFFICE :) !!! AWESOME

alexanderonlyoffice commented 6 years ago

Hello @Ravinou, we are glad the issue has been resolved.

Thank you for your feedback, we will update our documentation.

changchichung commented 6 years ago

I have the same problem , and I can not find "JWT header and secret" in default.json here is the default.json content (I didnt change anything , it comes by the docker )

{
  "statsd": {
    "useMetrics": false,
    "host": "localhost",
    "port": "8125",
    "prefix": "ds."
  },
  "log": {
    "filePath": "",
    "options": {
      "reloadSecs": 60
    }
  },
  "queue": {
    "visibilityTimeout": 300,
    "retentionPeriod": 900
  },
  "storage": {
    "name": "storage-fs",
    "fs": {
      "folderPath": "",
      "urlExpires": 900,
      "secretString": "onlyoffice"
    },
    "region": "",
    "endpoint": "http://localhost/s3",
    "bucketName": "cache",
    "storageFolderName": "files",
    "urlExpires": 604800,
    "accessKeyId": "AKID",
    "secretAccessKey": "SECRET",
    "useRequestToGetUrl": false,
    "useSignedUrl": false,
    "externalHost": ""
  },
  "rabbitmq": {
    "url": "amqp://guest:guest@localhost",
    "socketOptions": {},
    "exchangepubsub": "ds.pubsub",
    "queueconverttask": "ds.converttask",
    "queueconvertresponse": "ds.convertresponse",
    "exchangeconvertdead": "ds.exchangeconvertdead",
    "queueconvertdead": "ds.convertdead"
  },
  "dnscache": {
    "enable": true,
    "ttl": 300,
    "cachesize": 1000
  },
  "services": {
    "CoAuthoring": {
      "server": {
        "port": 8000,
        "workerpercpu": 1,
        "mode": "development",
        "limits_tempfile_upload": 104857600,
        "limits_image_size": 26214400,
        "limits_image_download_timeout": 120,
        "callbackRequestTimeout": 120,
        "healthcheckfilepath": "../public/healthcheck.docx",
        "savetimeoutdelay": 5000,
        "edit_singleton": false,
        "forgottenfiles": "forgotten",
        "forgottenfilesname": "output",
        "maxRequestChanges": 20000,
        "openProtectedFile": true
      },
      "requestDefaults": {
        "headers": {
          "userAgent": "Node.js/6.13"
        },
        "rejectUnauthorized": true
      },
      "autoAssembly": {
        "enable": false,
        "interval": "5m",
        "step": "1m"
      },
      "utils": {
        "utils_common_fontdir": "null",
        "utils_fonts_search_patterns": "*.ttf;*.ttc;*.otf",
        "resource_expires": 31536000,
        "limits_image_types_upload": "jpg;png;gif;bmp",
        "limits_image_types_copy": "jpg;png;gif;bmp;svg"
      },
      "sql": {
        "type": "postgres",
        "tableChanges": "doc_changes",
        "tableResult": "task_result",
        "dbHost": "localhost",
        "dbPort": 5432,
        "dbName": "onlyoffice",
        "dbUser": "onlyoffice",
        "dbPass": "onlyoffice",
        "charset": "utf8",
        "connectionlimit": 10,
        "max_allowed_packet": 1048575
      },
      "redis": {
        "name": "redis",
        "prefix": "ds:",
        "host": "localhost",
        "port": 6379
      },
      "pubsub": {
        "name": "pubsubRabbitMQ",
        "maxChanges": 1000
      },
      "expire": {
        "saveLock": 60,
        "presence": 300,
        "locks": 604800,
        "changeindex": 86400,
        "lockDoc": 30,
        "message": 86400,
        "lastsave": 604800,
        "forcesave": 604800,
        "saved": 3600,
        "documentsCron": "0 */2 * * * *",
        "files": 86400,
        "filesCron": "00 00 */1 * * *",
        "filesremovedatonce": 100,
        "sessionidle": "0",
        "sessionabsolute": "30d",
        "sessionclosecommand": "2m",
        "pemStdTTL": "1h",
        "pemCheckPeriod": "10m",
        "updateVersionStatus": "5m"
      },
      "ipfilter": {
        "rules": [
          {
            "address": "*",
            "allowed": true
          }
        ],
        "useforrequest": false,
        "errorcode": 401
      },
      "secret": {
        "browser": {
          "string": "secret",
          "file": "",
          "tenants": {}
        },
        "inbox": {
          "string": "secret",
          "file": "",
          "tenants": {}
        },
        "outbox": {
          "string": "secret",
          "file": ""
        },
        "session": {
          "string": "secret",
          "file": ""
        }
      },
      "token": {
        "enable": {
          "browser": false,
          "request": {
            "inbox": false,
            "outbox": false
          }
        },
        "browser": {
          "secretFromInbox": true
        },
        "inbox": {
          "header": "Authorization",
          "prefix": "Bearer ",
          "inBody": false
        },
        "outbox": {
          "header": "Authorization",
          "prefix": "Bearer ",
          "algorithm": "HS256",
          "expires": "5m",
          "inBody": false
        },
        "session": {
          "algorithm": "HS256",
          "expires": "30d"
        }
      },
      "plugins": {
        "uri": "/sdkjs-plugins",
        "autostart": []
      },
      "editor": {
        "spellcheckerUrl": "/spellchecker",
        "reconnection": {
          "attempts": 50,
          "delay": "2s"
        }
      },
      "sockjs": {
        "sockjs_url": "",
        "websocket": true
      }
    }
  },
  "license": {
    "license_file": "",
    "warning_limit_percents": "70"
  },
  "FileConverter": {
    "converter": {
      "maxDownloadBytes": 100000000,
      "downloadTimeout": 120,
      "downloadAttemptMaxCount": 3,
      "downloadAttemptDelay": 1000,
      "maxprocesscount": 1,
      "fontDir": "null",
      "presentationThemesDir": "null",
      "x2tPath": "null",
      "docbuilderPath": "null",
      "docbuilderAllFontsPath": "null",
      "args": "",
      "errorfiles": "",
      "streamWriterBufferSize": 8388608,
      "maxRedeliveredCount": 2,
      "inputLimits": [
        {
          "type": "docx;dotx;docm;dotm",
          "zip": {
            "uncompressed": "50MB",
            "template": "*.xml"
        },
        {
          "type": "xlsx;xltx;xlsm;xltm",
          "zip": {
            "uncompressed": "300MB",
            "template": "*.xml"
          }
        },
        {
          "type": "pptx;ppsx;potx;pptm;ppsm;potm",
          "zip": {
            "uncompressed": "50MB",
            "template": "*.xml"
          }
        }
      ]
    }
  },
  "FileStorage": {
    "host": "",
    "port": 4567,
    "directory": "",
    "silent": true
  },
  "SpellChecker": {
    "server": {
      "port": 8080,
      "mode": "development"
    }
  }
}

any suggestions ? thanks !

Ravinou commented 6 years ago

I have the same problem , and I can not find "JWT header and secret" in default.json here is the default.json content (I didnt change anything , it comes by the docker )

any suggestions ? thanks !

Hi @changchichung , i don't understand your question ? If you find this section... :

'onlyoffice' =>
array (
"jwt_secret" => "*****",
"jwt_header" => "AuthorizationJwt"
)

...this section is not in default.json. You have to add this section in the config.php of your nextcloud installation.

changchichung commented 6 years ago

@Ravinou
then what is the "*****" ?

JWT header and secret should match the ones from default.json

since there`s no such section in default.json , how could them match ?

Ravinou commented 6 years ago

@changchichung This is the secret of your choice and it has to match with the same secret in the default.json on this section (string : "**") :

"secret": {
        "browser": {
          "string": "*****",
          "file": "",
          "tenants": {}
        },
        "inbox": {
          "string": "*****",
          "file": "",
          "tenants": {}
        },
        "outbox": {
          "string": "*****",
          "file": ""
        },
        "session": {
          "string": "*****",
          "file": ""
        }
      },

@changchichung is it ok for you ?

alexanderonlyoffice commented 5 years ago

@changchichung, please specify if the issue still exists.

tba77 commented 5 years ago

Hello I have such issue when I try to configure onlyoffice with my nextcloud server my onlyoffice server is located at https://office.youboost.tn it seems to work fine as I get the welcome page and https://office.youboost.tn/healthcheck returns true* My nextcloud is at https://nextcloud.youboost.tn both servers run under Debian 6.9 and only office is installed from github so I assume it's the last version and I am running nextcloud V 15.0.2 (last update)

When I enter my URL on the required field I get this log error

{"reqId":"9WZvWkJFeR7eElEo9JCz","level":3,"time":"2019-01-16T15:23:40+00:00","remoteAddr":"172.16.100.130","user":"tahar","app":"onlyoffice","method":"PUT","url":"\/apps\/onlyoffice\/ajax\/settings","message":"GetConvertedUri on check error: Une erreur s'est produite dans le service de document: Unknown error","userAgent":"Mozilla\/5.0 (X11; Linux x86_64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/71.0.3578.98 Safari\/537.36","version":"15.0.2.0"}

root@office:/home/tahar# cat /etc/onlyoffice/documentserver/local.json 
{
  "services": {
    "CoAuthoring": {
      "sql": {
        "dbHost": "localhost",
        "dbName": "onlyoffice",
        "dbUser": "onlyoffice",
        "dbPass": "onlyoffice"
      },
      "redis": {
        "host": "localhost"
      },
      "token": {
        "enable": {
          "request": {
            "inbox": false,
            "outbox": false
          },
          "browser": false
        },
        "inbox": {
          "header": "Authorization"
        },
        "outbox": {
          "header": "Authorization"
        }
      },
      "secret": {
        "inbox": {
          "string": "HFe544337HkW56e"
        },
        "outbox": {
          "string": "HFe544337HkW56e"
        },
        "session": {
          "string": "HFe544337HkW56e"
        }
      }
    }
  },
  "rabbitmq": {
    "url": "amqp://guest:guest@localhost"
  }
}
 "rabbitmq": {
    "url": "amqp://guest:guest@localhost"
  }
}

my nextcloud config

$CONFIG = array (
  'instanceid' => 'ocw6uj82psfa',
  'passwordsalt' => 'etdUcMxol8utNFMFcHykuCIrwt6UKz',
  'secret' => 'jwITSD2/UukUPQ38udqcJzsGuXaRE0SIiEsjfN4TPW4Gnf8m',
  'trusted_domains' => 
  array (
    0 => '172.16.100.156',
    1 => 'nextcloud.youboost.tn',
  ),
  'datadirectory' => '/data',
  'dbtype' => 'mysql',
  'version' => '15.0.2.0',
  'overwrite.cli.url' => 'https://nextcloud.youboost.tn/',
  'htaccess.RewriteBase' => '/',
  'dbname' => 'ncloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'ncuser',
  'dbpassword' => 'lQmcMwtbTB6rsM',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'redis' => 
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'twofactor_enforced' => 'false',
  'twofactor_enforced_groups' => 
  array (
  ),
  'twofactor_enforced_excluded_groups' => 
  array (
  ),
  'onlyoffice' => 
  array ( 
  'verify_peer_off' => TRUE 
  ),
  'maintenance' => false,
  'updater.secret' => '$2y$10$kuveRbD6yp1opFqpZGS0HeBga4s43GsS1fWwdFnM12jZ1ldLgHgqq',
  'theme' => '',
  'loglevel' => 2,
);
alexanderonlyoffice commented 5 years ago

Hello @tba77, please specify the following information:

  1. Send us a screenshot of ONLYOFFICE integration app address settings from Nextcloud;
  2. Click on the 'Save' button on the integration app address settings page and send us a screenshot of the error;
  3. Try to check if Nextcloud is accessible for the Document Server and vice versa. Use wget command to do it (wget https://office.youboost.tn from the server with Nextcloud and wget https://nextcloud.youboost.tn from the server with Document Server).
alexanderonlyoffice commented 5 years ago

@tba77, please send us logs of converter service of Document Server to support@onlyoffice.com. Logs are in folder /var/log/onlyoffice/documentserver/logs/converter/

tba77 commented 5 years ago

Hello thank you it's ok I was able to solve my problem it was a communication problem with nextcloud, the onlything that doesn't work is the fact that I can't set a personalized secret

cabdomingues commented 5 years ago

My experience says that some integration issues are due to Self Signed Certificates /when using HTTPS)

See: tail -f /var/log/onlyoffice/documentserver/converter/out.log at TLSSocket.emit (events.js:208:7) at TLSSocket._finishInit (_tls_wrap.js:643:8) at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:473:38) [2019-01-30T10:07:21.945] [ERROR] nodeJS - error downloadFile:url=https://srv-wwwintra2:8443/owncloud/index.php/apps/onlyoffice/empty?doc=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY3Rpb24iOiJlbXB0eSJ9.ugbzWtVuaXhIyJjW3_Wvgl41XXPbIfQguJM1eqeb2z8;attempt=3;code:DEPTH_ZERO_SELF_SIGNED_CERT;connect:null;(id=conv_check_811843922_docx) Error: self signed certificate at TLSSocket. (_tls_wrap.js:1116:38) at emitNone (events.js:106:13) at TLSSocket.emit (events.js:208:7) at TLSSocket._finishInit (_tls_wrap.js:643:8) at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:473:38)

alexanderonlyoffice commented 5 years ago

@cabdomingues, in case when self signed SSL certificates are used, you need to disable certificate verification by Nextcloud or by Document Server correspondingly. You need to add the section below to Nextcloud config.php to disable verification of self signed certificate of Document Server:

'onlyoffice' =>
  array (
    'verify_peer_off' => TRUE,
  )

For Document Server the parameter ''rejectUnauthorized' has to have value false to disable verification of Nextcloud certificate. This parameter can be found in default.json of Document Server. After that Document Server services must be restarted.

tba77 commented 5 years ago

Hello, I have an issue I didn't understand I changed the URL of my nextcloud from nextcloud.youboost.tn to eocloud.eodatacenter.com I configured a new apache configuration file to keep both domains, but onlyoffice doesn't work anymore when I open a document I have an error saying the document cannot be saved you will be prompted to download it

Attached a screen shot I didnt change anything on my onlyoffice document server configuration nor nextcloud onlyoffice app. Any Idea ? I am planning to change onlyoffice URL after making it work

Thank you very much. capture du 2019-02-20 11-28-23

cabdomingues commented 5 years ago

Hello, I have an issue I didn't understand I changed the URL of my nextcloud from nextcloud.youboost.tn to eocloud.eodatacenter.com I configured a new apache configuration file to keep both domains, but onlyoffice doesn't work anymore when I open a document I have an error saying the document cannot be saved you will be prompted to download it

Attached a screen shot I didnt change anything on my onlyoffice document server configuration nor nextcloud onlyoffice app. Any Idea ? I am planning to change onlyoffice URL after making it work

Thank you very much. capture du 2019-02-20 11-28-23

Have you verified all HTTPS connections? All DNS entries are up to date?

In my case, most issues and dificulties were related to HTTPS. Carlos

tba77 commented 5 years ago

Yes, nextcloud works fine even with the new domain, I didn't change onlyoffice it's still the same URL when I use my old domain everything works

cabdomingues commented 5 years ago

Yes, nextcloud works fine even with the new domain, I didn't change onlyoffice it's still the same URL when I use my old domain everything works

have you checked

/var/log/onlyoffice/documentserver/converter/out.log and other lof files? /var/log/onlyoffice/documentserver/nginx.error.log

??

also, review /etc/onlyoffice/documentserver/default.json and /etc/nginx/conf.d/onlyoffice-documentserver.conf or /etc/onlyoffice/documentserver/nginx/onlyoffice-documentserver.conf

Carlos

tba77 commented 5 years ago

Hello, Yes I checked there I didn't notice anything the configuration seems fine and there is no hard coded domain name anywhere. /var/log/onlyoffice/documentserver/nginx.error.log is empty there no error at all. my Nginx config is the following

`server {
  listen 0.0.0.0:80;
  listen [::]:80 default_server;
  server_name office.youboost.tn;
  server_tokens off;
  ## Redirects all traffic to the HTTPS host
  root /nowhere; ## root doesn't have to be a valid path since we are redirectin
g
  rewrite ^ https://$host$request_uri? permanent;
}

server {
  listen 127.0.0.1:80;
  listen [::1]:80;
  server_name localhost;
  server_tokens off;
  include /etc/nginx/includes/onlyoffice-documentserver-common.conf;
  include /etc/nginx/includes/onlyoffice-documentserver-docservice.conf;
}

server {
  listen 0.0.0.0:443 ssl;
  listen [::]:443 ssl default_server;
  server_name office.youboost.tn;
  server_tokens off;
  root /usr/share/nginx/html;

  ssl_certificate /etc/letsencrypt/live/office.youboost.tn/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/office.youboost.tn/privkey.pem;

  ssl_protocols TLSv1.2;
  ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA
384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
  ssl_prefer_server_ciphers on;

  add_header Strict-Transport-Security max-age=15768000;

  ssl_session_cache builtin:1000 shared:SSL:10m;

  add_header X-Content-Type-Options nosniff;

  location ~ /.well-known/acme-challenge {
     root /var/www/onlyoffice/;
     allow all;
  }
  include /etc/nginx/includes/onlyoffice-documentserver-*.conf;
}
`

As I said I didn't modify anything on onlyoffice only nextcloud I added a new domain name so I configured a new apache file and added the new name in config.php

  array (
    0 => '127.0.0.1',
    1 => 'eocloud.eodatacenter.com',
    2 => 'nextcloud.youboost.tn',
  ),
ersenkaya commented 5 years ago

Hello,

I have same problem between owncloud and onlyoffice and tried lots of things but problem is continue.

Do you have any suggestion to fix this error?

"Error when trying to connect (Error occurred in the document service: Error while downloading the document file to be converted.)"

Thanks for your advice.

screenshot_1

screenshot_2

tba77 commented 5 years ago

Verify that your document server has access to your owncloud and own cloud has access to your document server, I had that issue and it was a firewall problem.

ersenkaya commented 5 years ago

clipboard01

When I test with wget it looks like OK and also, you can access domains are reachable. This problem appeared last week, before everything are working properly.

https://owncloud.mobilbil.com.tr https://onlyoffice.mobilbil.com.tr