ONLYOFFICE / Docker-DocumentServer

ONLYOFFICE Document Server is an online office suite comprising viewers and editors for texts, spreadsheets and presentations, fully compatible with Office Open XML formats: .docx, .xlsx, .pptx and enabling collaborative editing in real time.
GNU Affero General Public License v3.0
1.39k stars 481 forks source link

Unknown error - FileRun and OnlyOffice via Docker Compose #299

Closed zilexa closed 3 years ago

zilexa commented 3 years ago

Do you want to request a feature or report a bug? Might be configuration issue rather than bug. I just need some help as I do not know how to debug this myself.

What is the current behavior? Right click a file in Filerun, Open with OnlyOffice. OnlyOffice opens (the UI is visible) but shows "Unknown Error". Tried multiple .doc and .docx files. The documents are not shown, I get the error on an empty OnlyOffice screen. (see screenshot).

What is the expected behavior? Documents should open normal.

Host Operating System: Ubuntu Budgie 20.04.1

My Docker Compose:

##_____________________ OnlyOffice Document Server [Cloud/Office]
  onlyoffice:
    image: onlyoffice/documentserver-ie:latest
    container_name: onlyoffice
    stdin_open: true
    restart: always
    links:
      - filerun
    ports:
      - "8001:80"
    environment:
      - JWT_ENABLED=true
      - JWT_SECRET=$ONLYOFFICEJWT
      - JWT_HEADER=Authorization
      - JWT_IN_BODY=true
    labels:
      - traefik.enable=true
      - traefik.http.middlewares.office-redirect.redirectscheme.scheme=https
      - traefik.http.routers.office-redirect.entrypoints=web
      - traefik.http.routers.office-redirect.middlewares=office-redirect
      - traefik.http.routers.office-redirect.rule=Host(`office.$DOMAIN`)
      - traefik.http.routers.office.entrypoints=websecure
      - traefik.http.routers.office.rule=Host(`office.$DOMAIN`)
      - traefik.http.routers.office.tls.certresolver=letsencrypt
      - traefik.http.services.office.loadbalancer.server.port=80

OnlyOffice is accessible via https://office.obelix.cloud and when I open https://office.obelix.cloud/healthcheck it returns true. In FileRun>Settings>Plugins>OnlyOffice I use this URL: https://office.obelix.cloud and I have enabled JWT.

What can be the issue here? I am using the minimal docker-compose example. Do I need something extra if I only want to use OnlyOffice (for home use) in combination with FileRun?

screenshot

ShockwaveNN commented 3 years ago

Right click a file in Filerun, Open with OnlyOffice

I think you should report that issue to Filerun, I've never heard of this service, so we cannot guaranted correct work.

I think there can be some problem in those integration, maybe some problems with JWT or even with traefik, there is several open issue with treafik in our repo.

You should see for errors in /var/log/onlyoffice in container

zilexa commented 3 years ago

FileRun is a lightweight version of NextCloud with official integration with OnlyOffice, especially for their enterprise product.

I tried it without Traefik, just using local IP and the issue is the same. Since I couldn't see anything related to loading a file in the log that I could see via Portainer, I had no way of debugging. But I will check the /var/log/onlyoffice folder.

zilexa commented 3 years ago

Can you at least confirm my docker-compose contains all required variables? There are a lot but I try to only use the ones that should be required. For example, no volume is mounted.

ShockwaveNN commented 3 years ago

lightweight version of NextCloud with official integration

We got official integration with Nextcloud, but as far as I'm aware no one at our team is tested FileRun integration, so if these extension is differ from Nextcloud extension - you should contact dev team of this extension

Can you at least confirm my docker-compose contains all required variables

If you got healthcheck true - this should be ok

And since you're using onlyoffice/documentserver-ie image - you can enable integrated test example via supervisorctl start all command inside container and see if service opened document fine in it

Also since you're using portainer - we do not tested it's support either, again I saw several issues with it in our repo

I recommend to you to split your pretty complicated config with several parts, that we have issues with (portainer, trefik) and enable it ony by one until you'll find problem component

