GithubHelp home page GithubHelp logo

sebclem / hassio-nextcloud-backup Goto Github PK

View Code? Open in Web Editor NEW
113.0 5.0 14.0 5.16 MB

Hass.io Add-on: Backup your snapshots to Nextcloud

License: GNU General Public License v3.0

Dockerfile 1.42% JavaScript 71.33% Shell 0.83% CSS 0.16% EJS 26.25%
hassio-addons hassio nextcloud home-assistant backup

hassio-nextcloud-backup's Introduction

Home Assistant Add-ons: Nextcloud Backup

GitHub Release Project Stage License

Supports aarch64 Architecture Supports amd64 Architecture Supports armhf Architecture Supports armv7 Architecture Supports i386 Architecture

Project Maintenance

Community Forum

Easily backup your Home Assistant snapshots to Nextcloud

Nextcloud Backup Screenshot

About

Easily backup your Home Assistant snapshots to Nextcloud. Auto backup can be configured via the web interface.

Features

  • Auto Backup : Configure this add-on to automatically backup your HassIO instance
  • Selective Backup : You can specify witch folder and add-on you want to backup.
  • Password protected Backup : this add-on can use the Home Assistant snapshot encryption.
  • Auto Clean : You can specify the maximum number of local snapshots and (ONLY) auto backed-up snapshots.
  • Restore : Upload backed-up snapshot to Home assistant.
  • Auto Stop : This addon can stop addons before backup and restart them after backup
  • Web UI : All the configuration is based on an easy-to-use web interface, no yaml needed.
  • Home Assistant State Entities : This addon create 2 entite in HA : binary_sensor.nextcloud_backup_error and sensor.nextcloud_backup_status

Info: Auto Clean is executed after every upload and every day at 00h30

Installation

The installation of this add-on is pretty straightforward and not different in comparison to installing any other Hass.io add-on.

  1. Add our Home Assisant add-ons repository to your HassOS instance.
  2. Install the "Nextcloud Backup" add-on.
  3. Start the "Nextcloud Backup" add-on
  4. Check the logs of the "Nextcloud Backup" add-on to see if everything went well.
  5. Open the web UI for the "Nextcloud Backup" to configure the add-on.

NOTE: Do not add this repository to HassOS, please use: https://github.com/Sebclem/sebclem-hassio-addon-repository.

Configuration

The configuration documention can be found here

Support

Got questions?

You have several options to get them answered:

You could also open an issue here GitHub.

Authors & contributors

The original setup of this repository is by Sebastien Clement.

For a full list of all authors and contributors, check the contributor's page.

hassio-nextcloud-backup's People

Contributors

asheroto avatar dependabot[bot] avatar ebaschiera avatar gitmirko avatar jerisrue avatar kicker334 avatar meichthys avatar renovate[bot] avatar sebclem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

hassio-nextcloud-backup's Issues

Cannot restore backups

Describe the bug
When downloading backup from nextcloud to HA receiving a 400 error code

Fail to upload backup to home assistant (HTTPError: Response code 400 (Bad Request)) !

When downloading the backup to the computer and uploading to HA via SMB supervisor report an error

21-12-21 15:34:26 ERROR (MainThread) [supervisor.backups.backup] Can't read backup tarfile /data/tmp/tmpaw_p2i6f/backup.tar: invalid header

To Reproduce
download backup from nextcloud to HA either via the GUI or manually

Expected behavior
Backups are downloaded successfully

System information

  • Home Assistant Version : 2021.12.4
  • Home Assistant Supervisor Version : supervisor-2021.12.2
  • Nextcloud Version : 22.2.0
  • Addon version : 0.16.4
  • If any, reverse proxy in fort on Nextcloud : It's an hosted service on Hetzner so I do not have access to the infrastructure to know that

Additional context
I managed to restore a few months ago without an issue with the same configuration on Nextcloud

Fail to upload snapshot to nextcloud (Status code: 413) !

Running manually. The log is below

[2020-02-19 13:35:55] [info]: Local clean done.
[2020-02-19 13:44:15] [info]: Stoping Cron...
[2020-02-19 13:44:15] [info]: Starting Cron...
[2020-02-19 13:44:38] [info]: Creating new snapshot...
[2020-02-19 13:45:23] [info]: Snapshot created with id 2186a8b6
[2020-02-19 13:45:23] [info]: Downloading snapshot 2186a8b6...
[2020-02-19 13:45:23] [info]: Download success !
[2020-02-19 13:45:23] [info]: Uploading snap...
[2020-02-19 13:45:25] [error]: Fail to upload snapshot to nextcloud (Status code: 413) !
(node:354) UnhandledPromiseRejectionWarning: Fail to upload snapshot to nextcloud (Status code: 413) !
(node:354) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 6)

Make backup planning more granular

Hi,
first of all thx for this Add-on. It is really helpfull.

My request:
For now it is only possible to plan a backup on a daily, weekly or monthly basis. Is it possible to make this more granular, that you can e.g. trigger a backup every 3 days?

I am not aware about of the limitations of the home assistent API but as per cron default it is possible to set e.g. "0 0 */3 * *" for 00:00 (midnight) every three days.

Error while trying to upload snapshot to HA

Hi,
I've just tried to use the new feature "UPLOAD TO HA" and I'm getting the following error:

[2020-11-08 20:42:51] [info]: Downloading backup...
(node:251) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, unlink './temp/restore_Nov-08-2020_20_42.tar'
    at Object.unlinkSync (fs.js:1136:3)
    at /opt/nextcloud_backup/tools/webdavTools.js:329:24
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:251) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)
(node:251) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Home Assistant 0.117.5
Addon version: 0.10.1

Best regards
Mirko

Fail to upload snapshot to nextcloud (HTTPError: Response code 504 (Gateway Time-out)) !

Describe the bug
A clear and concise description of what the bug is.
Pushing Backup to NextCloud Server ends up in timeout.
To Reproduce
Steps to reproduce the behavior:
make a backup... push ... timeout ...
Expected behavior
A clear and concise description of what you expected to happen.
no timeout
System information

  • Home Assistant Version :
  • Home Assistant Supervisor Version :
  • Nextcloud Version :
  • Addon version :
  • If any, reverse proxy in front Nextcloud :
    Running Nexcloud behind nginx (Docker)
#version: '3'

services:

  proxy:
    image: jwilder/nginx-proxy:alpine
#    labels:
#      - "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true"
    container_name: nextcloud-proxy
    networks:
      - nextcloud_network
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./proxy/conf.d:/etc/nginx/conf.d:rw
      - ./proxy/vhost.d:/etc/nginx/vhost.d:rw
      - ./proxy/html:/usr/share/nginx/html:rw
      - ./proxy/certs:/etc/nginx/certs:ro
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/tmp/docker.sock:ro
    restart: unless-stopped

