Problem: You want off Google Docs, but the CODE server for Nextcloud is abysmally slow on the official nextcloud docker and doesn't work at all on the Linuxserver Nextcloud container that most of us are using. The solution is to host your own Collabora Office container and route it through through your Nextcloud install.
Prerequisite:
You have docker installed and running (this should probably go w/o saying)
You have successfully gotten a cert with swag. It doesn't matter if you're using duckdns, dns, cloudflare, whatever.
Because you're using swag, the below will assume you're using the Linuxserver version of Nextcloud (it may work with the official container as well, I don't know)
You have Nextcloud running through swag and can securely access it at https://nextcloud.yourdomain.url . This will go over in detail using subdomains. It can probably be modified to use subfolder, I've just never used it in that manner and you're on your own with it. You will also need admin privileges on the Nextcloud install
You are comfortable either using Portainer Stacks or docker-compose. I'll be proceeding using a stack in Portainer, but it should work just the same with docker-compose.
You can identify the network mode of your swag container. In Portainer click on Networks and find the network name assigned to your swag container. In my case, it's "swag_default". If you don't have Portainer, you can use the following command to get swag's network mode (below assumes your swag container is named "swag")
You should get an output similar to this... which I dentifies swag's network mode.
root@openmediavault:~# docker inspect swag | grep NetworkMode
"NetworkMode": "swag_default",
root@openmediavault:~#
Finally, I'm using the 64bit version of Nextcloud. This should work well w/ arm64 (the collabora container says it has am arm64 image).. but I've not ever set it up.
Installation:
Log in to Nextcloud as an admin user.
Click your profile icon/Apps, and do a search for CODE. Completely uninstall the built in CODE server app. This is the default Collabora app on Nextcloud and is generally installed automatically on all new installs. If you don't uninstall it, it makes a mess in the GUI when this is done.
Update on this part: My apologies on this next step. I somehow had originally combined my docker-compose for onlyoffice and collabora. The original I had here will not work for Collabora, but would with OnlyOffice. THIS one works with Collabora. Issue with OnlyOffice, is it doesn't allow access from mobile devices, where Collabora does. The below codebox is correct. Again, sorry.
Next, go to Portainer, Add a new stack and name it collabora. Paste the following into the stack:
version: "2.2"
services:
collabora:
image: collabora/code
container_name: collabora
network_mode: swag_default #Adjust
ports:
- 9980:9980
As the compose states, set your network mode (Line 6).
Once it deploys, watch the log and see if it flags any errors. When the container finishes deploying, go to https://your-server-ip:9980 . You'll get a security risk message, just accept it since we aren't open to the internet yet... Once accepted, you should just see a message that says "OK". This means the collabora container is working.
Now, cd to your proxy-confs folder under swag. We need to create a new one.
Now we need to create a collabora.subdomain.conf file and edit it. We can do that with:
Once it opens, copy/paste this in it's entirety.
## Version 2021/05/18
# REMOVE THIS LINE BEFORE SUBMITTING: The structure of the file (all of the existing lines) should be kept as close as possible to this template.
# REMOVE THIS LINE BEFORE SUBMITTING: Look through this file for <tags> and replace them. Review other sample files to see how things are done.
# REMOVE THIS LINE BEFORE SUBMITTING: The comment lines at the top of the file (below this line) should explain any prerequisites for using the proxy such as DNS or app settings.
# make sure that your dns has a cname set for <container_name> and that your <container_name> container is not using a base url
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name collabora.*;
include /config/nginx/ssl.conf;
client_max_body_size 0;
# enable for ldap auth, fill in ldap details in ldap.conf
#include /config/nginx/ldap.conf;
# enable for Authelia
#include /config/nginx/authelia-server.conf;
location / {
# enable the next two lines for http auth
#auth_basic "Restricted";
#auth_basic_user_file /config/nginx/.htpasswd;
# enable the next two lines for ldap auth
#auth_request /auth;
#error_page 401 =200 /ldaplogin;
# enable for Authelia
#include /config/nginx/authelia-location.conf;
include /config/nginx/proxy.conf;
include /config/nginx/resolver.conf;
set $upstream_app 192.168.1.166;
set $upstream_port 9980;
set $upstream_proto https;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
# REMOVE THIS LINE BEFORE SUBMITTING: Additional proxy settings such as headers go below this line, leave the blank line above.
}
# REMOVE THIS LINE BEFORE SUBMITTING: Some proxies require one or more additional location blocks for things like API or RPC endpoints.
# REMOVE THIS LINE BEFORE SUBMITTING: If the proxy you are making a sample for does not require an additional location block please remove the commented out section below.
# location ~ (/<container_name>)?/api {
# include /config/nginx/proxy.conf;
# include /config/nginx/resolver.conf;
# set $upstream_app <container_name>;
# set $upstream_port <port_number>;
# set $upstream_proto <http or https>;
# proxy_pass $upstream_proto://$upstream_app:$upstream_port;
#
# # REMOVE THIS LINE BEFORE SUBMITTING: Additional proxy settings such as headers go below this line, leave the blank line above.
}
Display More
If you've not made any changes, etc.. and followed along exactly what I've put in this post, the only line you need to change is #37. Change that to your server's network IP
Cntrl X, Y, then enter to save
If you're using duckdns, you can skip this step. Log in to your panel, and create a CNAME "collabora". It may take a few minutes for the CNAME to go active. Make sure you can ping it at ping collabora.your-domain.url (cntrl C to stop).
Once your CNAME responds to a ping go to your swag stack in Portainer and add "collabora" to your subdomains list. If you're using SUBDOMAINS=wildcard then you don't need to do this.
Now all users (including duckdns) Redeploy swag. Watch the log and make sure you get no errors. If you've defined your subdomains, make sure a new cert is pulled w/o error. Once it's done, go to https://collabora.yourdomain.url and you should now get the "OK" message, and the site is secured with a padlock. If it's not, you did something wrong and you need to fix it before proceeding or the next steps won't work.
Now, go back to Nextcloud as an admin user, click your profile icon and then apps. Do a search for Nextcloud Office and install it.
Now go back out to your folders, and create a folder to hold Templates. Doesn't matter what you name it, where you put it, etc.. just create one.
Once that is done, go to your profile icon/settings. Under Personal, click on Office. Set your templates folder to the one you just created. Each user will have their own templates folder. So if you have multiple users that want to use NC Office... each one will need to create a templates folder and set it here (assuming they want to use the NC Office templates).
Now under Administration on the same page, click on Office. On the top, CODE should be grayed out if you uninstalled CODE.. if you didn't, do it now otherwise it gets screwy with the GUI. Choose Use your own server
Where it asks for the domain... https://collabora.yourdomain.url
Uncheck the disable certificate box, and click Save. You should get a Green Check mark and a message the collabora server is reachable.
Now go back out to the Nextcloud files section, click the + and choose an office document to create (or if you already have one, you can click it should open in NC Office).
NC Office works very similarly to Google Docs. It constantly saves your document, so most progress is not lost if the browser is closed, etc. for some reason.
Fixing "Permission Denied" issues:
Recently, although the container was working absolutely fine... I noticed the log was getting flooded with "Permission Denied" errors (although the container seemed to work just fine, I could edit/save documents no problem, etc.). Some searching on their forum and github, I found some old threads this was an issue after an upgrade.
The simple solution, is to go to the Collabora container, click Duplicate/Edit, click on click on Runtime Resources tab and enable the button next to "Privileged Mode".
Conclusions:
I've been using NC Office for about 4-5mo before posting this (it's come up on reddit a number of times asking how to do this) and have been pretty happy with it. It seems plenty fast enough on my ancient server. I would not call myself a "heavy" user, but I've gotten a fair amount of use out of it and have been happy with it.
Hope this helps