zilexa commented 3 years ago
root@6df63e016b21:/# supervisorctl start all
ds:example: started

Note I do not use Portainer to set this up, only for easy access to console and logs. So Portainer is not involved here. And with all Labels removed, I have the same issue.

I will post on Filerun forum.

ShockwaveNN commented 3 years ago

@zilexa To be absolutly clear what this issue is with Filerun - if you try to connect same DocumentServer instance to Nextcloud and check if everything good - if everything good - this is Filerun issue for sure

ShockwaveNN commented 3 years ago

@zilexa Also again - please look out for errors in logs folder, ther may be some and this may be unrelated to Filerun issue

zilexa commented 3 years ago

OK I understand what I did wrong: I had the wrong tag: documentserver-ie instead of the Community Edition! So I changed it and I am a lot closer to the solution now after testing with Nextcloud and getting the same new result as in Filerun:

  onlyoffice:
    image: onlyoffice/documentserver
    container_name: onlyoffice
    stdin_open: true
    tty: true
    ports:
      - "8889:80"
    volumes:
      - /srv/onlyoffice:/var/www/onlyoffice/Data
    dns: 172.17.0.1
    environment:
      - JWT_ENABLED="true"
      - JWT_SECRET=$ONLYOFFICEJWT

This is what I am bumping in now when I try to open an existing docx via NextCloud or FileRun: image

Onlyoffice-documentserver docker log:

==> /var/log/onlyoffice/documentserver/docservice/out.log <==
[2020-10-08T22:12:17.349] [ERROR] nodeJS - dnsLookup error: hostname = files.obelix.cloud
Error: getaddrinfo EAI_AGAIN files.obelix.cloud
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:26)
[2020-10-08T22:12:17.350] [WARN] nodeJS - checkIpFilter error: docId = 12350da9d36507367981;url = https://files.obelix.cloud/wl/?id=7rfVWzZKKOA4F4z6b97TUyorWzCo36UF&action=onlyoffice&save=1
[2020-10-08T22:16:16.449] [ERROR] nodeJS - dnsLookup error: hostname = files.obelix.cloud
Error: getaddrinfo EAI_AGAIN files.obelix.cloud
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:26)
[2020-10-08T22:16:16.449] [WARN] nodeJS - checkIpFilter error: docId = 12350da9d36507367981;url = https://files.obelix.cloud/wl/?id=FWz0eEjhSMQtkM6tcNQSL2qgPsPXXBcn&action=onlyoffice&save=1
[2020-10-08T22:18:00.050] [ERROR] nodeJS - dnsLookup error: hostname = files.obelix.cloud
Error: getaddrinfo EAI_AGAIN files.obelix.cloud
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:26)
[2020-10-08T22:18:00.050] [WARN] nodeJS - checkIpFilter error: docId = 11724430668707367981;url = https://files.obelix.cloud/wl/?id=pWOwBlsIhabARE3Vp10pjP4sOMjRuIHW&action=onlyoffice&save=1

note the checkIpFilter error appears during every attempt I try to open a file in OnlyOffice.

Can you please point me in the direction where I should look? Because I don't understand what is going wrong here. HTTPS is working just fine as you can test here: https://office.obelix.cloud and files.obelix.cloud is my FileRun/Nextcloud instance.

EDIT: I did wget https://files.obelix.cloud inside console in the OnlyOffice container and it hangs on Resolving files.obelix.cloud (files.obelix.cloud)... Strangely, although I can access that url just fine remotely and within my LAN, OnlyOffice can't seem to resolve it. No idea how to solve it. Any ideas?

ShockwaveNN commented 3 years ago

EDIT: I did wget https://files.obelix.cloud inside console in the OnlyOffice container and it hangs on Resolving files.obelix.cloud (files.obelix.cloud)...

Yeah, I think this is a reason of your problem

Seems you got some troubles with DNS, could you try to replace

    dns: 172.17.0.1

line in your docker-compose on some other, for example to google dns at least temproaly

zilexa commented 3 years ago

