ONLYOFFICE / ControlPanel

Tools for administrating self-hosted ONLYOFFICE.
http://www.onlyoffice.com
Apache License 2.0
18 stars 12 forks source link

control panel won't connect to community server over https #1

Open loigu opened 3 years ago

loigu commented 3 years ago

While trying to solve problem with fulltext search in CS (https://github.com/ONLYOFFICE/Docker-CommunityServer/issues/113), on suggestion of @Carazyda I tried to install controlpanel. I have dificulty making it connect to existing installation of document & community server. (everything runs in docker)

I suspect the problem might be that control panel is trying to connect to community server through http while it is running on https (thus won't return json).

root@controlpanel:/var/www/onlyoffice/controlpanel# cat /var/log/onlyoffice/web.controlpanel.12-31.log

2020-12-31 06:38:09 - error: http://onlyoffice.fritz.box/api/2.0/settings/controlpanel.json Unexpected token in JSON at position 0 2020-12-31 06:38:09 - error: http://onlyoffice.fritz.box/api/2.0/portal.json Unexpected token in JSON at position 0

(the correct address is https://.....) - when I try through web browser it returns html "access denied" on http:// and correct json data on https://. Is there a way how to explain to control panel that community server is running on https? The run script obviously expects http :-( root@controlpanel:/var/www/onlyoffice/controlpanel# cat run-controlpanel.sh

... sed 's/http:\/\/onlyoffice-community-server/http:\/\/'${ONLYOFFICE_COMMUNITYSERVER_HOST}'/' -i www/config/production.json; ...

other issue you might want to know about is that there is error in doc on page https://helpcenter.onlyoffice.com/installation/groups-install-docker.aspx:

... sudo docker run --net onlyoffice -i -t -d --restart=always --name onlyoffice-control-panel \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /app/onlyoffice/CommunityServer/data:/app/onlyoffice/CommunityServer/data \ -v /app/onlyoffice/ControlPanel/data:/var/www/onlyoffice-controlpanel/Data \ -v /app/onlyoffice/ControlPanel/logs:/var/log/onlyoffice-controlpanel \ onlyoffice/controlpanel ...

^ the server expects mountpoints /var/www/onlyoffice/Data & /var/log/onlyoffice, not -controlpanel (I had to dig into the container to find the correct paths)

loigu commented 3 years ago

The control panel "starts" - listens on :80, but gives endless redirect to self responses (until web browser gives up with too many redirects)

Carazyda commented 3 years ago

Hello @loigu ControlPanel and CommunityServer should work each other on a local docker network, for example address http://onlyoffice-community-server, you can see at in config www/config/production.json. If communityserver don't available on this address - you can change it to correct one.

mcesnik commented 3 years ago

So to further this discussion. I have been trying with no luck. I have installed community server and control panel sharing the same network. I get the same result in the log file. Basically the resource /api/2.0/settings/controlpanel.json does not work.. calling it using curl from the control-panel docker instance returns

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /api/2.0/settings/controlpanel.json</pre>
</body>
</html>

This seems to apply to the following resources that the control-panel is trying to load from the community-server

Beyond this, I have no idea why the community server requires the CONTROL_PANEL_PORT_80_TCP and CONTROL_PANEL_PORT_80_TCP_ADDR environment variables... shouldn't this be the other way around?