ikifar2012 / remote-backup-addon

Automatically create and backup HA snapshots using SCP
30 stars 4 forks source link

Is this a problem?? #70

Closed SirGoodenough closed 1 year ago

SirGoodenough commented 1 year ago

Back-up appears to be working fine, but I spotted something that seems odd. This is my 'up north' instance, very vanilla no exclusions for the backup, a few exclusions in the rsync.

[05:18:16] INFO: Creating local backup with password.
[05:18:16] INFO: Creating partial backup: "SomerHome_backup 2022-09-14 05-18"
[05:18:17] NOTICE: Excluded folder(s):
null
[05:18:17] NOTICE: Excluded addon(s):
null
[05:18:48] INFO: Backup created: 12438fdb
[05:18:48] INFO: Copying backup using SFTP/SCP.
[05:28:21] INFO: Copying backup using rsync.
[05:28:22] NOTICE: Excluded rsync file patterns:
/config/*.db-shm
/config/*.db-wal
/config/*.db
*.tar
keyfile
*.tdm
*.cache
home-assistant*.*
*.moxilla
*.vmc
[05:28:27] INFO: Backup process done!

Notice it still says partial back-up and it lists the things it's ignoring as null. This might be another case of null seeping in from the config.

The config does not mention those 2 excludes, yet it says they are there when the backup happens and are null and a partial backup is the result... (edited)

backup_custom_prefix: SomerHome_backup
backup_friendly_name: true
backup_keep_local: "10"
remote_host: "!secret Eldrad_host"
remote_key: HA_ecdsa
remote_port: 22
remote_user: "off"
rsync_enabled: true
rsync_exclude:
  - /config/*.db-shm
  - /config/*.db-wal
  - /config/*.db
  - "*.tar"
  - keyfile
  - "*.tdm"
  - "*.cache"
  - home-assistant*.*
  - "*.moxilla"
  - "*.vmc"
rsync_rootfolder: "!secret EldradB_rsync"
ssh_enabled: true
ssh_remote_directory: "!secret EldradB_path"
backup_password: "!secret EldradB_pass"

Now maybe this is intentional, I don't know. All seems to work. I was just wondering if this is working as intended, or should the absence of config exclude entries mean a complete backup?

In my other instance there are actual excludes...

[06:18:20] INFO: Creating local backup with password.
[06:18:20] INFO: Creating partial backup: "ChaloupkaAbode_backup 2022-09-14 06-18"
[06:18:20] NOTICE: Excluded folder(s):
media
[06:18:20] NOTICE: Excluded addon(s):
a0d7b954_plex
[06:23:05] INFO: Backup created: 00949fbb
[06:23:05] INFO: Copying backup using SFTP/SCP.
[06:23:20] NOTICE: Deleting local backup: 13e42930
[06:23:21] INFO: Backup process done!
rsync_rootfolder: "!secret 74_rsync"
ssh_enabled: true
ssh_remote_directory: "!secret 74_path"
backup_exclude_addons:
  - a0d7b954_plex
backup_exclude_folders:
  - media
backup_password: "!secret backup_password"

I'm thinking if neither exclude entry is in config, then a full backup could be done.

patman15 commented 1 year ago

Hmm, it seems there is an issue with non-existent config entries, similar to the password issue. The null shouldn't happen and it didn't on my instance. Can you please post a full log, especially the HA version would be of interest in this case. Thanks! edit: I think it is a variable type setting issue. We'll need to do a general clean-up of variables and their types. I have not payed too much attention to this type of issue. Sorry, will fix it.

SirGoodenough commented 1 year ago
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/00-banner.sh
-----------------------------------------------------------
 Add-on: Remote Backup
 Automatically create and transfer HA backups using SFTP (SCP), rsync, or rclone (experimental)
-----------------------------------------------------------
 Add-on version: 2022.9.2
 You are running the latest version of this add-on.
 System: Home Assistant OS 8.5  (amd64 / generic-x86-64)
 Home Assistant Core: 2022.9.4
 Home Assistant Supervisor: 2022.08.6
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
cont-init: info: /etc/cont-init.d/00-banner.sh exited 0
cont-init: info: running /etc/cont-init.d/01-log-level.sh
cont-init: info: /etc/cont-init.d/01-log-level.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[05:18:15] INFO: Adding SSH configuration.
[05:18:16] WARNING: Missing known_hosts file! Retrieving public key of remote host 10.x.x.x
# 10.x.x.x:22 SSH-2.0-OpenSSH_8.9p1 Ubuntu-3
[05:18:17] INFO: Creating local backup with password.
[05:18:17] INFO: Creating partial backup: "SomerHome_backup 2022-09-15 05-18"
[05:18:17] NOTICE: Excluded folder(s):
null
[05:18:17] NOTICE: Excluded addon(s):
null
[05:18:46] INFO: Backup created: 9ca78db0
[05:18:46] INFO: Copying backup using SFTP/SCP.
[05:26:58] INFO: Copying backup using rsync.
[05:26:58] NOTICE: Excluded rsync file patterns:
/config/*.db-shm
/config/*.db-wal
/config/*.db
*.tar
keyfile
*.tdm
*.cache
home-assistant*.*
*.moxilla
*.vmc
[05:27:03] NOTICE: Deleting local backup: df2e3734
[05:27:03] INFO: Backup process done!
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
backup_custom_prefix: SomerHome_backup
backup_friendly_name: true
backup_keep_local: "10"
remote_host: "!secret Eldrad_host"
remote_key: HA_ecdsa
remote_port: 22
remote_user: "off"
rsync_enabled: true
rsync_exclude:
  - /config/*.db-shm
  - /config/*.db-wal
  - /config/*.db
  - "*.tar"
  - keyfile
  - "*.tdm"
  - "*.cache"
  - home-assistant*.*
  - "*.moxilla"
  - "*.vmc"
rsync_rootfolder: "!secret EldradB_rsync"
ssh_enabled: true
ssh_remote_directory: "!secret EldradB_path"
backup_password: "!secret EldradB_pass"
ikifar2012 commented 1 year ago

I was able to recreate, the solution as of right now seems to be to switch to bashio::config.has_value as it checks for null, I will try to get an update out within the coming days

patman15 commented 1 year ago

@ikifar2012 the https://github.com/ikifar2012/remote-backup-addon/blob/b6f76a22e77408d104edb34b3bb27466363bfbaa/remote-backup/run.sh#L109 and similar should not reference the variable but the config entry of course: if bashio::config.has_value "backup_exclude_addons" || bashio::config.has_value "backup_exclude_folders"; then or I guess removing the quotes should also work.