#  letsencrypt:
#    image: jrcs/letsencrypt-nginx-proxy-companion
#    container_name: nextcloud-letsencrypt
#    depends_on:
#      - proxy
#    networks:
#      - nextcloud_network
#    volumes:
#      - ./proxy/certs:/etc/nginx/certs:rw
#      - ./proxy/vhost.d:/etc/nginx/vhost.d:rw
#      - ./proxy/html:/usr/share/nginx/html:rw
#      - /etc/localtime:/etc/localtime:ro
#      - /var/run/docker.sock:/var/run/docker.sock:ro
#    restart: unless-stopped

  db:
    image: mariadb
    container_name: nextcloud-mariadb
    networks:
      - nextcloud_network
    volumes:
      - db:/var/lib/mysql
      - /etc/localtime:/etc/localtime:ro
    environment:
      - MYSQL_ROOT_PASSWORD=%%LogMeIn%%
      - MYSQL_PASSWORD=%%LogMeIn%%
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
    restart: unless-stopped

  app:
    image: nextcloud:latest
    container_name: nextcloud-app
    networks:
      - nextcloud_network
    depends_on:
 #     - letsencrypt
      - proxy
      - db
    volumes:
      - nextcloud:/var/www/html
      - ./app/config:/var/www/html/config
      - ./app/custom_apps:/var/www/html/custom_apps
      - ./app/data:/var/www/html/data
      - ./app/themes:/var/www/html/themes
      - /etc/localtime:/etc/localtime:ro
      - /media/thundergreen/Storage:/storage
      - /media/thundergreen/Storage/Docker/NextCloud/php/timeout.ini:/usr/local/                                                                                                                                                             etc/php/conf.d/timeout.ini
    environment:
      - VIRTUAL_HOST=cloud-space.ddns.net
#      - LETSENCRYPT_HOST=nextcloud.YOUR-DOMAIN
#      - LETSENCRYPT_EMAIL=YOUR-EMAIL
    restart: unless-stopped

volumes:
  nextcloud:
  db:

networks:
  nextcloud_network:

Additional context
Add any other context about the problem here.
tried to increse timeout by mapping gninx (placed in vhost.d) and php config but apparently not the good config?

nginx extra config (cloud-space.ddns.net):

client_max_body_size        10G;
client_body_buffer_size     400M;
fastcgi_read_timeout 2000s;
fastcgi_send_timeout 2000s;

php extra config (timeout.ini):

php_value upload_max_filesize 16G
php_value post_max_size 16G
php_value max_input_time 3600
php_value max_execution_time 3600
request_terminate_timeout = 900

Do you have an example / idea how to get rid of timeout and what config to use here?

[error]: Fail to fetch HA Version (Response code 403 (Forbidden))

Hi,

since 2020/11/09 (date of my last NC backup), i can't launch backup

Describe the bug
Can't launch backup
with error

[error]: Fail to fetch HA Version (Response code 403 (Forbidden))

full log

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] 10-run: applying... 
[fix-attrs.d] 10-run: exited 0.
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[22:18:31] INFO: Starting Node...
> [email protected] start /opt/nextcloud_backup
> node --inspect=0.0.0.0:9226 ./bin/www 
Debugger listening on ws://0.0.0.0:9226/4ce61aef-42c0-467d-8d2f-b10a0cb95b6f
For help, see: https://nodejs.org/en/docs/inspector
[2020-11-14 23:18:37] [info]: Satus : Go !
[2020-11-14 23:18:37] [info]: Initilizing and checking webdav client...
[2020-11-14 23:18:37] [info]: Starting auto clean cron...
[2020-11-14 23:18:38] [info]: Starting Cron...
[2020-11-14 23:18:38] [info]: Hassio API : Go !
[2020-11-14 23:18:39] [debug]: Nextcloud connection:  Success !
[2020-11-14 23:18:39] [debug]: Path /Hassio Backup/ already exist.
[2020-11-14 23:18:40] [info]: Nextcloud connection : Go !
[2020-11-14 23:19:27] [error]: Fail to fetch HA Version (Response code 403 (Forbidden))

Expected behavior
do backup

System information

  • Home Assistant Version : HassOS 4.16
  • Home Assistant Supervisor Version : 2020.11.0
  • Nextcloud Version : NC is not the probleme
  • Addon version : 0.11.0
arch | armv7l
-- | --
chassis | embedded
dev | false
docker | true
docker_version | 19.03.12
hassio | true
host_os | HassOS 4.16
installation_type | Home Assistant OS
os_name | Linux
os_version | 4.19.127-v7
python_version | 3.8.6
supervisor | 2020.11.0
timezone | Europe/Paris
version | 0.117.6
virtualenv | false

More context
rpi 3 b+
recorder use mariadb
data partition is on a 120G usb ssd

core snapshot is working

20-11-14 22:31:00 INFO (MainThread) [supervisor.snapshots] Found 1 snapshot files
20-11-14 22:31:38 INFO (MainThread) [supervisor.snapshots] Creating new full-snapshot with slug e3a91ecc
20-11-14 22:31:38 INFO (MainThread) [supervisor.snapshots] Snapshotting e3a91ecc store Add-ons
20-11-14 22:31:38 INFO (MainThread) [supervisor.addons.addon] Building snapshot for add-on a0d7b954_nodered
20-11-14 22:31:38 INFO (MainThread) [supervisor.addons.addon] Finish snapshot for addon a0d7b954_nodered
20-11-14 22:31:38 INFO (MainThread) [supervisor.addons.addon] Building snapshot for add-on core_samba
20-11-14 22:31:38 INFO (MainThread) [supervisor.addons.addon] Finish snapshot for addon core_samba
20-11-14 22:31:38 INFO (MainThread) [supervisor.addons.addon] Building snapshot for add-on core_ssh
20-11-14 22:31:38 INFO (MainThread) [supervisor.addons.addon] Finish snapshot for addon core_ssh
20-11-14 22:31:38 INFO (MainThread) [supervisor.addons.addon] Building snapshot for add-on core_mosquitto
20-11-14 22:31:38 INFO (MainThread) [supervisor.addons.addon] Finish snapshot for addon core_mosquitto
20-11-14 22:31:38 INFO (MainThread) [supervisor.addons.addon] Building snapshot for add-on 229cc4d7_nextcloud_backup
20-11-14 22:31:38 INFO (MainThread) [supervisor.addons.addon] Finish snapshot for addon 229cc4d7_nextcloud_backup
20-11-14 22:31:38 INFO (MainThread) [supervisor.addons.addon] Building snapshot for add-on a0d7b954_influxdb
20-11-14 22:34:52 INFO (MainThread) [supervisor.addons.addon] Finish snapshot for addon a0d7b954_influxdb
20-11-14 22:34:52 INFO (MainThread) [supervisor.addons.addon] Building snapshot for add-on a0d7b954_grafana
20-11-14 22:34:52 INFO (MainThread) [supervisor.addons.addon] Finish snapshot for addon a0d7b954_grafana
20-11-14 22:34:52 INFO (MainThread) [supervisor.addons.addon] Building snapshot for add-on core_mariadb
...

