Configuring ONLYOFFICE
This guide helps to install and configure ONLYOFFICE with OpenKM.
ONLYOFFICE is WOPI compliant. Read the specification at https://wopi.readthedocs.io/projects/wopirest/en/latest/index.html
ONLYOFFICE documentation: https://api.onlyoffice.com/editors/wopi/
ONLYOFFICE installation
First find out the IP address of the computer, e.g. 192.168.1.38 Henceforth, we will use this IP for this guide.
Run the following commands to install the Docker container:
- Download the script:
$ wget http://download.onlyoffice.com/docs/docs-enterprise-install.sh
- Run the script:
$ bash docs-enterprise-install.sh -skiphc true -dp 8082
Configuration
Within the docker container, edit /etc/onlyoffice/documentserver/default.json. After that, the service needs to be restarted: supervisorctl restart all.
WOPI has to be enabled manually by editing this default.json, and you need to set "wopi" parameter to true.
ONLYOFFICE access
Test it in your web browser: http://192.168.1.38:8082/
Discovery:
- Open your web browser and run the following URL: http://192.168.1.38:8082/hosting/discovery
Capabilities:
- Open your web browser and run the following URL: http://192.168.1.38:8082/hosting/capabilities
WOPI validator
This is an optional step.
This is for validating the REST endpoints of the WOPI host (OpenKM).
- Install it:
docker pull tylerbutler/wopi-validator
- Run it:
docker run -it --rm tylerbutler/wopi-validator -- -w http://localhost:8080/openkm/wopi/files/80ffd1eb-a6b8-4ec2-adc1-a58b23815eaf -t <openkm token> -l 36000000
80ffd1eb-a6b8-4ec2-adc1-a58b23815eaf is the UUID of a document in OpenKM.
OpenKM configuration
Edit the following configuration parameters in OpenKM administration:
ONLYOFFICE source IP is in a Docker network range, usually like 172.17.x.x, so this IP should be the one configured at onlyoffice.ip configuration parameter. The authentication token used between ONLYOFFICE and OpenKM is restricted by IP, which means only the IP of ONLYOFFICE will be able to use it.
If unsure about ONLYOFFICE IP, look into the log file for an error message like "Error validating token IP where {} != {}", or enter the docker container (docker exec -it name_container bash) and see the IP: cat /etc/hosts
# value samples
online.office.action.url = http://192.168.1.38:8080/openkm/wopi/files
online.office.url = http://192.168.1.38:8082/hosting/discovery
online.office.ip = 172.19.0.2
extension.extra.tab.workspace = Online Editor;/openkm/onlineOffice/onlyoffice
Parameters:
- online.office.action.url: URL used by ONLYOFFICE Docker container to connect to OpenKM WOPI REST endpoint.
- online.office.url: URL used by OpenKM to connect to ONLYOFFICE Docker container.
- online.office.ip: Source IP used by ONLYOFFICE to authenticate to OpenKM.
- extension.extra.tab.workspace: to access from the top main menu in the OpenKM user interface.
For information on how to enable the parameter named "extension.extra.tab.workspace", take a look at Extra tab workspace extension and Enable extensions sections in the documentation.
Sample URLs:
- http://localhost:8080/openkm/onlineOffice/onlyoffice?uuid=02090e71-8283-43d7-be2a-d6f141c3f8b0
- http://192.168.1.38:8080/openkm/onlineOffice/onlyoffice?uuid=02090e71-8283-43d7-be2a-d6f141c3f8b0
- http://192.168.1.38:8080/openkm/onlineOffice/onlyoffice?uuid=02090e71-8283-43d7-be2a-d6f141c3f8b0&lang=en-gb