nextcloud / richdocuments

๐Ÿ“‘ Collabora Online for Nextcloud
https://nextcloud.com/collaboraonline
349 stars 115 forks source link

settings lost after server restart #1965

Open Uwe-MrT opened 2 years ago

Uwe-MrT commented 2 years ago

Describe the bug if i want open document, it dont open. it save (download) the document. i go to settings - nextcloud office (nextcloud/index.php/settings/admin/richdocuments) and set up "use internal code " now it works fine, until i restart my server. then i can redo the steps above

To Reproduce Restart your Server

Expected behavior open, not download

Screenshots If applicable, add screenshots to help explain your problem.

Client details:

Server details

Operating system: Debian Bullseye

Web server: Apache2

Database: mariadb (mysql 10.5.12)

PHP version: 8.0.14

Nextcloud version: 23

Version of the richdocuments app 5.0.1

Version of Collabora Online 21.11.6

Logs #### Nextcloud log (data/nextcloud.log) ``` Insert your Nextcloud log here ``` #### Browser log ``` Insert your browser log here, this could for example include: a) The javascript console log b) The network log c) ... ```
adelphi-company commented 2 years ago

I can confirm this problem too!

It does not only occour after a complete system restart but also after a simple "service php-fpm restart". After that, documents are no longer opened but downloaded.

Only fix seems to be to save setting "use internal code" again.

I also tried to do this via CLI, bit it did not fix the issue: sudo -u collab php --define apc.enable_cli=1 occ config:app:set richdocuments public_wopi_url --value https:\/\/[domain]\/apps\/richdocumentscode\/proxy.php?req=

sudo -u collab php --define apc.enable_cli=1 occ config:app:set richdocuments wopi_url --value https:\/\/[domain]\/apps\/richdocumentscode\/proxy.php?req=

sudo -u collab php --define apc.enable_cli=1 occ richdocuments:activate-config