found that in logs

20-11-14 22:19:27 WARNING (MainThread) [supervisor.api.security] /core/info no role for 229cc4d7_nextcloud_backup
20-11-14 22:19:27 ERROR (MainThread) [supervisor.api.security] Invalid token for access /core/info

Nextcloud logo doesn't appear

Hi,

Really good idea to doing an hassio backup add-on to Nextcloud.

I've tried manual backup and it works perfectly, good job.

However, the Nextcloud logo doesn't appear on the header. Reviewed the code and i've seen that le logo picture is stocked on another ovh domain.

<a href="#" class="brand-logo"><img src="https://cloud.seb6596.ovh/svg/core/logo/logo?color=fff&v=1" height="54"

Can't you put it locally ? It would be better.

logo_error

problem with DNS resolution?

I have a problem that is difficult to explain. I'll try.

My AX3600 router modified to use it as a neutral router does not have nat loopback active. As a consequence, my PC does not resolve my Home Assistant dns (xxxx.duckdns.org) well within my local LAN.

To solve this problem I have installed a DNS server addon Dnsmasq and configured the IP address of the server on each of my computers.

I have a Nextcloud server locally with a DNS nextcloud.xxx.duckdns.org that I can access correctly from inside (thanks to Dnsmasq) and from the Internet.

I have configured the Nextcloud Backup addons with the hostname: 192.168.1.118:8080 (local address of my Nextcloud server). It connects correctly.

I've done a manual backup but it never uploads.

I think it is due to a problem with the DNS resolution. My Nextcloud server resolves the IP address 192.168.1.118:8080 to nextcloud.xxx.duckdns.org. The Nextcloud Backup addon works with the nextcloud.xxx.duckdns.org dns and my router is not able to solve it.

I have solved this problem with some services that I have in my Docker, setting the IP of the DNS servers in the container. With the Home assistant addos I don't know how to do it.

I don't know if I have explained my problem correctly.

This is my log:

[2021-01-14 16:36:57] [info]: Satus : Go !
[2021-01-14 16:36:57] [info]: Initializing and checking webdav client...
[2021-01-14 16:36:57] [info]: Starting auto clean cron...
[2021-01-14 16:36:57] [info]: Starting Cron...
[2021-01-14 16:36:58] [info]: Hassio API : Go !
[2021-01-14 16:36:58] [info]: Nextcloud connection : Go !
[2021-01-14 16:38:29] [info]: Creating new snapshot...
[2021-01-14 16:59:14] [info]: Snapshot created with id 05467eb3
[2021-01-14 16:59:14] [info]: Downloading snapshot 05467eb3...
[2021-01-14 17:01:54] [info]: Download success !
[2021-01-14 17:01:54] [info]: Uploading snap...
(node:376) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'rejectUnauthorized' of undefined
at /opt/nextcloud_backup/tools/webdavTools.js:231:68
at new Promise ()
at WebdavTools._startUpload (/opt/nextcloud_backup/tools/webdavTools.js:208:16)
at /opt/nextcloud_backup/tools/webdavTools.js:203:22
at new Promise ()
at WebdavTools.uploadFile (/opt/nextcloud_backup/tools/webdavTools.js:193:16)
at /opt/nextcloud_backup/routes/api.js:160:36
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:376) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 5)
(node:376) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Implement Partial Backup

I really like the Auto-Update of this Addon. Big thanks to everybody contributing to it!

I now have a problem: since i now moved to an SSD on my Raspberry Pi, I can finally use the Plex Add-on with Movies in the \share folder. Now the full Backup has blown up to 36GB, which is obviously not feasible.

I would really love the possibility of partial Backups, so that I could exclude the \share-folder and continue using this awesome Addon.

Upload to owncloud fails (or: Please support owncloud)

Describe the bug
Hey, I understand that your addon is specifically named nextcloud but as nextcloud is a fork of owncloud I was wondering whether it also supports ownloud... or if you could support it.

What I get atm:

-----------------------------------------------------------
 Add-on: Nextcloud Backup
 Easily backup your Home Assistant snapshots to Nextcloud
-----------------------------------------------------------
 Add-on version: 0.16.4
 You are running the latest version of this add-on.
 System: Home Assistant OS 6.6  (aarch64 / odroid-n2)
 Home Assistant Core: 2021.10.4
 Home Assistant Supervisor: 2021.10.8
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to INFO
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[22:48:59] INFO: Starting Node...
> [email protected] start
> node ./bin/www
[2021-11-01 22:49:03] [info]: 	Satus : Go !
[2021-11-01 22:49:03] [info]: 	Initializing and checking webdav client...
[2021-11-01 22:49:03] [info]: 	Starting auto clean cron...
[2021-11-01 22:49:03] [warn]: 	No Cron settings available.
[2021-11-01 22:49:03] [info]: 	Hassio API : Go !
[2021-11-01 22:49:05] [info]: 	Nextcloud connection : Go !
[2021-11-01 23:25:02] [info]: 	Stopping addons...
[2021-11-01 23:25:02] [info]: 	... Ok
[2021-11-01 23:25:02] [info]: 	Creating new snapshot...
[2021-11-01 23:25:59] [info]: 	Initializing and checking webdav client...
[2021-11-01 23:26:11] [info]: 	Downloading snapshot fd5cf1ab...
[2021-11-01 23:26:20] [info]: 	Download success !
[2021-11-01 23:26:20] [info]: 	Uploading snap...
[2021-11-01 23:26:20] [error]: 	Fail to upload snapshot to nextcloud (Error: write ECONNRESET) !
[2021-11-01 23:26:20] [error]: 	Error: write ECONNRESET
    at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:94:16)
(node:346) UnhandledPromiseRejectionWarning: Fail to upload snapshot to nextcloud (Error: write ECONNRESET) !
(Use `node --trace-warnings ...` to show where the warning was created)
(node:346) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:346) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Thanks!

Fail to upload snapshot to nextcloud (RequestError: URI malformed)

Since update I get this error:

Nextcloud: Current version: 0.11.1
HA: 0.117.6

[2020-11-17 12:42:05] [error]: Fail to upload snapshot to nextcloud (RequestError: URI malformed) !
(node:252) UnhandledPromiseRejectionWarning: Fail to upload snapshot to nextcloud (RequestError: URI malformed) !
(node:252) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 14)
(node:252) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Can't create new snapshot (UnhandledPromiseRejectionWarning)

