ONLYOFFICE / docker-onlyoffice-nextcloud

MIT License
364 stars 156 forks source link

Setup without ngnix #23

Closed bwgjoseph closed 4 years ago

bwgjoseph commented 4 years ago

Hi,

I've been trying to install and setup docker with onlyoffice without ngnix, but keep having issue trying to connect to onlyoffice.

This is my docker-compose.

version: '3.7'

services:
  nextcloud:
    image: nextcloud:17.0.0-apache
    container_name: nextcloud-server
    restart: unless-stopped
    ports:
      - 9898:80
    networks:
      - ncnet
    volumes:
      - nc_server_appdata:/var/www/html
    depends_on:
      - maria
    environment:
      - MYSQL_HOST=maria
      - MYSQL_PASSWORD=password
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  maria:
    image: mariadb:10.4.8
    container_name: nextcloud_mariadb
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes:
      - nc_maria_data:/var/lib/mysql
    networks:
      - ncnet
    restart: unless-stopped
    environment:
      - MYSQL_ROOT_PASSWORD=password
      - MYSQL_PASSWORD=password
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  onlyoffice-document-server:
    image: onlyoffice/documentserver:5.4.1.39
    container_name: onlyoffice-document-server
    restart: unless-stopped
    networks:
      - ncnet
    volumes:
      - nc_onlyoffice_data:/var/www/onlyoffice/Data
      - nc_onlyoffice_log:/var/log/onlyoffice
      - nc_onlyoffice_postgresql:/var/lib/postgresql
      - nc_onlyoffice_fonts:/usr/share/fonts/truetype/custom
      - nc_onlyoffice_lib:/var/lib/onlyoffice

networks:
  ncnet:
    driver: 'bridge'

volumes:
  nc_server_appdata:
  nc_maria_data:
  nc_onlyoffice_data:
  nc_onlyoffice_log:
  nc_onlyoffice_postgresql:
  nc_onlyoffice_fonts:
  nc_onlyoffice_lib:

Everything is setup nicely, apps are installed but couldn't seem to get nextcloud and onlyoffice to talk to each other.

Some of the things I saw in the console.

This is during the startup (after running docker-compose up)

nextcloud-server              | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.192.4. Set the 'ServerName' directive globally to suppress this message

This is the ncnet setup in docker.

image

This is my settings (that I tried)

image

And it throws me this error in the UI.

image

And this is the error in the console.

onlyoffice-document-server    | [2019-10-05T18:46:13.784] [ERROR] nodeJS - error downloadFile:url=http://192.168.192.4:9898/apps/onlyoffice/empty?doc=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY3Rpb24iOiJlbXB0eSJ9.dPhLyRWXXvIkwAGI_CZT1Tw_3PT1TPaHCKtHzvQQO3Y;attempt=3;code:ECONNREFUSED;connect:null;(id=conv_check_124840082_docx)

I'm trying to setup everything locally, so I don't have a domain. I'm not sure if it's because of wrong configuration in docker-compose or filling up the onlyoffice config.

Thanks.

agolybev commented 4 years ago

Hi @bwgjoseph, your solution will be work only if you proxyed traffic to document-server on nextcloud server. Otherwise, you have to export 80 port from the document server container, and it should be accessed by the end-user.

bwgjoseph commented 4 years ago

Hi @agolybev,

I'm still a little unclear what is the correct setup.

I have exposed onlyoffice-document-server with port 80, but I'm not sure what to fill up exactly at the nextcloud onlyoffice settings.

onlyoffice-document-server:
    image: onlyoffice/documentserver:5.4.1.39
    container_name: onlyoffice-document-server
    restart: unless-stopped
    ports:
      - 80:80
    networks:
      - ncnet
    volumes:
      - nc_onlyoffice_data:/var/www/onlyoffice/Data
      - nc_onlyoffice_log:/var/log/onlyoffice
      - nc_onlyoffice_postgresql:/var/lib/postgresql
      - nc_onlyoffice_fonts:/usr/share/fonts/truetype/custom
      - nc_onlyoffice_lib:/var/lib/onlyoffice

I am able to access the page using my local ip, 192.168.xx.x.

image

But what exactly do I have to fill up here? I'm confused.

image

Because when I set to my local ip, it has this error.

