Onlyoffice and seafile

so ive tried to get only office going with seafile v12 but can’t get it working

when i try to open a .doc file or similar i get in the console:

   GET https://seafile.mydomain.com:6233/web-apps/apps/api/documents/api.js net::ERR_CONNECTION_TIMED_OUT

test.docx:337 Uncaught ReferenceError: DocsAPI is not defined



services:
  # caddy:
  #   ports:
  #     - ${ONLYOFFICE_PORT:-6233}:${ONLYOFFICE_PORT:-6233}

  onlyoffice:
    image: ${ONLYOFFICE_IMAGE:-onlyoffice/documentserver:8.1.0.1}
    restart: unless-stopped
    container_name: seafile-onlyoffice
    environment:
      #- DB_TYPE=${DB_TYPE:-mariadb}
      #- DB_HOST=${SEAFILE_MYSQL_DB_HOST:-db}
      #- DB_USER=${SEAFILE_MYSQL_DB_USER:-seafile}
      #- DB_PWD=${SEAFILE_MYSQL_DB_PASSWORD:?Variable is not set or empty}
      - JWT_ENABLED=true
      - JWT_SECRET=${ONLYOFFICE_JWT_SECRET:?Variable is not set or empty}
    volumes:
      - ${ONLYOFFICE_VOLUME:-/opt/onlyoffice}/logs:/var/log/onlyoffice
      - ${ONLYOFFICE_VOLUME:-/opt/onlyoffice}/data:/var/www/onlyoffice/Data
      - ${ONLYOFFICE_VOLUME:-/opt/onlyoffice}/lib:/var/lib/onlyoffice
    labels:
      caddy: ${SEAFILE_SERVER_PROTOCOL:-http}://${SEAFILE_SERVER_HOSTNAME:?Variable is not set or empty}:${ONLYOFFICE_PORT:-6233}
      caddy.reverse_proxy: "{{upstreams}}"
    networks:
      - seafile-net

networks:
  seafile-net:
    name: seafile-net

ive also added in seahub_settings.py

ENABLE_ONLYOFFICE = True
ONLYOFFICE_APIJS_URL = ‘https://seafile.mydomain.com:6233/web-apps/apps/api/documents/api.js
ONLYOFFICE_FILE_EXTENSION = (‘doc’, ‘docx’, ‘ppt’, ‘pptx’, ‘xls’, ‘xlsx’,
‘odt’, ‘fodt’, ‘odp’, ‘fodp’, ‘ods’, ‘fods’, ‘csv’, ‘ppsx’, ‘pps’)
ONLYOFFICE_JWT_SECRET = ‘secret’

ive commented out the caddy stuff because i think i dont need it?? i tried it with it and still got same error.

Hello BananaElf9,

This problem seems from the port of Onlyoffice you still not open, that means Seafile cannot access the Onlyoffice service (an error message ERR_CONNECTION_TIMED_OUT). Due to access policy restrictions of Onlyoffice, you have to make sure the service is accessible on the public network (either Docker internal private network does not work), as you can test the link below to check it (just using browser is fine).

https://seafile.mydomain.com:6233/web-apps/apps/api/documents/api.js

In your situation (i.e., you wouldn’t like to use Caddy), you should add a property in your YML, for service onlyoffice:

services:
  onlyoffice:
    ports:
      - ${ONLYOFFICE_PORT:-6233}:${ONLYOFFICE_PORT:-6233}

Then restart your server and test the above link. If your Onlyoffice extension is still not accessible, you can follow here to redownload the YML file, or report to us if any other new exceptions detected.

Good luck,

@BananaElf9

Just to confirm:

  • Are the firewall ports opened on the machine?
  • Do you have the Nginx configuration setup for this? (Happy to post mine if needed)
  • Have you allowed the Seafile user access to the Docker Container for OnlyOffice? (I run mine using the same account to avoid any of these issues).

Looking forward to hearing from you!