I get this Error, when I start the backup process manually:
[2020-09-20 00:00:00] [debug]: Cron triggered !
[2020-09-20 00:00:00] [info]: Creating new snapshot...
[2020-09-20 00:40:01] [error]: Can't create new snapshot (Timeout awaiting 'request' for 2400000ms)
(node:248) UnhandledPromiseRejectionWarning: ReferenceError: status is not defined
at /opt/nextcloud_backup/tools/webdavTools.js:296:17
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:248) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 5)
(node:248) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[2020-09-21 01:00:02] [info]: Cloud clean done.
[2020-09-22 01:00:03] [info]: Cloud clean done.
[2020-09-23 01:00:02] [info]: Cloud clean done.
[2020-09-23 12:44:27] [info]: Creating new snapshot...
[2020-09-23 13:24:27] [error]: Can't create new snapshot (Timeout awaiting 'request' for 2400000ms)

The local snapshot got created and has the size of 691 MB.
But there is no snapshot in my nextcloud folder.

Error State and Code?

Hi :)

could you add some informations about the error state and code?
I like to trigger a message, if there is any probleme in the backup process.

I found this error code in the data:
Error Codes
1 => Fail to download snap
2 => Nextcloud config invalid
3 => Can't connect to Nextcloud
4 => Upload snap fail
5 => Fail create new snap
6 => Fail to clean
7 => Fail to download snap
8 => Fail to stop addon
9 => Fail to start addon
Are they right?

Thanks and regards

Can't login to Nextcloud

I am trying to configure the Nextcloud Backup addon but I am unable to get it to connect to my Nextcloud instance.

I get the message:

Can't connect to Nextcloud (Error: getaddrinfo ENOTFOUND https) !

I have configured an app password for HA in Nextcloud but that may be the problem. Suggestions as to how to figure out where this is going wrong?

Invalid request for Invalid path, ":" is not allowed

Describe the bug
I created a manual backup for a first test and get an 500 - Internal Server Error from Nextcloud. In the Nextcloud log I found the reason. There seems to be a problem with : in the filename.

I used the default backup name {type}-{ha_version}-{date}-{hour}. The result is Manual-2020.12.1-2020-12-24_22:48.tar

To Reproduce
Create a manual backup with the default name.

Expected behavior
The backup should be transferred correctly to Nextcloud.

System information

  • Home Assistant Version : 2020.12.1
  • Home Assistant Supervisor Version : 2020.12.7
  • Nextcloud Version : Nextcloud in Docker, 20.0.4
  • Addon version : 0.12.0
  • If any, reverse proxy in fort on Nextcloud : Nginx/1.14.2

Additional context
Nginx config:

server {
    listen 80;
    listen [::]:80;
    server_name xxx;
    # enforce https
    return 301 https://$server_name:443$request_uri;
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name xxx;

    access_log xxx;
    error_log  xxx;
    large_client_header_buffers 4 8k;

    client_max_body_size 0;
    underscores_in_headers on;

    ##
    # SSL
    ##

    ssl on;
    ssl_certificate xxx;
    ssl_certificate_key xxx;
    ssl_session_cache builtin:1000 shared:SSL:10m;
    ssl_prefer_server_ciphers on;
    # Turn on OCSP stapling as recommended at 
    # https://community.letsencrypt.org/t/integration-guide/13123 
    # requires nginx version >= 1.3.7
    ssl_stapling on;
    ssl_stapling_verify on;
    # unsichere SSL Ciphers deaktivieren!
    ssl_ciphers    HIGH:!aNULL:!eNULL:!LOW:!3DES:!MD5:!RC4;

    # Add headers to serve security related headers
    # Before enabling Strict-Transport-Security headers please read into this
    # topic first.
    add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;

    location = /.well-known/carddav {
        return 301 $scheme://$host/remote.php/dav;
    }
    location = /.well-known/caldav {
        return 301 $scheme://$host/remote.php/dav;
    }
    location /.well-known {
        alias xxx;
    }

    location / {
        client_max_body_size 1G;
        proxy_connect_timeout 3600;
        proxy_send_timeout 3600;
        proxy_read_timeout 3600;
        send_timeout 3600;
        proxy_buffering off;
        proxy_request_buffering off;
        proxy_headers_hash_max_size 512;
        proxy_headers_hash_bucket_size 64;
        proxy_set_header Host $host;
	proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass xxx;
        proxy_redirect off;
    }
}

Error message in Nextcloud log:

[webdav] Fatal: Icewind\SMB\Exception\InvalidPathException: Invalid request for Invalid path, ":" is not allowed (InvalidPathException) at <<closure>>

 0. /var/www/html/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php line 70
    Icewind\SMB\AbstractShare->verifyPath("/xxx/Smart H ... r")
 1. /var/www/html/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php line 306
    Icewind\SMB\Native\NativeShare->buildUrl("/xxx/Smart H ... r")
 2. /var/www/html/apps/files_external/3rdparty/icewind/smb/src/Native/NativeFileInfo.php line 64
    Icewind\SMB\Native\NativeShare->getAttribute("/xxx/Smart H ... r", "system.dos_attr.*")
 3. /var/www/html/apps/files_external/3rdparty/icewind/smb/src/Native/NativeFileInfo.php line 83
    Icewind\SMB\Native\NativeFileInfo->stat()
 4. /var/www/html/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php line 113
    Icewind\SMB\Native\NativeFileInfo->getSize()
 5. /var/www/html/apps/files_external/lib/Lib/Storage/SMB.php line 188
    Icewind\SMB\Native\NativeShare->stat("/xxx/Smart H ... r")
 6. /var/www/html/apps/files_external/lib/Lib/Storage/SMB.php line 640
    OCA\Files_External\Lib\Storage\SMB->getFileInfo("/xxx/Smart H ... r")
 7. /var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php line 226
    OCA\Files_External\Lib\Storage\SMB->file_exists("xxx/Smart Ho ... r")
 8. /var/www/html/lib/private/Files/Storage/Wrapper/Availability.php line 245
    OC\Files\Storage\Wrapper\Wrapper->file_exists("xxx/Smart Ho ... r")
 9. /var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php line 226
    OC\Files\Storage\Wrapper\Availability->file_exists("xxx/Smart Ho ... r")
10. /var/www/html/lib/private/Files/View.php line 1340
    OC\Files\Storage\Wrapper\Wrapper->file_exists("xxx/Smart Ho ... r")
11. /var/www/html/lib/private/Files/View.php line 1389
    OC\Files\View->getCacheEntry(OCA\Files_Trashb ... l}, "xxx/Smart Ho ... r", "xxx/S ... r")
12. /var/www/html/apps/dav/lib/Connector/Sabre/ObjectTree.php line 156
    OC\Files\View->getFileInfo("/xxx/file ... r")
13. /var/www/html/apps/dav/lib/Connector/Sabre/LockPlugin.php line 69
    OCA\DAV\Connector\Sabre\ObjectTree->getNodeForPath("xxx/S ... r")
