Nextcloud & Onlyoffice via Docker - can't connect on the same server

Hey there :slight_smile:

Iā€™ve been trying to make works Nextcloud & OnlyOffice on the same server for the past few days without success.
Configuration :

  • Docker with Portainer,
  • Nextcloud (latest image available),
  • OnlyOffice (same as Nextcloud),
  • PostgreSQL (as the db of my nextcloud)
  • Nginx vanilla (non docker installed)

Everythingā€™s installed on the same server. (18.04)
My server is a local server, with ALL port opened on my box in order for me to access it from anywhere.

Everything seems to be fine, my nextcloud is working properly as I was able to install it normally. Then, same as my Onlyoffice. When I go on my https://document.domain.something/ (My nextcloud & onlyoffice are both in https) Iā€™m able to see :

Great, onlyoffice is working normally as well.
Now, when I try to connect my onlyoffice to my nextcloud I have :

**Error onlyoffice HealthcheckRequest on check error: cURL error 28: Connection timed out after 60000 milliseconds (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)**

Funny thing is : if I try to connect to my OnlyOffice via another nextcloud on another server, it works ! Iā€™m able to connect to my onlyoffice and open/create files with it. And If i try using it locally (with my 192.168.x.x:onlyofficeport) itā€™s working too, but it doesnā€™t when I try it by using my https://domain.something/ .

So far Iā€™ve tried :

  • looking at logs, but nothing is showing any kind of problem,
  • reinstalling everything from scratch,
  • create a new docker network and connecting all of my containers to it, but since thereā€™re already - connected via bridge this shouldnā€™t be an issue,
  • Adding the

ā€˜onlyofficeā€™ => array ( ā€˜verify_peer_offā€™ =>TRUE, ),

to my nextcloud, withtout any success either.

  • Connect my onlyoffice to another nextcloud server, somewhere else It works.

I hope you guys can gelp :slight_smile:

1 Like

Anyone? :frowning:

Perhaps there is a DNS Rebind issue in the (dhcp) router.
In my Fritz!Box I had to enter all domains that are forwarded to my local network machines in the Tab ā€˜Network Settingsā€™. At the bottom you see DNS Rebind Protection
I just entered the domain names and subdomains, one per line.
So there is a line ā€˜cloud.domain.extā€™ and ā€˜office.domain.extā€™.

Thanks for the answer, sadly, this didnā€™t solved it. Issueā€™s still here.
It almost seems like itā€™s not possible to have both (nextcloud and onlyoffice) on one and only one serverā€¦

your nextcloud server is inside a docker container or not ?

Yes it is, same container, same server

@syrosh any chance to run my playbook on your side? than you would get what want or your problem is outside your server. or you found a bug in my playbooks. that iā€™m happy to fix if i can.

please run it on a fresh ubuntu installation. not on the server where you setup your nextcloud. make backups and iā€™m not responsible. the usual disclaimer.

if you can read ansible/jinja2 you could just go through the playbook file and compare my config to yours.

update:

didnā€™t see this. my playbook would setup traefik as ingress router/reverse proxy. sorry. itā€™s not exactly your setup.

there is no need for a domain: document.domain.something everything runs on nextcloud.domain.something and there is no need to run documentserver on https. unless someone explains to me why if you run everything on a single machine. for my understanding tls termination is done by traefik(me)/nginx.vanilla(you). the rest of the communication is machine internal only.

1 Like

Iā€™ll try your playbook later today, thanks for replying :slight_smile:

I have exactly the same issue - i can reproduce your scenario.

When running nextcloud / onlyoffice on seperate servers, the Integration between those two works flawlessly.

When running nextcloud / onlyoffice on the same server, i get that ā€œtimeoutā€-issue and cannot save anything.

Did you find any solution on how to run both services on the same server via docker?

My setup:
-) Docker
-) Nginx-proxy (like traefik, containerized)
-) Nextcloud + ā€œonlyoffce-intregrationā€-app (containerized)
-) Documentserver (containerized)
-) DB: mariadb (containerized)

@syrosh any chance you figured something out?

Thank you very much :slight_smile:

If you add the same network to all containers you should be able to address them by the host name whereby the host name is the name of the container.
See attached example.

Thatā€™s reassuring that youā€™re getting the same errors to be honest, I was seriously starting to think I was crazy !
Sadly, no, I didnā€™t find anything yetā€¦

Iā€™ve tried to put them on the same network aswell (in docker).
Sadly, it didnā€™t worked. Thanks for your input anyway!

Hi,
I had a bug Ā« a bit similar Ā» : I could not save the Onlyoffice app settings in Nextcloud with NC and OO in 2 docker containers in the same machine (network mode bridge). My error message was a bit different : Ā« bad health check Ā» or Ā« error while downloading the document being converted Ā».
I could resolve it with adding the local IP and Domain names of both nextcloud and only office in the Ā« trusted domains Ā» array in NC config.php : [Onlyoffice] Error while downloading the document file to be converted ou encore ici : https://github.com/ONLYOFFICE/onlyoffice-owncloud/issues/181
So now I can save the settings !
But I still canā€™t open OO documents : when I click on a .docx doc in Files for example it says Ā« onlyoffice unreachable Ā».
I also found a page that could help : https://api.onlyoffice.com/editors/nextcloud
@edvinkuric and @syrosh what did you put in the 3 server fields Ā« external doc server Ā», Ā« internal doc server Ā» and Ā« internal NC server Ā» ? It could help to understand the pb

I had a similar issue long time ago.

The problem I ran into was the fact, that the docker container couldnā€™t connect ā€œoutsideā€ of its container directly to the host machine due to a DNS ā€œproblemā€ with docker.

My solution was the following:
I had to add --add-host=subdomain.domain.com:172.17.0.1 to the docker run command to allow the docker container to connect outside of the container to the ā€œhostā€ running nextcloud in my linux.

Here my complete command

docker run -i -t -d -p 8443:443 --restart=always --name=OnlyOffice --add-host=subdomain.domain.com:172.17.0.1 \
  -v /app/onlyoffice/DocumentServer/logs:/var/log/onlyoffice  \
  -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data  \
  -v /app/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice \
  -v /app/onlyoffice/DocumentServer/db:/var/lib/postgresql onlyoffice/documentserver \
  -e JWT_ENABLED='true' \
  -w JWT_SECRET='SomeSuperSecretPassword'

JWT is set here, but for some reason the JWT token didnā€™t work for me in the Nextcloud backend.
Therefore i just left the JWT Token Password blank i the Nextcloud backend.

172.17.0.1 is the IP address of my host machines ā€œdocker0ā€ interface (for me)
172.17.0.2 is the IP address of the docker containers ā€œeth0ā€ interface (for me)
See https://docs.docker.com/network/network-tutorial-standalone/
It could be that you have a slightly different IP addresses (check with ip a)

Hope this helps

1 Like

Been a while since Iā€™ve tried all this. Decided to try again today,I hopped that there would have been an update of some sort that would have fixed my problem.
Sadly, none of it.

Any update on your side?

@syrosh
Did you try to pass through the host ( 127.0.0.1) with a specific port previously configured?

I use this method on my server but those are installations with packages not with docker.only

Thanks for you reply, sadly this didnā€™t helped.

I finally managed to make it work using this tutorial :

everything seems to finally be working fine !

3 Likes

Just to verify, your solution was to comment out the 301 redirect in the nginx.conf ?