Collaboration with Nextcloud documents

nextcloudONLYOFFICE allows you to edit documents in the browser. To use ONLYOFFICE, you will need an ONLYOFFICE Document Server. This article describes how to install the open source Community Edition of ONLYOFFICE Document Server, using Docker, which could be deployed in-house or on AWS.


Prerequisites

You Docker server will need the following:

  • CPU: dual core 2 GHz or better
  • RAM: 2GB or more
  • HDD: at least 2GB of free space
  • Swap: at least 4GB of swap

If you are building an AWS EC2 Docker instance, t3a.small is a good starting point.

 

Docker Volumes

It is best practice to store data outside the container, so that you can upgrade ONLYOFFICE with minimal disruption. By default the data is stored at the following locations inside the container:

  • /var/log/onlyoffice for Document Server logs
  • /var/www/onlyoffice/Data for certificates
  • /var/lib/onlyoffice for file cache
  • /var/lib/postgresql for database

We will create four Docker Volumes to support the above directories:

  • onlyoffice_logs
  • onlyoffice_data
  • onlyoffice_lib
  • onlyoffice_db

 

Install Document Server

Start by logging on to Docker. Note that when performing a Snap install of Docker on Ubuntu, volumes are mounted in /var/snap/docker/common/var-lib-docker/volumes and not /var/lib/docker as referenced below.

  1. Run the following command.
sudo docker run --name=onlyoffice -i -t -d -p 443:443 -p 80:80 --restart=always \
-v /var/lib/docker/volumes/onlyoffice_logs:/var/log/onlyoffice \
-v /var/lib/docker/volumes/onlyoffice_db:/var/www/onlyoffice/Data \
-v /var/lib/docker/volumes/onlyoffice_lib:/var/lib/onlyoffice \
-v /var/lib/volumes/onlyoffice_db:/var/lib/postgresql onlyoffice/documentserver

This command will name your container, it will open ports 443 and 80, which are both needed for SSL certificate installation. The Container will always try to run, except if you stop it manually. Finally, the onlyoffice directories will be mounted to the Docker Volumes.

 

SSL Certificate

You will need to create two DNS A records (e.g. onlyoffice.yourschool.org and www.onlyoffice.yourschool.org) and point them to the IP address of your host.

  1. Access your Docker host via Portainer.
  2. Access the onlyoffice container via the exec console.
  3. Install Certbot for NGINX.

Certbot is an application for using Let's Encrypt SSL certificates.

 

Configure Nextcloud

To finish this installation, you need to log on to your Nextcloud instance.

  1. Click your Avatar > Apps.
    1. Select the Office & text category in the left pane.
    2. Click the Download and enable button for the ONLYOFFICE connector.
  2. Click your Avatar > Settings.
  3. Select ONLYOFFICE in the left pane.
  4. Enter the URL for your new Document Editing Service address.

You should now find that you can edit documents inside Nextcloud.

 

Additional settings

Here are some further Nextcloud settings that you can make:

  • Restrict access to ONLYOFFICE for a selection of Nextcloud groups.
  • Select file formats to automatically open in ONLYOFFICE.
  • There's even a security watermarking feature.

 

Please see this article for further information on how to perform these steps.

 

Thanks for visiting.