14. /var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
    OCA\DAV\Connector\Sabre\LockPlugin->getLock(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
15. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 458
    Sabre\DAV\Server->emit("beforeMethod:PUT", [Sabre\HTTP\Requ ... }])
16. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 251
    Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
17. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 319
    Sabre\DAV\Server->start()
18. /var/www/html/apps/dav/appinfo/v1/webdav.php line 84
    Sabre\DAV\Server->exec()
19. /var/www/html/remote.php line 167
    require_once("/var/www/html/a ... p")

PUT /remote.php/webdav/xxx/Smart%20Home/Backup%20Home%20Assistant/Manual/Manual-2020.12.1-2020-12-24_22:48.tar
from xxx by xxx at 2020-12-24T22:42:11+00:00

Fail to upload snapshot to nextcloud (Error: write ECONNRESET) !

Describe the bug
Addon won't upload snapshots created to my Nextcloud

To Reproduce
Start a manual Backup, the snapshot will be created but the Addon can't add upload the snapshot and fails with the error message: "Fail to upload snapshot to nextcloud (Error: write ECONNRESET) !"

Expected behavior
Upload Snapshot to Folder in Nextcloud

System information

  • Home Assistant Version : core-2021.6.5
  • Home Assistant Supervisor Version : supervisor-2021.06.3
  • Nextcloud Version : Nextcloud 21.0.2
  • Addon version : 0.16.1
  • If any, reverse proxy in fort on Nextcloud : traefik2

Additional context

  • I can write in the folder I try to upload the snapshots into
  • So far my Nextcloud works flawlessly (webdav, reverse proxy config, Client)
  • tried App Password and User password, both didn't work
  • the Addon can write into the folder (I can see that it created the folders manual, auto etc.)
  • somehow the addin was able to do one successfull upload

Logs

[2021-06-19 15:24:36] [error]: Fail to upload snapshot to nextcloud (Error: write ECONNRESET) !
[2021-06-19 15:24:36] [error]: Error: write ECONNRESET
at afterWriteDispatched (internal/stream_base_commons.js:156:25)
at writeGeneric (internal/stream_base_commons.js:147:3)
at Socket._writeGeneric (net.js:785:11)
at Socket._write (net.js:797:8)
at doWrite (internal/streams/writable.js:377:12)
at clearBuffer (internal/streams/writable.js:529:7)
at Socket.Writable.uncork (internal/streams/writable.js:317:7)
at connectionCorkNT (_http_outgoing.js:733:8)
at processTicksAndRejections (internal/process/task_queues.js:79:21)
(node:396) UnhandledPromiseRejectionWarning: Fail to upload snapshot to nextcloud (Error: write ECONNRESET) !
(node:396) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

Any help would be appreciated, thanks!

Incorporate into home assistant community add-ons

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
I'm wondering if it is possible to incorporate this app into the official community add ons? It is a really good app and I feel it is fairly stable by now.

Describe alternatives you've considered
Works great

System information
Not really applicable here...

  • Home Assistant Version :
  • Home Assistant Supervisor Version :
  • Nextcloud Version :
  • Addon version :
  • If any, reverse proxy in fort on Nextcloud :

Additional context
NA

Keep X backup on local machine

Would like to see the ability to auto delete old backup on the HA machine.
When doing a lot of auto backup, it take a lot of space.

Hourly Backups

Is your feature request related to a problem? Please describe.
Not a problem, just a feature request for an awesome add-on

Describe the solution you'd like
It would be nice to be able to take automated Hourly backups or backups more than once a day.

Describe alternatives you've considered
I find myself wishing i had more backups durring the day. I sometimes make large changes to Homeassitant and then wish there was a way to restore back to a point a few hours earlier. I currently use Proxmox to take snapshots of my Home-Assistant VM, so that's another option, but it would be an appreciated feature to allow Hourly backups to be stored in Nextcloud, however i could see that this could become i/o intensive and may not be reasonable.

System information

  • Home Assistant Version : 0.118
  • Home Assistant Supervisor Version : 2020.12.6
  • Nextcloud Version : 20
  • Addon version :
  • If any, reverse proxy in fort on Nextcloud : NGINX

Additional context
image

ERROR 400 when uploading a local backup

Describe the bug

[2021-01-18 02:04:15] [error]: 	Fail to upload backup to home assitant (HTTPError: Response code 400 (Bad Request)) !
(node:377) UnhandledPromiseRejectionWarning: Fail to upload backup to home assitant (HTTPError: Response code 400 (Bad Request)) !
(node:377) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)
(node:377) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

To Reproduce
Upload a local backup

Expected behavior
It should backup sucessfuly

System information

  • Home Assistant Version : latest
  • Home Assistant Supervisor Version : latest
  • Nextcloud Version : latest
  • Addon version : latest

Aditional info
I use SSl with LetsEncrypt encryption witch DuckDns both on HA and NC. My NC instance is located at a RPI4 running NextcloudPi. I generated a key on NC as describen in documentation and when i check that auth key activity seems that there is no problem in the communication betwen HA and NC because when trying to upload, the last activity of the app key change from whatever it says to "few seconds ago".

Manual given filenames

Hi There,

Nice work !!!!

Would be nice to have the option to give your own format for the file name.
So you can change your name like this:

HA_NC_{date}
Nextcloud_{date}{ha_version}
Full_Backup
{ha_version}{date}{time}
{date}_{time}_full_backup

Etc etc etc.

Encrypted backups

Is your feature request related to a problem? Please describe.
No problem

Describe the solution you'd like
In local backups you can use password encryption so that backups can only be extracted by the rightfull owner. I would like to be able to encrypt before upload to nextcloud.

Describe alternatives you've considered
No alternatives

System information

  • Home Assistant Version : 2021.1.1
  • Home Assistant Supervisor Version : 2020.12.7
  • Nextcloud Version :
  • Addon version : 0.13.1
  • If any, reverse proxy in fort on Nextcloud : NGINX

Additional context
Add any other context or screenshots about the feature request here.
Thanks for the addon, it looks and works great!

Entite status does not change immediately

As backup for checking the error status, I like to monitor the status, because the status has to change every day to uploading for example. But as I looked in my logbook I found this irregular logs

  1. November 2021
    Nexcloud Backup Status wechselte zu idle durch Supervisor
    22:23:30 - Vor 17 Minuten
    Nexcloud Backup Status wechselte zu starting durch Supervisor
    03:12:27 - Vor 19 Stunden

  2. November 2021
    Nexcloud Backup Status wechselte zu upload durch Supervisor
    03:06:13 - Vorgestern

  3. November 2021
    Nexcloud Backup Status wechselte zu idle durch Supervisor
    19:54:34 - Vorgestern
    Nexcloud Backup Status wechselte zu upload durch Supervisor
    03:05:29 - Vor 3 Tagen

  4. November 2021
    Nexcloud Backup Status wechselte zu starting durch Supervisor
    03:04:47 - Vor 4 Tagen

  5. November 2021
    Nexcloud Backup Status wechselte zu starting durch Supervisor
    03:04:07 - Vor 5 Tagen