That indeed solved it, but now I am getting an unknown error again :(

logfile, Onlyoffice complains about onlyoffice TypeError: ic.YJb is not a function Script:

==> /var/log/onlyoffice/documentserver/docservice/out.log <==

[2020-10-09T09:03:11.409] [ERROR] nodeJS - changesError: docId = 1397544d805598245930 Error: TypeError: ic.YJb is not a function Script: https://office.obelix.cloud/5.6.5-3/sdkjs/common/libfont/wasm/fonts.js Line: 37:318 userAgent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0 platform: Linux x86_64 isLoadFullApi: false isDocumentLoadComplete: false StackTrace: @https://office.obelix.cloud/5.6.5-3/sdkjs/common/libfont/wasm/fonts.js:37:318

@https://office.obelix.cloud/5.6.5-3/sdkjs/common/libfont/wasm/fonts.js:37:325

Something with fonts? But I tried multiple different and simple doc and docx files..

ShockwaveNN commented 3 years ago

Hm, this is strange, never seen such error.

Could you attach files you're trying to open?

Is this error actual only for doc and docx or xlsx and pptx files are also broken?

zilexa commented 3 years ago

Actually I just noticed more logs are available, after my first attempts after changing DNS, the nginx.error.log might also be interesting although the timestamp does not match the Error:TypeError: ic.Yjb. Apparently /var/www/onlyoffice/documentserver/sdkjs/common/libfont/wasm/fonts.js:37:325 is missing or something.

==> /var/log/onlyoffice/documentserver/docservice/out.log <==

[2020-10-09T09:03:11.409] [ERROR] nodeJS - changesError: docId = 1397544d805598245930 Error: TypeError: ic.YJb is not a function Script: https://office.obelix.cloud/5.6.5-3/sdkjs/common/libfont/wasm/fonts.js Line: 37:318 userAgent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0 platform: Linux x86_64 isLoadFullApi: false isDocumentLoadComplete: false StackTrace: @https://office.obelix.cloud/5.6.5-3/sdkjs/common/libfont/wasm/fonts.js:37:318

@https://office.obelix.cloud/5.6.5-3/sdkjs/common/libfont/wasm/fonts.js:37:325

==> /var/log/onlyoffice/documentserver/nginx.error.log <==

2020/10/09 09:05:36 [error] 4693#4693: *37 open() "/var/www/onlyoffice/documentserver/sdkjs/common/libfont/wasm/fonts.js:37:325" failed (2: No such file or directory), client: 172.19.0.11, server: , request: "GET /5.6.5-3/sdkjs/common/libfont/wasm/fonts.js:37:325 HTTP/1.1", host: "office.obelix.cloud"

2020/10/09 09:05:36 [error] 4693#4693: *37 open() "/var/www/onlyoffice/documentserver/sdkjs/common/libfont/wasm/fonts.js:37:318" failed (2: No such file or directory), client: 172.19.0.11, server: , request: "GET /5.6.5-3/sdkjs/common/libfont/wasm/fonts.js:37:318 HTTP/1.1", host: "office.obelix.cloud"

2020/10/09 09:10:05 [error] 4693#4693: *38 open() "/var/www/onlyoffice/documentserver/sdkjs/common/libfont/wasm/fonts.js:37:325" failed (2: No such file or directory), client: 172.19.0.11, server: , request: "GET /5.6.5-3/sdkjs/common/libfont/wasm/fonts.js:37:325 HTTP/1.1", host: "office.obelix.cloud"

2020/10/09 09:10:05 [error] 4693#4693: *39 open() "/var/www/onlyoffice/documentserver/sdkjs/common/libfont/wasm/fonts.js:37:318" failed (2: No such file or directory), client: 172.19.0.11, server: , request: "GET /5.6.5-3/sdkjs/common/libfont/wasm/fonts.js:37:318 HTTP/1.1", host: "office.obelix.cloud"

2020/10/09 09:10:05 [error] 4693#4693: *40 open() "/var/www/onlyoffice/documentserver/sdkjs/common/libfont/wasm/fonts.js:37:32" failed (2: No such file or directory), client: 172.19.0.11, server: , request: "GET /5.6.5-3/sdkjs/common/libfont/wasm/fonts.js:37:32 HTTP/1.1", host: "office.obelix.cloud"

2020/10/09 09:10:05 [error] 4693#4693: *41 open() "/var/www/onlyoffice/documentserver/sdkjs/common/libfont/wasm/fonts.js:37:31" failed (2: No such file or directory), client: 172.19.0.11, server: , request: "GET /5.6.5-3/sdkjs/common/libfont/wasm/fonts.js:37:31 HTTP/1.1", host: "office.obelix.cloud"

==> /var/log/onlyoffice/documentserver/metrics/out.log <==

Flushing stats at  Fri Oct 09 2020 09:12:00 GMT+0000 (Coordinated Universal Time)

{ counters:

   { 'statsd.bad_lines_seen': 0,

     'statsd.packets_received': 0,

     'statsd.metrics_received': 0 },

  timers: {},

  gauges: {},

  timer_data: {},

  counter_rates:

   { 'statsd.bad_lines_seen': 0,

     'statsd.packets_received': 0,

     'statsd.metrics_received': 0 },

  sets: {},

  pctThreshold: [ 90 ] }

Here is an example of a docx file: https://files.obelix.cloud/wl/?id=yj6Kmk2xStmehSAMS2NfIGBJPAqJsqiW

ShockwaveNN commented 3 years ago

I got several questions:

  1. Is this fonts.js file is present inside container? It's 100% required and should be

    root@4c232dc0aef4:/# ls -la /var/www/onlyoffice/documentserver/sdkjs/common/libfont/wasm/fonts.js
    -rw-r--r-- 1 ds ds 29333 Sep 16 16:20 /var/www/onlyoffice/documentserver/sdkjs/common/libfont/wasm/fonts.js
  2. Could you attach full startup logs of DocumentServer? I think there is some crucial steps missing, like font generation Correct logs should be like this:

    
    * Starting PostgreSQL 10 database server                                                                                                 [ OK ] 
    * Starting RabbitMQ Messaging Server rabbitmq-server                                                                                     [ OK ] 
    Starting supervisor: supervisord.
    * Starting periodic command scheduler cron                                                                                               [ OK ] 
    * Starting nginx nginx                                                                                                                   [ OK ] 
    Generating AllFonts.js, please wait...Done
    Generating presentation themes, please wait...3333^[Done
    ds:docservice: stopped
    ds:docservice: started
    ds:converter: stopped
    ds:converter: started
    * Reloading nginx configuration nginx                                                                                                    [ OK ] 
    ==> /var/log/onlyoffice/documentserver/converter/err.log <==

==> /var/log/onlyoffice/documentserver/converter/out.log <==


And after that are log outputs

3. If everything above is fine - could you recreate container anew, so we are sure that prvevious logs has nothing to do with current situation?

4. I've checked your file and it's opening fine for me
zilexa commented 3 years ago

OK thanks, here we go:

  1. Indeed it is:

    root@4c232dc0aef4:/# ls -la /var/www/onlyoffice/documentserver/sdkjs/common/libfont/wasm/fonts.js
    -rw-r--r-- 1 ds ds 29333 Sep 16 16:20 /var/www/onlyoffice/documentserver/sdkjs/common/libfont/wasm/fonts.js
  2. Where can I find the startup log? /var/log/onlyoffice/documentserver/docservice ? It doesn't look like your example, complaining about some plugin folder. I have removed the container and its image then noticed there were multiple unused volumes which I also deleted so I can do a fresh pull/create via Compose.

zilexa commented 3 years ago

I think this is all? After bringing the container up. I did a couple more attempts at opening that same file. Strangely err.log stays empty, even though I get the same error. I now also notice the log says it is listening on port 8080. Nowhere in the documentation or in my Compose is that port declared..

Waiting for connection to the onlyoffice-postgresql host on port 5432

Waiting for connection to the onlyoffice-postgresql host on port 5432

Waiting for connection to the onlyoffice-postgresql host on port 5432

Waiting for connection to the onlyoffice-rabbitmq host on port 5672

Starting supervisor: supervisord.

 * Starting periodic command scheduler cron        
[ OK ]

 * Starting nginx nginx        
[ OK ]

Generating AllFonts.js, please wait...Done

Generating presentation themes, please wait...Done

ds:docservice: stopped

ds:docservice: started

ds:converter: stopped

ds:converter: started

 * Reloading nginx configuration nginx        
[ OK ]

==> /var/log/onlyoffice/documentserver/converter/err.log <==

==> /var/log/onlyoffice/documentserver/converter/out.log <==

[2020-10-09T10:29:29.535] [WARN] nodeJS - update cluster with 1 workers

[2020-10-09T10:29:29.541] [WARN] nodeJS - worker 303 started.

[2020-10-09T10:29:29.542] [WARN] nodeJS - update cluster with 1 workers

[2020-10-09T10:29:41.295] [WARN] nodeJS - update cluster with 1 workers

[2020-10-09T10:29:41.301] [WARN] nodeJS - worker 361 started.

[2020-10-09T10:29:41.302] [WARN] nodeJS - update cluster with 1 workers

==> /var/log/onlyoffice/documentserver/docservice/err.log <==

==> /var/log/onlyoffice/documentserver/docservice/out.log <==

[2020-10-09T10:29:29.696] [WARN] nodeJS - Express server starting...

[2020-10-09T10:29:29.699] [WARN] nodeJS - Failed to subscribe to plugin folder updates. When changing the list of plugins, you must restart the server. https://nodejs.org/docs/latest/api/fs.html#fs_availability

[2020-10-09T10:29:29.758] [WARN] nodeJS - Express server listening on port 8000 in production-linux mode

[2020-10-09T10:29:39.957] [WARN] nodeJS - Express server starting...

[2020-10-09T10:29:39.959] [WARN] nodeJS - Failed to subscribe to plugin folder updates. When changing the list of plugins, you must restart the server. https://nodejs.org/docs/latest/api/fs.html#fs_availability

[2020-10-09T10:29:39.984] [WARN] nodeJS - Express server listening on port 8000 in production-linux mode

==> /var/log/onlyoffice/documentserver/metrics/err.log <==

==> /var/log/onlyoffice/documentserver/metrics/out.log <==

9 Oct 10:29:29 - [264] reading config file: ./config/config.js

9 Oct 10:29:29 - server is up INFO

==> /var/log/onlyoffice/documentserver/nginx.error.log <==

==> /var/log/onlyoffice/documentserver/spellchecker/err.log <==

==> /var/log/onlyoffice/documentserver/spellchecker/out.log <==

[2020-10-09T10:29:29.385] [WARN] nodeJS - start cluster with 1 workers

[2020-10-09T10:29:29.391] [WARN] nodeJS - worker 293 started.

[2020-10-09T10:29:29.672] [WARN] nodeJS - Express server starting...

[2020-10-09T10:29:29.702] [WARN] nodeJS - Express server listening on port 8080 in production-linux mode

And this is how I bring up the containers:

##_____________________ OnlyOffice Document Server [Cloud/Office]
  onlyoffice:
    image: onlyoffice/documentserver
    container_name: onlyoffice
    depends_on:
      - onlyoffice-postgresql
      - onlyoffice-rabbitmq
    stdin_open: true
    restart: always
    tty: true
    ports:
      - "8889:80"
    volumes:
      - /var/www/onlyoffice/Data
      - /var/log/onlyoffice
      - /var/lib/onlyoffice/documentserver/App_Data/cache/files
      - /var/www/onlyoffice/documentserver-example/public/files
      - /usr/share/fonts
    dns: 1.1.1.1
    environment:
      - JWT_ENABLED="true"
      - JWT_SECRET=$ONLYOFFICEJWT
      - DB_TYPE=postgres
      - DB_HOST=onlyoffice-postgresql
      - DB_PORT=5432
      - DB_NAME=onlyoffice
      - DB_USER=onlyoffice
      - AMQP_URI=amqp://guest:guest@onlyoffice-rabbitmq
    labels:
      - traefik.enable=true
      - traefik.http.middlewares.onlyoffice-redirect.redirectscheme.scheme=https
      - traefik.http.routers.onlyoffice-redirect.entrypoints=web
      - traefik.http.routers.onlyoffice-redirect.middlewares=onlyoffice-redirect
      - traefik.http.routers.onlyoffice-redirect.rule=Host(`office.$DOMAIN`)
      - traefik.http.routers.onlyoffice.entrypoints=websecure
      - traefik.http.routers.onlyoffice.rule=Host(`office.$DOMAIN`)
      - traefik.http.routers.onlyoffice.tls.certresolver=letsencrypt
      - traefik.http.services.onlyoffice.loadbalancer.server.port=80
      - traefik.http.middlewares.oo-header.headers.referrerPolicy=no-referrer
      - traefik.http.middlewares.oo-header.headers.stsSeconds=31536000
      - traefik.http.middlewares.oo-header.headers.forceSTSHeader=true
      - traefik.http.middlewares.oo-header.headers.stsPreload=true
      - traefik.http.middlewares.oo-header.headers.stsIncludeSubdomains=true
      - traefik.http.middlewares.oo-header.headers.browserXssFilter=true
      - traefik.http.middlewares.oo-header.headers.customRequestHeaders.X-Forwarded-Proto=https
##____________________ Onlyoffice rabbitmq [CLOUD/Office]
  onlyoffice-rabbitmq:
    container_name: onlyoffice-rabbitmq
    image: rabbitmq
    restart: always
    expose:
      - '5672'
##____________________ Onlyoffice database [CLOUD/Office]
  onlyoffice-postgresql:
    container_name: onlyoffice-postgresql
    image: postgres:9.5
    environment:
      - POSTGRES_DB=onlyoffice
      - POSTGRES_USER=onlyoffice
      - POSTGRES_HOST_AUTH_METHOD=trust
    restart: always
    expose:
      - '5432'
    volumes:
      - postgresql_data:/var/lib/postgresql

volumes:
  postgresql_data:
ShockwaveNN commented 3 years ago

8000 and 8080 are default internals ports for our services.

In general - your logs are looking fine

But since you have same error - I think very may be problem on FileRun side, or maybe in traefik

I'm have a very little idea, how traefik works, so my advices try to setup DocumentServer without it, to determine if it's the problem reason

Also as I mention above - I have no idea about FileRun, and maybe problem on it's side - maybe you should keep traefik settings and try to setup nextcloud with DocumentServer, instead of FileRun, to be sure that FileRun has nothing to do with your problem

In general your setup is pretty complicated, and my only real advice - try to simplify it, find a config there everything is working and compare thos configs service-by serbice

zilexa commented 3 years ago

Actually, my docker-compose is identical to the one here in this github! It is simply copy-paste :) Have a look for yourself: https://github.com/ONLYOFFICE/Docker-DocumentServer/blob/master/docker-compose.yml This should be the "minimal" Compose right?

With complicated you might mean the Labels section, which is extra complicated because DocumentServer needs that much, no other container behind https needs all of that. This is by trial and error and input from the Traefik forum.

Also, I already tried without https (no traefik). Same issue. But I can try that again. I have also opened a ticket on feedback.filerun.com but they are a bit slow to respond. You were fast :) Anyways thanks for the support so far. I will post if I make progress/find the solution via Filerun forum.

