Integrate Onlyoffice in Mattermost

Hi, i’m a student working on a project to create a social network with document handling capabilities. After some research, i’ve found that i can use OnlyOffice integrated with Mattermost.

Here’s what i have so far:

  • A virtual private server
  • A domain name
  • Self-signed certificates for the domain from Let’s Encrypt
  • A Mattermost installation with Docker (which also provides an Nginx configuration)
  • Mattermost is on port :8065
  • Nginx on :443 and :80

I need to add OnlyOffice to this setup, preferably as a Docker installation.

I’ve made two attempts both related to guides for installing OnlyOffice with docker, but i wasn’t able to get it working in either case. In both instances, i used the same virtual private server and domain name (making sure to choose available ports), for document server i’ve used 8443:443 and 8081:80.

  1. Using “docker run" this guide, i was able to run OnlyOffice over HTTPS. However, when i tried to connect the plugin in Mattermost, it didn’t work.
  2. Using “docker compose" this guide, OnlyOffice only runs over HTTP and i couldn’t get it to work over HTTPS. When i tried to connect to the plugin in Mattermost, it worked. I saw the “Open file in OnlyOffice” and “change access right” options with the new document icon, but when i tried to open a document, the editor didn’t show up and displayed a “something went wrong” message.

I apologize for the lengthy message, but i’m trying to make things as clear as possible. I also know that I’ve not posted any error or log, but i thought that it would be better to first choose which installation to go with. So, my questions are:

  • Is it possible to make this setup work using the same virtual private server and domain name?
  • Which installation method would you recommend?

Hi @Vincenzo

  1. We recommend separating the Document Server and Document Manager onto different servers.
  2. The Document Server address must be accessible from the user’s browser and from the Mattermost server. Additionally, the Mattermost server address must be accessible from ONLYOFFICE Docs for correct functionality.
  • Verify the functionality of ONLYOFFICE Docs by launching the provided example.
  • Ensure mutual accessibility between Mattermost and ONLYOFFICE Docs.

I want to highlight that you are the first on the forum to integrate Mattermost!
Tag your topic with “Mattermost” for visibility.

  • What information is available in the browser’s console tab?
  1. Open or create a new document and wait for the page to fully load.
  2. Open the browser console (F12) and reload the page while keeping the console open.
  3. Take screenshots of any error entries found in the Console and Network tabs.
  • Additionally, please provide the logs (Use a third-party storage solution) from the document server located at /var/log/onlyoffice/documentserver/ (in container) .

Hi @Nikolas, thanks for your reply.

I may ask if i can get another vps, as for now, i’m trying using what i have.

I have set up a new installation using Docker Compose as mentioned in the initial message, and the editor is functioning properly, but only in http, in fact, to access the Document editor i’m using → http://[server-ip]:[port].

In Mattermost, with this configuration, the plugin result as enabled:
Screenshot 2024-03-15 163444

The plugin run only if i define the address as follow → http://[server-ip]:[port] (the same i use to access through browser) any other address made the plugin to stop.

Now if i try open a document in Mattermost by clicking on “Open file in Onlyoffice” the “Something went wrong” occur and in browser console:


The error confirms that the issue is related to HTTPS. However, as i mentioned earlier, i’m struggling to figure out how to enable it.

I’m using PuTTY for communicating with the server, after entering in the container at the given path there are those files, but they seems to be outdated, since i’m trying right now.
Screenshot 2024-03-15 170406
Also nginx.error.log is empty.

I apologize if the situation seems chaotic. This is my first time dealing with these configurations and I’m feeling a bit lost.

@Vincenzo

Mixed protocol error occurs because Mattermost server and DS use different secure protocols. To resolve the problem, you need to switch DS to HTTPS protocol.

To add HTTPS, In the Docker-DocumentServer directory, in the docker-compose.yml file, Add the parameters:

  • LETS_ENCRYPT_DOMAIN=your_domain
  • LETS_ENCRYPT_MAIL=your_mail

Where:

LETS_ENCRYPT_DOMAIN - the domain name to use for the certificate.
LETS_ENCRYPT_MAIL - the email used for registration and recovery contact.

It looks like this:

Hi @Nikolas, thanks again for your reply!
Apologies for not noticing these environment variables earlier.
So, to effectively switch OnlyOffice to HTTPS while staying on the same VPS, is it sufficient to specify another subdomain (distinct from the Mattermost subdomain) in the provided environment variables within the docker-compose.yml file?
So, the configuration would include:

  • One VPS
    
  • Two subdomains
    
  • Mattermost with its own nginx configuration running on one subdomain
    
  • OnlyOffice with its own nginx configuration running on the other subdomain
    

Would this solution work?
Also, do i need to install certificates with Certbot before executing the container, or will Certbot handle the testing when i start the container?
Additionally, i apologize for the numerous questions, but could you tell me if certificates auto-renew, or if i need to add a function to handle this?

Thank you for your time.

Hi @Vincenzo

  1. Yes, it should work if you properly proxy the traffic.

Using ONLYOFFICE Docs behind the proxy

I still need to mention that we usually recommend installing the document server on a separate server to avoid port conflicts and dependencies.

  1. Certbot will handle everything automatically. You just need to set the variables as I described earlier.

Also, I should note that Certbot uses port 80 for certificate issuance. We’ve discussed this topic before:

  1. This topic has already been raised: Auto renewal of Let’s Encrypt certificates in Docker
1 Like