The time for uploadings are really different ...
Could you check this?

Thanks a lot and regards

Invalid nextcloud settings

Just installed the add on and I want to like it but I cannot get it to connect to my nextcloud. I have a domain and am using a reverse proxy so for my address on the add on I am using https://mynextcloud.mydomain.xyz and my username and password but I get the error message below.

[2020-05-12 20:29:45] [info]: Initilizing and checking webdav client...
[2020-05-12 20:29:45] [error]: Can't connect to Nextcloud (Error: getaddrinfo ENOTFOUND https https:443) !
[2020-05-12 20:29:47] [info]: Initilizing and checking webdav client...
[2020-05-12 20:29:47] [error]: Can't connect to Nextcloud (Error: getaddrinfo ENOTFOUND https https:443) ! 

ERROR (MainThread) [aiohttp.server] Error handling request

Hi All,

When I access Nextcloud from the panel on left I see this error coming up many times:

2020-12-21 20:55:40 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 118, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 71, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 129, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/hassio/ingress.py", line 57, in _handle
    return await self._handle_request(request, token, path)
  File "/usr/src/homeassistant/homeassistant/components/hassio/ingress.py", line 121, in _handle_request
    source_header = _init_header(request, token)
  File "/usr/src/homeassistant/homeassistant/components/hassio/ingress.py", line 189, in _init_header
    connected_ip = ip_address(request.transport.get_extra_info("peername")[0])
TypeError: 'NoneType' object is not subscriptable

Nextcloud Add-On: Current version: 0.12.0

Version | 2020.12.1
-- | --
Installation Type | Home Assistant Supervised
Development | false
Supervisor | true
Docker | true
Virtual Environment | false
Python Version | 3.8.6
Operating System Family | Linux
Operating System Version | 5.4.79-v8+
CPU Architecture | aarch64
Timezone | Europe/Amsterdam

Expected filesize differs from wroted filesize

Describe the bug
I installed the plugin and configured it correctly (I think so - the two folders Auto and Manual are there in Nextcloud).
I started a manual backup in order to test the Add-on but I get an error.

The Backup has a size of around 450 MB. When I download the backup and upload it via the Nextcloud WebUI, the upload finished without an error.

To Reproduce
Steps to reproduce the behavior: Install the Add-on and configure it. Then start a manual backup and wait.

Expected behavior
The backup should be transferred correctly to Nextcloud.

System information

  • Home Assistant Version : 2020.12.1
  • Home Assistant Supervisor Version : 2020.12.7
  • Nextcloud Version : Nextcloud in Docker, 20.0.4
  • Addon version : 0.12.0
  • If any, reverse proxy in fort on Nextcloud : Nginx/1.14.2

Additional context
Nginx config:

server {
    listen 80;
    listen [::]:80;
    server_name xxx;
    # enforce https
    return 301 https://$server_name:443$request_uri;
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name xxx;

    access_log xxx;
    error_log  xxx;
    large_client_header_buffers 4 8k;

    client_max_body_size 0;
    underscores_in_headers on;

    ##
    # SSL
    ##

    ssl on;
    ssl_certificate xxx;
    ssl_certificate_key xxx;
    ssl_session_cache builtin:1000 shared:SSL:10m;
    ssl_prefer_server_ciphers on;
    # Turn on OCSP stapling as recommended at 
    # https://community.letsencrypt.org/t/integration-guide/13123 
    # requires nginx version >= 1.3.7
    ssl_stapling on;
    ssl_stapling_verify on;
    # unsichere SSL Ciphers deaktivieren!
    ssl_ciphers    HIGH:!aNULL:!eNULL:!LOW:!3DES:!MD5:!RC4;

    # Add headers to serve security related headers
    # Before enabling Strict-Transport-Security headers please read into this
    # topic first.
    add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;

    location = /.well-known/carddav {
        return 301 $scheme://$host/remote.php/dav;
    }
    location = /.well-known/caldav {
        return 301 $scheme://$host/remote.php/dav;
    }
    location /.well-known {
        alias xxx;
    }

    location / {
        client_max_body_size 1G;
        proxy_connect_timeout 3600;
        proxy_send_timeout 3600;
        proxy_read_timeout 3600;
        send_timeout 3600;
        proxy_buffering off;
        proxy_request_buffering off;
        proxy_headers_hash_max_size 512;
        proxy_headers_hash_bucket_size 64;
        proxy_max_temp_file_size 1024m;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass xxx;
        proxy_redirect off;
    }
}

Error message in Nextcloud log:

[no app in context] Error: Sabre\DAV\Exception\BadRequest: Expected filesize of 481495040 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 51904512 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side. at <<closure>>

0. /var/www/html/apps/dav/lib/Connector/Sabre/Directory.php line 155
   OCA\DAV\Connector\Sabre\File->put(null)
1. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 1104
   OCA\DAV\Connector\Sabre\Directory->createFile("Manual-2020.12.1-2020-12-24.tar", null)
2. /var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 527
   Sabre\DAV\Server->createFile("xxx/S ... r", null, null)
3. /var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
   Sabre\DAV\CorePlugin->httpPut(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
4. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 474
   Sabre\DAV\Server->emit("method:PUT", [Sabre\HTTP\Requ ... }])
5. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 251
   Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
6. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 319
   Sabre\DAV\Server->start()
7. /var/www/html/apps/dav/appinfo/v1/webdav.php line 84
   Sabre\DAV\Server->exec()
8. /var/www/html/remote.php line 167
   require_once("/var/www/html/a ... p")

PUT /remote.php/webdav/xxx/Smart%20Home/Backup%20Home%20Assistant/Manual/Manual-2020.12.1-2020-12-24.tar
from xxx by xxx at 2020-12-24T22:56:47+00:00

Spelling error

In the Settings->Backup screen one of the options for “Auto Backup” is “Dayly”. Should be spelled “Daily”.

Thanks for creating this Hass.io add on!

Snapshots always listed as partial !

I have setup the plugin to do a full backup each night and upload it at my NC. So far it looks to work but when I go in Supervisor to see list of snapshots locally done, I can see the automated ones done by the plugin but they are listed as partial snapshot (although if I look at details of them they look to be a full snapshot !)

Steps to reproduce the behavior: Setup a full backup each night

Expected behavior: should be full snapshot and not partial ones !

  • Home Assistant Version : 2021.4.5
  • Home Assistant Supervisor Version : supervisor-2021.04.1
  • Nextcloud Version : 21.0.1
  • Addon version : 0.16.0
  • If any, reverse proxy in fort on Nextcloud : N/A