onlyoffice-document-server    | [2019-10-08T14:57:16.954] [ERROR] nodeJS - error downloadFile:url=http://192.168.11.1/apps/onlyoffice/empty?doc=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY3Rpb24iOiJlbXB0eSJ9.r2_6KC49shggniLIiLXGgeldqln1pwj9Ru6jVxcQdf0;attempt=3;code:null;connect:null;(id=conv_check_1007711371_docx)
onlyoffice-document-server    | Error: Error response: statusCode:404 ;body:
onlyoffice-document-server    | <!DOCTYPE html>
onlyoffice-document-server    | <html lang="en">
onlyoffice-document-server    | <head>
onlyoffice-document-server    | <meta charset="utf-8">
onlyoffice-document-server    | <title>Error</title>
onlyoffice-document-server    | </head>
onlyoffice-document-server    | <body>
onlyoffice-document-server    | <pre>Cannot GET /apps/onlyoffice/empty</pre>
onlyoffice-document-server    | </body>
onlyoffice-document-server    | </html>
onlyoffice-document-server    |
onlyoffice-document-server    |     at Request._callback (/var/www/onlyoffice/documentserver/server/Common/sources/utils.js:257:18)
onlyoffice-document-server    |     at Request.self.callback (/var/www/onlyoffice/documentserver/server/Common/node_modules/request/request.js:185:22)
onlyoffice-document-server    |     at emitTwo (events.js:126:13)
onlyoffice-document-server    |     at Request.emit (events.js:214:7)
onlyoffice-document-server    |     at Request.<anonymous> (/var/www/onlyoffice/documentserver/server/Common/node_modules/request/request.js:1161:10)
onlyoffice-document-server    |     at emitOne (events.js:116:13)
onlyoffice-document-server    |     at Request.emit (events.js:211:7)
onlyoffice-document-server    |     at IncomingMessage.<anonymous> (/var/www/onlyoffice/documentserver/server/Common/node_modules/request/request.js:1083:12)
onlyoffice-document-server    |     at Object.onceWrapper (events.js:313:30)
onlyoffice-document-server    |     at emitNone (events.js:111:20)
onlyoffice-document-server    |     at IncomingMessage.emit (events.js:208:7)
onlyoffice-document-server    |     at endReadableNT (_stream_readable.js:1064:12)
onlyoffice-document-server    |     at _combinedTickCallback (internal/process/next_tick.js:139:11)
onlyoffice-document-server    |     at process._tickCallback (internal/process/next_tick.js:181:9)

Any idea?

agolybev commented 4 years ago

Hi @bwgjoseph, you have to use 'onlyoffice-document-server' container address(dns-name or IP) as a 'Document Editing Service address'. Of cause with the protocol specification: http://your-onlyoffice-document-server-address

bwgjoseph commented 4 years ago

Hi @agolybev,

Sorry, please bear with me as I still couldn't get it working.

Here's my network details from docker.

image

Here's what I set. I only set Document Editing Service address, the rest are default (placeholder).

image

I also did try this, but didn't work as well. Setting Server address for internal requests from the Document Editing Service

image

I am still getting Error when trying to connect (Error occurred in the document service: Error while downloading the document file to be converted.) error.

This is the error logs.

onlyoffice-document-server    | [2019-10-09T12:39:13.997] [ERROR] nodeJS - error downloadFile:url=http://localhost:9898/apps/onlyoffice/empty?doc=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY3Rpb24iOiJlbXB0eSJ9.zfgf6AbCWiXhX2NAcawotizgF6yf69o_uRtifoPCwdM;attempt=1;code:ECONNREFUSED;connect:null;(id=conv_check_468017036_docx)
onlyoffice-document-server    | Error: connect ECONNREFUSED 127.0.0.1:9898
onlyoffice-document-server    |     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1191:14)
onlyoffice-document-server    | [2019-10-09T12:39:15.002] [ERROR] nodeJS - error downloadFile:url=http://localhost:9898/apps/onlyoffice/empty?doc=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY3Rpb24iOiJlbXB0eSJ9.zfgf6AbCWiXhX2NAcawotizgF6yf69o_uRtifoPCwdM;attempt=2;code:ECONNREFUSED;connect:null;(id=conv_check_468017036_docx)
onlyoffice-document-server    | Error: connect ECONNREFUSED 127.0.0.1:9898
onlyoffice-document-server    |     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1191:14)
onlyoffice-document-server    | [2019-10-09T12:39:16.007] [ERROR] nodeJS - error downloadFile:url=http://localhost:9898/apps/onlyoffice/empty?doc=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY3Rpb24iOiJlbXB0eSJ9.zfgf6AbCWiXhX2NAcawotizgF6yf69o_uRtifoPCwdM;attempt=3;code:ECONNREFUSED;connect:null;(id=conv_check_468017036_docx)
onlyoffice-document-server    | Error: connect ECONNREFUSED 127.0.0.1:9898
onlyoffice-document-server    |     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1191:14)
nextcloud-server              | 172.30.0.1 - - [09/Oct/2019:12:39:13 +0000] "PUT /apps/onlyoffice/ajax/settings/address HTTP/1.1" 200 973 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"