I noticed that after a php-fpm restart following lines are missing in "service php-fpm status": โ”œโ”€416738 bash -c ( /srv/www/collab/home/www/apps/richdocumentscode/collabora/Collabora_Online.AppImage --pidfile=/srv/www/c> โ”œโ”€416739 /bin/bash /srv/www/collab/home/tmp/.mount_CollabZwuiv1/AppRun --pidfile=/srv/www/collab/home/tmp/coolwsd.pid โ”œโ”€416743 /srv/www/collab/home/www/apps/richdocumentscode/collabora/Collabora_Online.AppImage --pidfile=/srv/www/collab/home> โ”œโ”€416747 coolwsd --config-file=/srv/www/collab/home/tmp/.mount_CollabZwuiv1/etc/coolwsd/coolwsd.xml --disable-cool-user-che> โ”œโ”€416749 /srv/www/collab/home/tmp/.mount_CollabZwuiv1/usr/bin/coolforkit --losubpath=lo --systemplate=/srv/www/collab/home/> โ””โ”€425267 /srv/www/collab/home/tmp/.mount_CollabZwuiv1/usr/bin/coolforkit --losubpath=lo --systemplate=/srv/www/collab/home/>

Is there a CLI workaround on how to start the necessary child processes after php restart and why does nextcloud not start them automatically?

juliushaertl commented 2 years ago

I think the main problem is that we cache the capabilities and the automatic start doesn't get triggered then for some reason.

Is there a CLI workaround on how to start the necessary child processes after php restart and why does nextcloud not start them automatically?

You could try to manually do a curl request to https://[domain]/apps/richdocumentscode/proxy.php?status to get the status and also trigger the start of the coolwsd process

That will trigger https://github.com/CollaboraOnline/richdocumentscode/blob/master/proxy.php#L246-L259

The situation there could improve with https://github.com/nextcloud/richdocuments/pull/1901, but would need to validate if that is actually the case.

adelphi-company commented 2 years ago

You could try to manually do a curl request to https://[domain]/apps/richdocumentscode/proxy.php?status to get the status and also trigger the start of the coolwsd process

Does not work.

I can confirm that the call of this URL extends the php-fpm service status by the lines of the killed subprocesses. But something is still missing, as files still get downloaded and not opended by nextcloud office.

See:

1. Output with working nextclood office: service php-fpm status โ— php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2022-02-14 12:37:49 CET; 33s ago Docs: man:php-fpm7.4(8) Process: 106291 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/7.4/fpm/pool.d/www.conf 74 (code=exited, status=0/SUCCESS) Main PID: 106262 (php-fpm7.4) Status: "Processes active: 0, idle: 28, Requests: 18, slow: 0, Traffic: 0.9req/sec" Tasks: 40 (limit: 2311) Memory: 761.4M CPU: 5.141s CGroup: /system.slice/php7.4-fpm.service โ”œโ”€106262 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf) โ”œโ”€106263 php-fpm: pool nextcloud โ”œโ”€106264 php-fpm: pool nextcloud โ”œโ”€106265 php-fpm: pool nextcloud โ”œโ”€106266 php-fpm: pool nextcloud โ”œโ”€106267 php-fpm: pool nextcloud โ”œโ”€106268 php-fpm: pool nextcloud โ”œโ”€106269 php-fpm: pool nextcloud โ”œโ”€106270 php-fpm: pool nextcloud โ”œโ”€106271 php-fpm: pool nextcloud โ”œโ”€106272 php-fpm: pool nextcloud โ”œโ”€106273 php-fpm: pool nextcloud โ”œโ”€106274 php-fpm: pool nextcloud โ”œโ”€106275 php-fpm: pool nextcloud โ”œโ”€106276 php-fpm: pool nextcloud โ”œโ”€106277 php-fpm: pool nextcloud โ”œโ”€106278 php-fpm: pool nextcloud โ”œโ”€106279 php-fpm: pool nextcloud โ”œโ”€106280 php-fpm: pool nextcloud โ”œโ”€106281 php-fpm: pool nextcloud โ”œโ”€106282 php-fpm: pool nextcloud โ”œโ”€106283 php-fpm: pool nextcloud โ”œโ”€106284 php-fpm: pool nextcloud โ”œโ”€106285 php-fpm: pool nextcloud โ”œโ”€106286 php-fpm: pool nextcloud โ”œโ”€106287 php-fpm: pool nextcloud โ”œโ”€106288 php-fpm: pool nextcloud โ”œโ”€106289 php-fpm: pool nextcloud โ”œโ”€106290 php-fpm: pool nextcloud โ”œโ”€106958 bash -c ( /srv/www/collab/home/www/apps/richdocumentscode/collabora/Collabora_Online.AppImage --pidfile=/srv/www/collab/home/tmp/coolwsd.pid || /srv/www/collab/home/www/apps/richdocumen> โ”œโ”€106959 /bin/bash /srv/www/collab/home/tmp/.mount_CollabZNN7DU/AppRun --pidfile=/srv/www/collab/home/tmp/coolwsd.pid โ”œโ”€106963 /srv/www/collab/home/www/apps/richdocumentscode/collabora/Collabora_Online.AppImage --pidfile=/srv/www/collab/home/tmp/coolwsd.pid โ”œโ”€106967 coolwsd --config-file=/srv/www/collab/home/tmp/.mount_CollabZNN7DU/etc/coolwsd/coolwsd.xml --disable-cool-user-checking --port=9983 --lo-template-path=/srv/www/collab/home/tmp/.mount_Co> โ”œโ”€106969 /srv/www/collab/home/tmp/.mount_CollabZNN7DU/usr/bin/coolforkit --losubpath=lo --systemplate=/srv/www/collab/home/tmp/.mount_CollabZNN7DU/ --lotemplate=/srv/www/collab/home/tmp/.mount_C> โ””โ”€106972 /srv/www/collab/home/tmp/.mount_CollabZNN7DU/usr/bin/coolforkit --losubpath=lo --systemplate=/srv/www/collab/home/tmp/.mount_CollabZNN7DU/ --lotemplate=/srv/www/collab/home/tmp/.mount_C>

2. Output after "service php-fpm restart": service php-fpm status โ— php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2022-02-14 12:40:09 CET; 1s ago Docs: man:php-fpm7.4(8) Process: 108453 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/7.4/fpm/pool.d/www.conf 74 (code=exited, status=0/SUCCESS) Main PID: 108424 (php-fpm7.4) Status: "Ready to handle connections" Tasks: 29 (limit: 2311) Memory: 35.8M CPU: 69ms CGroup: /system.slice/php7.4-fpm.service โ”œโ”€108424 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf) โ”œโ”€108425 php-fpm: pool nextcloud โ”œโ”€108426 php-fpm: pool nextcloud โ”œโ”€108427 php-fpm: pool nextcloud โ”œโ”€108428 php-fpm: pool nextcloud โ”œโ”€108429 php-fpm: pool nextcloud โ”œโ”€108430 php-fpm: pool nextcloud โ”œโ”€108431 php-fpm: pool nextcloud โ”œโ”€108432 php-fpm: pool nextcloud โ”œโ”€108433 php-fpm: pool nextcloud โ”œโ”€108434 php-fpm: pool nextcloud โ”œโ”€108435 php-fpm: pool nextcloud โ”œโ”€108436 php-fpm: pool nextcloud โ”œโ”€108437 php-fpm: pool nextcloud โ”œโ”€108438 php-fpm: pool nextcloud โ”œโ”€108439 php-fpm: pool nextcloud โ”œโ”€108440 php-fpm: pool nextcloud โ”œโ”€108441 php-fpm: pool nextcloud โ”œโ”€108442 php-fpm: pool nextcloud โ”œโ”€108443 php-fpm: pool nextcloud โ”œโ”€108444 php-fpm: pool nextcloud โ”œโ”€108445 php-fpm: pool nextcloud โ”œโ”€108446 php-fpm: pool nextcloud โ”œโ”€108447 php-fpm: pool nextcloud โ”œโ”€108448 php-fpm: pool nextcloud โ”œโ”€108449 php-fpm: pool nextcloud โ”œโ”€108450 php-fpm: pool nextcloud โ”œโ”€108451 php-fpm: pool nextcloud โ””โ”€108452 php-fpm: pool nextcloud