RangeError: Invalid time value

I managed to make nextcloud backup login to my nextcloud (I can tell since it created the directories "auto" and "manual" on nextcloud).

I cannot make it actually backup, just hangs on "waiting". I see this in the log:

`-----------------------------------------------------------
Add-on: Nextcloud Backup
Easily backup your Home Assistant snapshots to Nextcloud

Add-on version: 0.16.3
You are running the latest version of this add-on.
System: Home Assistant OS 6.2 (amd64 / qemux86-64)
Home Assistant Core: 2021.9.6
Home Assistant Supervisor: 2021.09.0

Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.

[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing...
Log level is set to INFO
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[09:14:40] INFO: Starting Node...

[email protected] start
node ./bin/www
[2021-09-14 09:14:47] [error]: uncaughtException: Invalid time value
RangeError: Invalid time value
at Date.toISOString ()
at Object.publish_state (/opt/nextcloud_backup/tools/hassioApiTools.js:554:87)
at setStatus (/opt/nextcloud_backup/tools/status.js:37:28)
at Object.init (/opt/nextcloud_backup/tools/status.js:20:13)
at Object. (/opt/nextcloud_backup/app.js:77:13)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Module.require (internal/modules/cjs/loader.js:961:19)
[09:14:51] INFO: Starting Node...
[email protected] start
node ./bin/www
[2021-09-14 09:14:55] [info]: Satus : Go !
[2021-09-14 09:14:55] [info]: Initializing and checking webdav client...
[2021-09-14 09:14:56] [info]: Starting auto clean cron...
[2021-09-14 09:14:56] [warn]: No Cron settings available.
[2021-09-14 09:14:56] [info]: Hassio API : Go !
[2021-09-14 09:14:58] [info]: Nextcloud connection : Go !
[2021-09-14 09:15:14] [info]: Stopping addons...
[2021-09-14 09:15:14] [info]: Starting addons...`

Any clue?

/Kasper

SSL Switch has no effect in settings

I have a local nextcloud instance that does not use SSL. The settings page has a switch to turn off SSL and when I turn it off, I still get messages like "Can't connect to Nextcloud (Error: connect ECONNREFUSED 192.168.x.x:443) !" When I cancel out and come back into settings, the SSL switch is turned back on, but the other settings like the hostname, etc. are still saved.

parse error: Expected string key before ':' at line 1, column 4

Describe the bug
When I try to get to the Web U/I, I get the following error:

401: Unauthorized

To Reproduce
Steps to reproduce the behavior:
I updated to the latest Hassio Nextcloud Backup and went to the web interface.

Expected behavior
A clear and concise description of what you expected to happen.
I was expecting to see the Web U/I and to upload some snapshots.

System information

  • Home Assistant Version : HassOS 6.4
  • Home Assistant Supervisor Version : supervisor-2021.09.0
  • Nextcloud Version : 20.0.12
  • Addon version : 0.16.4
  • If any, reverse proxy in fort on Nextcloud :

Additional context
Add any other context about the problem here.

I think this is an issue communicating with HassOS somehow. Here are the logs from the plugin:

Add-on: 
 
-----------------------------------------------------------
 Add-on version: 
 You are running the latest version of this add-on.
parse error: Expected string key before ':' at line 1, column 4
[16:58:03] ERROR: Unknown HTTP error occured
 System:   ( / )
 Home Assistant Core: 
 Home Assistant Supervisor: 
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to INFO
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[16:58:04] INFO: Starting Node...
> [email protected] start
> node ./bin/www
[2021-09-26 16:58:10] [info]: 	Satus : Go !
[2021-09-26 16:58:14] [info]: 	Initializing and checking webdav client...
[2021-09-26 16:58:14] [info]: 	Starting auto clean cron...
[2021-09-26 16:58:14] [info]: 	Starting Cron...
[2021-09-26 16:58:15] [error]: 	Fail to fetch Hassio snapshots (Response code 403 (Forbidden))
[2021-09-26 16:58:15] [error]: 	Hassio API : FAIL !
[2021-09-26 16:58:15] [error]: 	... Response code 403 (Forbidden)
[2021-09-26 16:58:15] [error]: 	Response code 401 (Unauthorized)
[2021-09-26 16:58:15] [error]: 	Response code 401 (Unauthorized)
[2021-09-26 16:58:16] [info]: 	Nextcloud connection : Go !

[error]: uncaughtException: Cannot read property 'statusCode' of undefined TypeError: Cannot read property 'statusCode' of undefined

Hi,
firstly, thank you for your great addon!
Secondly I'm having problems to send a snapshot to NC. It was never succesful (I'm using addon from 3 days) but no manual and no auto snapshot are send to NC. Always I'm getting this same error (log attached below).

My HA setup:
arch | armv7l
chassis | embedded
dev | false
docker | true
docker_version | 19.03.8
hassio | true
host_os | HassOS 4.10
installation_type | Home Assistant
os_name | Linux
os_version | 4.19.126-v7
python_version | 3.7.7
supervisor | 227
timezone | Europe/Warsaw
version | 0.111.3
virtualenv | false

Log from addon:

