Install Collabora Online with Docker on Ubuntu in ZenTao

in #collabora4 years ago

Collabora Online is a powerful LibreOffice-based online office that supports all major document, spreadsheet, and presentation file formats, which you can integrate into your own infrastructure. It's available to enable it in ZenTao easily.

image.png

Step 1: Install Docker on Ubuntu
For simplicity, this tutorial installs Docker from the default Ubuntu software repository.

sudo apt update
sudo apt install docker.io
Once installed, the Docker daemon should be automatically started. You can check its status with:
systemctl status docker

image.png

Hint: If the above command doesn’t quit immediately, you can press the Q key to make it quit.
If it’s not running, then start the daemon with this command:
sudo systemctl start docker
And enable autostart at boot time:
sudo systemctl enable docker
Step 2: Install and Run Collabora Online Server with Docker
Execute the following command to pull the latest Collabora Online Development Edition image from Docker hub.
sudo docker pull collabora/code

image.png

Then start a new container, for example:

sudo docker run -t -d -p 0.0.0.0:9980:9980 -e "domain=example\.com" -e "username=admin" -e "password=123456" --restart always --cap-add MKNOD collabora/code
Replace example\.com with your server/ZenTao hostname, preserving the double slashes. This is because Collabora only allows known hosts to access its service and we need to add the server/ZenTao hostname to the whitelist with the domain= parameter.

-d: Detached mode makes the container run in the background.
-t: Allocate a pseudo-TTY
-p: Publish a container’s port to the host.
-e: Set environment variables

The Collabora Online server will be listening on port 9980 of localhost (127.0.0.1) as can be shown by issuing the following command. (If your Ubuntu system doesn’t have the netstat command, you can install it with sudo apt install net-tools.)

sudo netstat -lnpt | grep docker
Since I am using

sudo docker run -t -d -p 0.0.0.0:9985:9980 -e 'domain=192\.168\.2\.111' -e "username=admin" -e "password=123456" --restart always --cap-add MKNOD collabora/code

image.png

So I get this result

image.png

Go to the browser and visit https://your domian:9985 (Since SSL is enabled by default, so you have to visit by HTTPS if you haven't edited the configuration file of Collabora Online ), you will get an "OK" page.

image.png

Since my ZenTao is not running with SSL, so I need to configure loolwsd.xml to disable SSL. ( If ZenTao is running with SSL, then Collabora has to run with SSL as well, it's the same if ZenTao disables SSL. Otherwise, Collabora Online will not be enabled successfully in ZenTao )

Step 3: Use the configuration file directly to set Collabora Online

After starting the container, you can copy the configuration file out of the container, edit it, and copy it back to the container. The container will notice that the configuration file has changed, and the service will be restarted (don’t forget the –restart always an option when you start the container with docker run).

  1. Find out the name or hash of your container:
    $sudo docker ps
    The output would be something like this:
    CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
    e4212ca0e6d6 collabora/code "/bin/sh -c 'bash st…" 25 minutes ago Up 25 minutes 0.0.0.0:9985->9980/tcp admiring_sinoussi
  2. Copy out the config file:
    $sudo docker cp admiring_sinoussi:/etc/loolwsd/loolwsd.xml loolwsd.xml
    To disable SSL, make sure you have edited value for SSL settings as "false"

<desc="SSL settings">
<as_scheme type="bool" default="true" desc="When set we exclusively use the WOPI URI's scheme to enable SSL for storage">false</as_scheme>
<type="bool" desc="If as_scheme is false or not set, this can be set to force SSL encryption between storage and loolwsd. When empty this defaults to following the ssl.enable setting"></>
<desc="SSL settings">
<type="bool" desc="Controls whether SSL encryption between browser and loolwsd is enabled (do not disable for production deployment). If default is false, must first be compiled with SSL support to enable." default="true">false</>

  1. Edit the config file with your favorite editor, then save and copy it back to the container:
    $sudo docker cp loolwsd.xml admiring_sinoussi:/etc/loolwsd/loolwsd.xml
    Wait a few seconds for the automatic restart.

You might meet the problem that the container could not restart successfully and logs is as the following,

image.png

Getting CA Private Key
Can't open /etc/loolwsd/loolwsd.xml: Permission denied.
Can't open /etc/loolwsd/loolwsd.xml: Permission denied.
Can't open /etc/loolwsd/loolwsd.xml: Permission denied.
Can't open /etc/loolwsd/loolwsd.xml: Permission denied.
Can't open /etc/loolwsd/loolwsd.xml: Permission denied.
/etc/loolwsd/proof_key exists already.
Setting up watches.
Couldn't watch /etc/loolwsd/loolwsd.xml: Permission denied
-rw-r----- 1 root root 18191 Dec 7 01:42 /etc/loolwsd/loolwsd.xml modified --> restarting
Try with the following commands to fix the problem by chown because of "Permission denied"
sudo docker stop admiring_sinoussi
sudo docker start admiring_sinoussi
sudo docker exec -it -u root admiring_sinoussichown lool:lool /etc/loolwsd/loolwsd.xml
And then visit http://192.168.2.111:9985, you will get an "OK" page if you succeed.

image.png

Step 4: Set up in ZenTao
Go to Admin - Integration - Office to enable LibreOffice and Check "Collabora Online", for Collabora Path, just fill in with the exact address and port number for your Collabora Online.

image.png

Go to Doc in ZenTao and create a Word file to see if it's working.

image.png

image.png

Open "test sprint doc"

image.png

If you check Track Changes with "Record", you could roll back editting by you or your teamates in Track Changes - Manage

image.png

image.png

References

https://www.linuxbabe.com/cloud-storage/integrate-collabora-online-server-nextcloud-ubuntu

https://www.collaboraoffice.com/code/docker/

Coin Marketplace

STEEM 0.17
TRX 0.25
JST 0.034
BTC 98337.13
ETH 2739.26
SBD 0.63