3. Output after call of : https://[domain]/apps/richdocumentscode/proxy.php?status Return code: "{"status":"starting"}"

service php-fpm status โ— php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2022-02-14 12:40:09 CET; 1min 8s ago Docs: man:php-fpm7.4(8) Process: 108453 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/7.4/fpm/pool.d/www.conf 74 (code=exited, status=0/SUCCESS) Main PID: 108424 (php-fpm7.4) Status: "Processes active: 0, idle: 28, Requests: 11, slow: 0, Traffic: 0req/sec" Tasks: 40 (limit: 2311) Memory: 698.7M CPU: 4.554s CGroup: /system.slice/php7.4-fpm.service โ”œโ”€108424 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf) โ”œโ”€108425 php-fpm: pool nextcloud โ”œโ”€108426 php-fpm: pool nextcloud โ”œโ”€108427 php-fpm: pool nextcloud โ”œโ”€108428 php-fpm: pool nextcloud โ”œโ”€108429 php-fpm: pool nextcloud โ”œโ”€108430 php-fpm: pool nextcloud โ”œโ”€108431 php-fpm: pool nextcloud โ”œโ”€108432 php-fpm: pool nextcloud โ”œโ”€108433 php-fpm: pool nextcloud โ”œโ”€108434 php-fpm: pool nextcloud โ”œโ”€108435 php-fpm: pool nextcloud โ”œโ”€108436 php-fpm: pool nextcloud โ”œโ”€108437 php-fpm: pool nextcloud โ”œโ”€108438 php-fpm: pool nextcloud โ”œโ”€108439 php-fpm: pool nextcloud โ”œโ”€108440 php-fpm: pool nextcloud โ”œโ”€108441 php-fpm: pool nextcloud โ”œโ”€108442 php-fpm: pool nextcloud โ”œโ”€108443 php-fpm: pool nextcloud โ”œโ”€108444 php-fpm: pool nextcloud โ”œโ”€108445 php-fpm: pool nextcloud โ”œโ”€108446 php-fpm: pool nextcloud โ”œโ”€108447 php-fpm: pool nextcloud โ”œโ”€108448 php-fpm: pool nextcloud โ”œโ”€108449 php-fpm: pool nextcloud โ”œโ”€108450 php-fpm: pool nextcloud โ”œโ”€108451 php-fpm: pool nextcloud โ”œโ”€108452 php-fpm: pool nextcloud โ”œโ”€108485 bash -c ( /srv/www/collab/home/www/apps/richdocumentscode/collabora/Collabora_Online.AppImage --pidfile=/srv/www/collab/home/tmp/coolwsd.pid || /srv/www/collab/home/www/apps/richdocumen> โ”œโ”€108486 /bin/bash /srv/www/collab/home/tmp/.mount_CollabpH02Zp/AppRun --pidfile=/srv/www/collab/home/tmp/coolwsd.pid โ”œโ”€108490 /srv/www/collab/home/www/apps/richdocumentscode/collabora/Collabora_Online.AppImage --pidfile=/srv/www/collab/home/tmp/coolwsd.pid โ”œโ”€108494 coolwsd --config-file=/srv/www/collab/home/tmp/.mount_CollabpH02Zp/etc/coolwsd/coolwsd.xml --disable-cool-user-checking --port=9983 --lo-template-path=/srv/www/collab/home/tmp/.mount_Co> โ”œโ”€108503 /srv/www/collab/home/tmp/.mount_CollabpH02Zp/usr/bin/coolforkit --losubpath=lo --systemplate=/srv/www/collab/home/tmp/.mount_CollabpH02Zp/ --lotemplate=/srv/www/collab/home/tmp/.mount_C> โ””โ”€108505 /srv/www/collab/home/tmp/.mount_CollabpH02Zp/usr/bin/coolforkit --losubpath=lo --systemplate=/srv/www/collab/home/tmp/.mount_CollabpH02Zp/ --lotemplate=/srv/www/collab/home/tmp/.mount_C>

-> But files still downloaded and not opened by nextcloud office until I click on "use builtin CODE". Any other idea how to trigger this step via CLI?

juliushaertl commented 2 years ago

Can you try the following order maybe:

curl https://[domain]/apps/richdocumentscode/proxy.php?status
sudo -u collab php --define apc.enable_cli=1 occ config:app:set richdocuments public_wopi_url --value https://[domain]/apps/richdocumentscode/proxy.php?req=
sudo -u collab php --define apc.enable_cli=1 occ config:app:set richdocuments wopi_url --value https://[domain]/apps/richdocumentscode/proxy.php?req=
sudo -u collab php --define apc.enable_cli=1 occ richdocuments:activate-config

That way the config activation will have the code process already running when trying to connect for setting up.

adelphi-company commented 2 years ago

curl https://[domain]/apps/richdocumentscode/proxy.php?status sudo -u collab php --define apc.enable_cli=1 occ config:app:set richdocuments public_wopi_url --value https://[domain]/apps/richdocumentscode/proxy.php?req= sudo -u collab php --define apc.enable_cli=1 occ config:app:set richdocuments wopi_url --value https://[domain]/apps/richdocumentscode/proxy.php?req= sudo -u collab php --define apc.enable_cli=1 occ richdocuments:activate-config


That way the config activation will have the code process already running when trying to connect for setting up.

No, it's also not working. All commands acknowledged OK but still all files downloaded instead of opening in nextcloud office.

wagnbeu0 commented 1 year ago

Hi, I have exact the same problem. this is causing frustration on my customers because automated updates are not working if you need to do manual action in nextcloud afterwards. It there any chance to get it fixed? I use NC 25.0.3 on Debian 11.

Uwe-MrT commented 1 year ago

Hi, I have exact the same problem. this is causing frustration on my customers because automated updates are not working if you need to do manual action in nextcloud afterwards. It there any chance to get it fixed? I use NC 25.0.3 on Debian 11.

I think, this Problem was solved ? I dont have this Problem anymore Debian 11 + NC 25.0.3

but if not, i fixed it that way...

i made a script this script will be executet on debian restart (i re-activated /etc/rc.local) see https://www.linuxbabe.com/linux-server/how-to-enable-etcrc-local-with-systemd

My Script

#!/bin/bash
cd /var/www/html/nextcloud
curl https://YOUR-ADRESS/nextcloud/apps/richdocumentscode/proxy.php?status
sudo -u www-data php --define apc.enable_cli=1 occ config:app:set richdocuments public_wopi_url --value https://YOUR-ADRESS/nextcloud/apps/richdocumentscode/proxy.php?req= &
sudo -u www-data php --define apc.enable_cli=1 occ config:app:set richdocuments wopi_url --value https://YOUR-ADRESS/nextcloud/apps/richdocumentscode/proxy.php?req= &
sudo -u www-data php --define apc.enable_cli=1 occ richdocuments:activate-config &

You need to replace YOUR-ADRESS with your web adress.

I dont know, is it a good fix or not, but it worked for me well.

wagnbeu0 commented 1 year ago

Iยดll give it a try. Thank you.