8000 Nextcloud Integration - often fails after HA restart · Issue #40122 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Nextcloud Integration - often fails after HA restart #40122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mwunderling opened this issue Sep 16, 2020 · 14 comments · Fixed by #40212
Closed

Nextcloud Integration - often fails after HA restart #40122

mwunderling opened this issue Sep 16, 2020 · 14 comments · Fixed by #40212

Comments

@mwunderling
Copy link

The problem

The Nextcloud Integration is properly setup and configured on my system. The integration works roughly 1/5 of the time after restart. Restarts frequently result in Nextcloud entity states showing as unavailable in the UI (see images below - an HA restart is the only difference between the 2 caps)

NextcloudIntegration

Environment

HA Core - Docker on QNAP NAS
Currently on latest HA Release: 0.114.4
HA & Nextcloud both run in Docker on the same device

Traceback/Error logs

Relevant Error from Log
NextcloudError

@probot-home-assistant
Copy link

nextcloud documentation
nextcloud source
(message by IssueLinks)

@probot-home-assistant
Copy link

Hey there @meichthys, mind taking a look at this issue as its been labeled with an integration (nextcloud) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

@meichthys
Copy link
Contributor

@mwunderling Thanks for reporting this. I was also seeing this but wasn't sure if it was something others were running into as well. I'm not sure if it will help, but it may be worth tying to set your Nextcloud docker container to start before Homeassistant. (See depends_on in https://docs.docker.com/compose/startup-order/)

Another question, do you run an NGINX Proxy as a HomeAssistant Add-on or as another docker container on the same host? If so, that could be causing the issue since homeassistant will start up first and try to connect to Nextcloud, but since the proxy is not running yet, it will fail like you are seeing. For this reason i've started running NGINX Proxy Manager in a separate docker host, although there may be a way to tell your homeassistant docker instance to start the NGINX Proxy Manager add-on before the homeassistant container. (All of this may be irrelevant if you're not running the standard Homeassistant install).

In other words, the key is to make sure the containers are starting in the right order. The following order should work:

Nextcloud > NGINX > HomeAssistant

@mwunderling
Copy link
Author

@meichthys thanks for the follow up. Am not yet sure this is a boot order issue....though it may be. I use Docker compose to spin up the containers. HA, Nextcloud, and Traefik2 are all controlled by the same compose file. I'll add a depends_on to HA for Nextcloud.

But, in general, I am not starting all three at the same time. More typical, Traefik & Nextcloud are already up and running (usually for days) and I'll make some config change to HA that requires a restart. Normally, I'll do this from within HA (configuration>server controls>restart). ...this was my workflow that produced the screencap in this ticket showing Nextcloud going from working to unavailable.

@mwunderling
Copy link
Author

Follow up on my last comment. 1) restarted HA from within HA 2) Restarted HA from docker compose file with `depends_on flag added...
nc2

Looks to be same error msg again...
chrome_b1QpQIYn3Z

@meichthys
Copy link
Contributor
meichthys commented Sep 16, 2020 & 8000 #8226;

Ok, i can take a closer look. I thought things were fixed for me once i moved NGINX outside of HA, but it could just be a coincidence that i haven't had the nextcloud instance disconnect again.

@meichthys
Copy link
Contributor

It's a little hard to tell since the issue is sporadic and i haven't seen it in a while, but i think the pull request above should fix the issue.

@meichthys
Copy link
Contributor

@mwunderling A potential fix for this has been merged into the dev branch, so it should be in the next release (I'm assuming that will be 0.115.1)

@poudenes
Copy link

Tried with APP Password, didn’t work. Tried it with my own normal password (user is in ADMIN group) didn’t work.

Tried many things. http://, https:, http://:80, https://:4443 didn’t work also.

https:///ocs/v2.php/apps/serverinfo/api/v1/info?format=json

is working on my iMac when I do a wget on HA:

wget https:///ocs/v2.php/apps/serverinfo/api/v1/info?format=json

I get this error:

--2020-11-15 10:25:44--  https://<IP>/ocs/v2.php/apps/serverinfo/api/v1/info?format=json
Connecting to <IP>:443... connected.
ERROR: The certificate of â<IP>â is not trusted.
ERROR: The certificate of â<IP>â doesn't have a known issuer.
The certificate's owner does not match hostname â<IP>â

I use a self signed cert. Because port 80/443 is going to my HA for Letscrypt Cert.
Nextcloud is running on different RPi… So can’t use lets crypt on that one…

How can I let this work with self signed cert?

@meichthys
Copy link
Contributor

@poudenes The password should work either way. The issue here is definitely the certificate. Unfortunately I haven't tested with self-signed certs. If you're familiar with python, try connecting using the nextcloudmonitor python package to see if you can make a connection with that. If not, it's probably an the 'requests' package that nextcloudmonitor uses to fetch the api endpoint.

I would recommend using NGINXProxyManager to manage your certificates for various services. It's what many of us use now to avoid having to use self-signed certs. It makes things soooooo much easier and can be installed via a homeassistant add-on or easily via docker.

@poudenes
Copy link

@poudenes The password should work either way. The issue here is definitely the certificate. Unfortunately I haven't tested with self-signed certs. If you're familiar with python, try connecting using the nextcloudmonitor python package to see if you can make a connection with that. If not, it's probably an the 'requests' package that nextcloudmonitor uses to fetch the api endpoint.

I would recommend using NGINXProxyManager to manage your certificates for various services. It's what many of us use now to avoid having to use self-signed certs. It makes things soooooo much easier and can be installed via a homeassistant add-on or easily via docker.

Proxy manager I tried. Home assist ant was working and able to connect from outside. Nextcloud wasn't able to connect. Tried everything to let it work.... So reverted back to old situation without proxy manager

@meichthys
Copy link
Contributor

I think i also had an issue with Nextcloud connecting from the outside, I think the issue is that Nextcloud tries to handle the SSL Certificate setup on it's own, which essentially duplicates what Proxy manager is trying to do. I was able to get it to work when i set proxy manager to redirect to the https address of nextcloud instead of the regular http address.

If i get time i may try to allow an SSL bypass for the nextcloud integration. I've updated the underlying package (nextcloudmonitor) but still need to update the integration and get it merged.

@poudenes
Copy link

proxy manager to redirect to https address of nextcloud instead of the regular http address.
And you then no SSL cert creation in Proxy Manager? Just redirect?

@balloob
Copy link
Member
balloob commented Nov 16, 2020

This issue has been resolved. Please open a new issue if you still run into problems.

@home-assistant home-assistant locked as resolved and limited conversation to collaborators Nov 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
0