Integrate OnlyOffice as Docker Container in Nextcloud on a Synology DiskStation (DSM 7.2 and higher)

OnlyOffice as an integrated office solution has now been replaced by Collabora. If you prefer OnlyOffice over Collabora, you can deploy OnlyOffice as a Docker container with little effort (provided you have an appropriate DiskStation). However, if you stick with the free license, you will have to be content with a read-only mode on mobile devices. Mobile editing is only possible with the commercial license.

Prepration

Before we get started, here is a small checklist of things you will need.

  • Nextcloud, installed on the DiskStation, you can find the instructions in this article. Nextcloud runs directly on the DiskStation web server. You can also deploy OnlyOffice as a Docker container on DiskStation for a Nextcloud installation on another device or Nextcloud as a Docker container. In these cases, however, additional configuration may be necessary to ensure communication with the container.
  • A DiskStation with Container Manager (Docker) installed. You can find this in the Package Center. If this is not the case, your DiskStation is either not compatible or you have DSM 7.1 or lower installed. In the latter case the package is still called Docker.
  • Folders for the container, usually these folders are created in the shared /docker folder. Create a folder onlyoffice there, and in it the two folders data and log.
  • You need a valid subdomain that you use exclusively for OnlyOffice.

Setup

Make sure that the following instructions are what you want to achieve. Nextcloud is installed directly on the DiskStation, only OnlyOffice is provided via Docker.

Provide OnlyOffice as Docker container

Open the Container Manager on your DiskStation and go to the Registry area. Use the search field to search for “onlyoffice”. Make sure you download the correct image. You need onlyoffice/documentserver. The “communityserver” image does not contain any Office editors, but provides functions that, in our case, are taken over by Nextcloud.
Highlight the image and click Download. Now select the version you want.

[IMAGE Registry]

The Container Manager switches to the Image area and begins the download. After the image has been downloaded, highlight it and click Run. A dialog guides you through the creation of a container.

First you give the container any name you want. You can also limit the resources for the container if you want. When idle, the container requires virtually no CPU power, but a few hundred MB of RAM (values can increase depending on usage). How much resources the container requires during operation, depends on how many documents are being processed at the same time or how many users access them.

Activate the check mark for “Enable automatic restart”. If the container is not terminated properly due to errors or, for example, a DiskStation crash, it will be restarted automatically. Then click on Next.

First you have to map the internal container ports (443 and 80) to local ports. This is necessary because the container should not run in the host network (i.e. your DiskStation), but in its own network. Assign the local ports manually. Selecting “Automatically” can mean that the container is not always assigned the same port number when starting, but this is important for connecting OnlyOffice to your Nextcloud. Since 80 and 443 are already used by your DiskStation’s web server, you will have to enter numbers yourself that are not yet used. Next you have to mount the folders you created at the beginning. Under “Volume Settings” click Add Folder and select the prepared data folder (/docker/onlyoffice/data) and click Select. Enter /var/www/onlyoffice/Data in the text field. Repeat the step for the /docker/onlyoffice/log folder and enter /var/log/onlyoffice. Then check whether the variable “PRODUCT_EDITION” is entered without a value under “Environment”, if so, delete the variable.
You also add a new variable “JWT_SECRET” and assign a secure password as value. You can use this password to additionally secure the OnlyOffice container, more on this later. If you don’t want to use the password, you have to insert the variable “JWT_ENABLE” with the value “false”. Scroll down a little and select “bridge” under “Network”. No further settings are necessary. After clicking Next you will see a summary. Click Done and the container will start.

[IMAGE Containter]

[IMAGE Containter]

[IMAGE Containter]

Go to the Container area, you should now find your Onlyoffice container there. Mark the container and then click on Details. You can view the output of the container in the Log tab. It takes some time to start and requires some resources. Waiting for the message "server is up INFO". The container is now ready for use.
If you can’t find this line, you’ll have to wait a little longer. The output log does not update automatically. Go back to the container overview and reopen the log to get the updated output.

Setup the reverse proxy

Your container is now accessible at any address where your DiskStation can be reached + the local ports. If your DiskStation can be reached via a domain that is secured with an SSL certificate, that would be enough. In order to be able to access documents from outside, you would have to enable the local port on the router. It is therefore better to set up a reverse proxy with its own subdomain. Then only the HTTPS port on the router needs to be forwarded. This should already be the case if you can access your cloud from outside. You can find out more about port sharing, certificates and external accessibility in this article.

Open the Control Panel and go to the Login Portal > Advanced > Reverse Proxy area. Click on Create and give it any name you want. Under Source select “HTTPS” and enter the subdomain and enter 443 as the port. Additionally activate HSTS. You can leave “HTTP” as the destination and enter “localhost” as the host name. Use the container’s local HTTP port as the destination port. Make sure you enter the port number you assigned yourself for the container and NOT the default port number 80. Then click Save.

[IMAGE RP]

Now you need an SSL certificate for your subdomain. After creating the certificate, you also have to assign this to the reverse proxy (Control Panel > Security > Certificate > Settings).

[IMAGE Cert]

The OnlyOffice container is now accessible via its own SSL-secured subdomain. Test this by entering https://eure-sub-domain.com in the browser.

[IMAGE test]

Configure Nextcloud

After we have prepared everything, it is time to set up OnlyOffice in Nextcloud. If you are already using the integrated version of Collabora, you must first uninstall or at least deactivate the Community Document Server and Nextcloud Office apps. You also have to deactivate the latter if you have previously used Collabora as a Docker container.
To do this, go to the app area in the settings menu. The ONLYOFFICE app is still required. If you haven’t used the apps yet, download ONLYOFFICE in the app area (found under “Office & Text”).

[IMAGE app]

Then go to the administration settings and there to the ONLYOFFICE area. Under “The address of ONLYOFFICE Docs” you simply replace the specified domain with the sub-domain for the Only Office container and under “Secret key” you enter the password that you set for the container with JWT_SECRET. The password is not for individual users but for the application(s) that should and are allowed to communicate with OnlyOffice. An application can only establish a connection with the OnlyOffice container with the correct password.
Then click on Save. You can also make various settings for OnlyOffice at this point.

[IMAGE NC OO]

That’s it. You can now open and edit Office documents directly in the cloud, even with multiple users at the same time. As already mentioned, editing is limited to the browser.

[IMAGE Doc]

Would you like more detailed step-by-step instructions for your Synology NAS, with a lot more background information, tips and tricks? Then get my knowledge as a comprehensive practical manual. You won’t find more information in any book about Synology and everything in the quality you always get from me.

Die 3rd Edition contains uptades for DSM 7.1 and the revised Web Station, Surveillance Station and Synology Photos.

The book directly from the publisher (German only).

Leave a Reply

Your email address will not be published. Required fields are marked *