[01:00:04] INFO: Starting Node...
> [email protected] start /opt/nextcloud_backup
> node --inspect=0.0.0.0:9226 ./bin/www 
Debugger listening on ws://0.0.0.0:9226/17c77a6a-5a5a-4df1-9ff2-156414f92769
For help, see: https://nodejs.org/en/docs/inspector
[2020-06-18 01:00:11] [info]: Satus : Go !
[2020-06-18 01:00:11] [info]: Initilizing and checking webdav client...
[2020-06-18 01:00:11] [info]: Starting auto clean cron...
[2020-06-18 01:00:11] [info]: Starting Cron...
[2020-06-18 01:00:12] [info]: Hassio API : Go !
[2020-06-18 01:00:13] [debug]: Nextcloud connection:  Success !
[2020-06-18 01:00:14] [info]: Nextcloud connection : Go !
[2020-06-18 02:00:00] [debug]: Cron triggered !
[2020-06-18 02:00:00] [info]: Creating new snapshot...
[2020-06-18 02:20:01] [error]: uncaughtException: Cannot read property 'statusCode' of undefined
TypeError: Cannot read property 'statusCode' of undefined
    at Request.request.post [as _callback] (/opt/nextcloud_backup/tools/hassioApiTools.js:173:26)
    at self.callback (/opt/nextcloud_backup/node_modules/request/request.js:185:22)
    at Request.emit (events.js:198:13)
    at ClientRequest.<anonymous> (/opt/nextcloud_backup/node_modules/request/request.js:819:16)
    at Object.onceWrapper (events.js:286:20)
    at ClientRequest.emit (events.js:198:13)
    at Socket.emitRequestTimeout (_http_client.js:673:40)
    at Object.onceWrapper (events.js:286:20)
    at Socket.emit (events.js:198:13)
    at Socket._onTimeout (net.js:443:8)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node --inspect=0.0.0.0:9226 ./bin/www `
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-06-18T00_20_04_209Z-debug.log

Thanks in advance for any help/fix.

Stop selected addons before back up

I All,

Would be nice to have a option where you can select addons that can be stopped before they get backup.
Some use dB and the dB can be corrupt when you want restore them.

When you stop them, and start them when the backup is done you will prevent a possible corrupt dB in your backups.

Cheers

Problem with self signed certificate

Hello!

I've been looking for a way ease my manual home-assistant-to-nextcloud backup - so thanks for the plugin - this would be exactly what I am looking for :).

I have a problem with the certificate I am using with my nextcloud installation.

I installed nextcloudpi (https://ownyourbits.com/nextcloudpi/) which by default would use a letsencrypt certificate; however; I don't own a public domain, and frankly I don't want to have my private nextcloud romaing around the internet. So basically I am running nextcloud with a self signed certificate (and it never ever will be available through a public domain)

When trying to connect the plugin throws an error about the self signed certificate:

[2020-10-09 19:38:24] [info]: Initilizing and checking webdav client...
[2020-10-09 19:38:25] [error]: Can't connect to Nextcloud (Error: self signed certificate) !
(node:248) UnhandledPromiseRejectionWarning: Can't connect to Nextcloud (Error: self signed certificate) !
(node:248) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1783)
(node:248) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[2020-10-10 09:52:47] [info]: Initilizing and checking webdav client...
[2020-10-10 09:52:47] [error]: Can't connect to Nextcloud (Error: self signed certificate) !
[2020-10-10 09:56:31] [info]: Initilizing and checking webdav client...
[2020-10-10 09:56:31] [error]: Can't connect to Nextcloud (Error: Request failed with status code 400) !

So I disabled SSL only with nextcloudpi and retried with http instead which got me a HTTP-400 (you can see it in the log as well). I can access my nextcloud interface in the browser via http and https without an error. I checked the server logs of my nextcloud installation, but so far have not been able to get any informations about the error in there.

Do you have any idea how to resolve this? A quick and dirty fix might be an option to disable ssl validation at all (as already mentioned this will only be available in my internal network, so this would suffice in my case even if it is dangerous in every other case), or maybe an option to manually ensure the certificate chain so I'd have a valid certificate chain again. Or of course I'd be happy to use no ssl with the backup as well - but the http 400 prevents that (of course there is no guarantee that the http 400 will turn up with ssl as well when the self signed certificate problem is gone).

thanks in advance!
best regards
Christian

Can't connect to Nextcloud (Error: getaddrinfo EAI_AGAIN https) !

Hi there,

Was hoping to try your plugin! Sounds like exactly the thing I was looking for. However I can't get it to work. Does your plugin use different DNS servers then the system? I keep getting the "Can't connect to Nextcloud (Error: getaddrinfo EAI_AGAIN https) !" while my browser is perfectly able to resolve my Nextcloud instance and I was able to add your repo (so DNS works on HomeAssistant). I block other DNS traffic on my network since I use blocklists etc. So if your plugin uses different servers that's the problem. Any way to set them manually if that's the case? Thanks for developing this plugin! Could be a lifesaver when it works!

New add-on to get all the info of Nextcloud in sensor entities

Hi,

Love your Backup solution.... Your add on ignore the self signed SSL Cert.
The nextcloud integration does not work with self signed Certs...

Maybe you can build a Add-on To collect all the info from:

https:///ocs/v2.php/apps/serverinfo/api/v1/info

Would be great to have those information in sensors 👍

Cosmetic change

Hi ALl,

When filename is long the date of creation goes to next line. Its not nice. Maybe this can be changed?
Always creation data on next line below the filename? Or font size smaller?

Schermafbeelding 2020-11-24 om 13 53 09

Snapshot show up as protected without using a password

Describe the bug
I got no password set in settings > backup > security.
Yet restoring snapshots is not possible due to a wrong password. Also snapshots show up as "protected" = "true".

To Reproduce
Disable password protection for snapshos and manually trigger a snapshot within NC Backup.

Expected behavior
Be able to restore snapshots without a password and snapshots show as "protected" = "false".

System information

  • Home Assistant Version : Home Assistant OS 5.13
  • Home Assistant Supervisor Version : supervisor-2021.05.4
  • Nextcloud Version : 21
  • Addon version : 0.16.1
  • If any, reverse proxy in fort on Nextcloud : none

Additional context
What password is currently being used? I mean I set no password, yet its still encrypted?

backup completes but uploads to nextcloud with 0 bytes

Backup completes but uploads a 0 bytes corupt archive to nextcloud, here is the log:

[2020-02-16 11:04:37] [error]: uncaughtException: Cannot create property 'Symbol(level)' on string '...Upload finish !'
TypeError: Cannot create property 'Symbol(level)' on string '...Upload finish !'
at DerivedLogger.log (/opt/nextcloud_backup/node_modules/winston/lib/winston/logger.js:208:20)
at Request.request.put.on.on.on (/opt/nextcloud_backup/tools/webdavTools.js:198:32)
at Request.emit (events.js:198:13)
at Request.onRequestResponse (/opt/nextcloud_backup/node_modules/request/request.js:1066:10)
at ClientRequest.emit (events.js:198:13)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:565:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:111:17)
at TLSSocket.socketOnData (_http_client.js:451:20)
at TLSSocket.emit (events.js:198:13)
at addChunk (_stream_readable.js:288:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: node --inspect=0.0.0.0:9226 ./bin/www
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-02-16T09_04_40_635Z-debug.log

2020-02-16T09_04_40_635Z-debug.log contains:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]prestart: [email protected]
6 info lifecycle [email protected]
start: [email protected]
7 verbose lifecycle [email protected]start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]
start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/opt/nextcloud_backup/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
9 verbose lifecycle [email protected]start: CWD: /opt/nextcloud_backup
10 silly lifecycle [email protected]
start: Args: [ '-c', 'node --inspect=0.0.0.0:9226 ./bin/www ' ]
11 silly lifecycle [email protected]start: Returned: code: 1 signal: null
12 info lifecycle [email protected]
start: Failed to exec start script
13 verbose stack Error: [email protected] start: node --inspect=0.0.0.0:9226 ./bin/www
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd /opt/nextcloud_backup
16 verbose Linux 5.3.0-0.bpo.2-amd64
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
18 verbose node v10.19.0
19 verbose npm v6.13.4
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: node --inspect=0.0.0.0:9226 ./bin/www
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Auto clean

  • Add auto clean
  • Add option to enable auto clean
  • Add option to specify the max number of backup to keep (Local and in Nextcloud)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.