zilexa commented 3 years ago

Also, with the docker-compose.yml in this repository, why does the server listen to 8080? This is not documented. It should listen to 80. So this seems like a bug. And the fact that Onlyoffice shows "unknown error" but the err.log is empty --> how is that possible? Regardless of its cause.. it should be in a logfile right?

ShockwaveNN commented 3 years ago

This should be the "minimal" Compose right?

Yeah, it's pretty minimal

Also, I already tried without https (no traefik)

Ok, in that case we can rule out traefik

why does the server listen to 8080

This is not Documentserver itself, it's some of our sub-service, by default DocumentServer listens to 80, but we got some other services inside this container, like docservice, spellcheker, convertservice...

And the fact that Onlyoffice shows "unknown error" but the err.log is empty --> how is that possible?

I think this is mean that error happen not on backend, but somethere on front-end, but I'm not 100% sure

zilexa commented 3 years ago

The issue has its root here: https://github.com/ONLYOFFICE/Docker-DocumentServer/issues/254 So we can close this one as duplicate.

But poor documentation about how to use DocumentServer with Traefik labels did not help either. I have eventually, after spending hours and weekends of trial and error, figured out the workaround:

##_____________________ OnlyOffice Document Server [Cloud/Office]
  onlyoffice:
    image: onlyoffice/documentserver
    container_name: onlyoffice
    depends_on:
      - onlyoffice-rabbitmq
    stdin_open: true
    restart: always
    tty: true
    ports:
      - "8889:80"
    volumes:
      - $USERDIR/docker/onlyoffice/data:/var/www/onlyoffice/Data
      - $USERDIR/docker/onlyoffice/log:/var/log/onlyoffice
      - $USERDIR/docker/onlyoffice/cache:/var/lib/onlyoffice/documentserver/App_Data/cache/files
      - $USERDIR/docker/onlyoffice/example:/var/www/onlyoffice/documentserver-example/public/files
      - $USERDIR/docker/onlyoffice/fonts:/usr/share/fonts
    dns: 1.1.1.1
    environment:
      - JWT_ENABLED="true"
      - JWT_SECRET=$ONLYOFFICEJWT
      - AMQP_URI=amqp://guest:guest@onlyoffice-rabbitmq
    labels:
     ## My standard traefikv2.0 labels for services exposed online:
      - traefik.enable=true
      - traefik.http.routers.office-redirect.entrypoints=web
      - traefik.http.routers.office-redirect.rule=Host(`office.$DOMAIN`)
      - traefik.http.middlewares.office-redirect.redirectscheme.scheme=https
      - traefik.http.routers.office.middlewares=office-redirect
      - traefik.http.routers.office-secure.entrypoints=websecure
      - traefik.http.routers.office-secure.rule=Host(`office.$DOMAIN`)
      - traefik.http.routers.office.tls.certresolver=letsencrypt
      - traefik.http.services.office.loadbalancer.server.port=80
      ## Extra labels required for onlyoffice:
      - traefik.http.routers.office-secure.tls=true
      - traefik.http.routers.office-secure.middlewares=secure-headers
      - traefik.http.middlewares.secure-headers.headers.customrequestheaders.X-Forwarded-Proto=https
      - traefik.http.middlewares.cors-headers.headers.accessControlAllowOrigin=*
      - traefik.http.routers.office.middlewares=secure-headers,cors-headers

      ## tested extra labels, works fine without DO NOT USE
      #- traefik.http.middlewares.office-redirectregex.redirectregex.regex=^http://(.*)
      #- traefik.http.middlewares.office-redirectregex.redirectregex.replacement=https://$$1
      #- traefik.http.middlewares.secure-headers.headers.referrerPolicy=no-referrer
      #- traefik.http.middlewares.secure-headers.headers.stsSeconds=31536000
      #- traefik.http.middlewares.secure-headers.headers.forceSTSHeader=true
      #- traefik.http.middlewares.secure-headers.headers.stsPreload=true
      #- traefik.http.middlewares.secure-headers.headers.stsIncludeSubdomains=true
      #- traefik.http.middlewares.secure-headers.headers.browserXssFilter=true

Also: I accidentally removed my postgreSQL container, discovered OnlyOffice still worked without it !? Not sure how, but now OnlyOffice runs, just with rabbitmq as additional container. Perhaps the onlyoffice/documentserver image already contains a sql database:

##____________________ Onlyoffice rabbitmq [CLOUD/Office]
  onlyoffice-rabbitmq:
    container_name: onlyoffice-rabbitmq
    image: rabbitmq
    restart: always
    expose:
      - '5672'