Appreciate your help!

agolybev commented 4 years ago

hi @bwgjoseph, I am confused about localhost address in the document server log, because it relsolve into localhost of the onlyoffice-document-server container. So DS can't connect to nextcloud server. May be you open nextcloud web-page by localhost name. If so try using IP address instead localhost.

bwgjoseph commented 4 years ago

Hi @agolybev,

Sorry, I'm also confused. Which IP address should I be using? The one assigned to me by docker, as shown in the image above? or?

I will give it another go soon.

agolybev commented 4 years ago

Hi @bwgjoseph, I'm talking about nextcloud URL. Try opening nextcloud by IP address. Use http://172.30.0.4:9898 instead of http://localhost:9898 in browser address box.

bwgjoseph commented 4 years ago

Hi @agolybev,

I can't access directly with http://172.30.0.4:9898, that's the IP given for docker. I can only access it through localhost:9898 or 192.168.0.xxx:9898 which is my local address.

Sorry, I'm not really great with networking. Thanks for your patience.

agolybev commented 4 years ago

Hi @bwgjoseph, what about opening nextcloud by 192.168.0.xxx:9898? Is documentserver works in this case?

bwgjoseph commented 4 years ago

Hey @agolybev,

It works now!

So I tried to use 192.168.0.xxx ip to setup and it seem to be working fine now.

For anyone interested, this is my docker-compose

version: '3.7'

services:
  nextcloud:
    image: nextcloud:17.0.0-apache
    container_name: nextcloud-server
    restart: unless-stopped
    ports:
      - 9898:80
    networks:
      - ncnet
    volumes:
      - nc_server_appdata:/var/www/html
    depends_on:
      - maria
    environment:
      - MYSQL_HOST=maria
      - MYSQL_PASSWORD=password
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  maria:
    image: mariadb:10.4.8
    container_name: nextcloud_mariadb
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes:
      - nc_maria_data:/var/lib/mysql
    networks:
      - ncnet
    restart: unless-stopped
    environment:
      - MYSQL_ROOT_PASSWORD=password
      - MYSQL_PASSWORD=password
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  onlyoffice-document-server:
    image: onlyoffice/documentserver:5.4.1.39
    container_name: onlyoffice-document-server
    restart: unless-stopped
    ports:
      - 80:80
    networks:
      - ncnet
    volumes:
      - nc_onlyoffice_data:/var/www/onlyoffice/Data
      - nc_onlyoffice_log:/var/log/onlyoffice
      - nc_onlyoffice_postgresql:/var/lib/postgresql
      - nc_onlyoffice_fonts:/usr/share/fonts/truetype/custom
      - nc_onlyoffice_lib:/var/lib/onlyoffice

networks:
  ncnet:
    driver: 'bridge'

volumes:
  nc_server_appdata:
  nc_maria_data:
  nc_onlyoffice_data:
  nc_onlyoffice_log:
  nc_onlyoffice_postgresql:
  nc_onlyoffice_fonts:
  nc_onlyoffice_lib:

I have this set_configuration.sh file to run after docker-compose and admin account is setup.

#!/bin/bash

docker exec -u www-data nextcloud-server php occ --no-warnings app:install onlyoffice

docker exec -u www-data nextcloud-server php occ --no-warnings config:system:set onlyoffice DocumentServerUrl --value="http://192.168.0.103/"
docker exec -u www-data nextcloud-server php occ --no-warnings config:system:set onlyoffice DocumentServerInternalUrl --value="http://192.168.0.103/"
docker exec -u www-data nextcloud-server php occ --no-warnings config:system:set onlyoffice StorageUrl --value="http://192.168.0.103:9898/"

So it looks like this in the settings page.

image

Thank you so much @agolybev so your patience.

It seem like I have been pointing to the wrong IP.

This is just a first step. With this, I am then able to continue with the rest of the configuration.

agolybev commented 4 years ago

Hi @bwgjoseph, thank you too. You got food for my brain. Could you close the issue if it became work?

bwgjoseph commented 4 years ago

Yup, sure thing.

borjapazr commented 3 years ago

Hi @bwgjoseph, your solution will be work only if you proxyed traffic to document-server on nextcloud server. Otherwise, you have to export 80 port from the document server container, and it should be accessed by the end-user.

How would you proxify the document server through the nextcloud server? Using, for example, nginx? In that case the document server address would have to be changed?