danielwelch / hassio-dropbox-sync

Back up your Hass.io snapshots and other local files to Dropbox
Apache License 2.0
132 stars 37 forks source link

Errror in supervisor log - config 'startup' with 'before' is deprecated. #41

Closed Pirol62 closed 3 years ago

Pirol62 commented 3 years ago

The following error shall be reported:

21-02-09 06:30:45 WARNING (MainThread) [supervisor.addons.validate] Add-on config 'startup' with 'before' is deprecated. Please report this to the maintainer of Dropbox Sync
21-02-09 06:30:46 WARNING (MainThread) [supervisor.addons.validate] Add-on config 'startup' with 'before' is deprecated. Please report this to the maintainer of Dropbox Sync

Home Assistant OS Version: 2021.1.4 Supervicor Version: 2021.02.5

aheath70 commented 3 years ago

Same version of Home Assistant, noticed this on supervisor 2021.02.5. Upgraded to supervisor 2021.02.6 and the warning persists.

DavidFW1960 commented 3 years ago

Same here as well

DarKOrange75 commented 3 years ago

Same warning here with supervisor 2021.02.6

DavidFW1960 commented 3 years ago

So I've loved this addon for years but no input at all from the dev and 12 months since any update and I'm bailing. There's a pretty good dropbox uploader (that already supports the new dropbox oAuth coming to a dropbox near you in Sept as mandatory) that I am using with a shell script that reloads snapshots, deletes snapshots older than 5 days as well... yes it's hacky but I can ditch unsupported stuff so job done.

No good for HA OS but there is also a docker version of it you could load with Portainer maybe but on my Supervised install it's going to be functionally identical.

Should Daniel fix this I may return..

Pirol62 commented 3 years ago

@DavidFW1960 I agree totally. Could you send a link to the solution and maybe give an example of the scripts?

DavidFW1960 commented 3 years ago

Ha! I knew someone would want to know that lol. Here is the repo: https://github.com/andreafabrizi/Dropbox-Uploader You really only need download the dropbox_uploader.sh script (in RAW mode) and can ignore everything else.

When you first run the script it will detect that the dropbox configuration doesn't exist and will lead you through creating the dropbox app step by step. Only landmine is at the end it will ask if the details are correct and you have to answer y in lowercase only. Any other answer will dump you out without saving. Dropbox will then create a folder for the app.

Then I use this script with a cronjob to run it overnight after HA has created my snapshot. I'd schedule the cron to run maybe 3 hours after HA creates the backup..

My backup.sh is here:

#!/bin/bash

# Set Variables
TMP_DIR="/tmp"
DATE=$(date '+%F')
BKP_FILE="$TMP_DIR/docker_$DATE.tar.gz"
BKP_DIRS="/home/docker"
BKP_FILE1="$TMP_DIR/david_$DATE.tar.gz"
BKP_DIRS1="/home/david"
BKP_DIRS2="/usr/share/hassio/backup"
DROPBOX_UPLOADER=/home/david/dropbox_uploader.sh

# Compress Docker and Upload to DropBox
/bin/tar -zcf "$BKP_FILE" $BKP_DIRS
$DROPBOX_UPLOADER -f /home/david/.dropbox_uploader upload "$BKP_FILE" /nuc

# Move Docker Backup to USB and remove
/bin/cp "$BKP_FILE" /var/usb-drive
/bin/rm -fr "$BKP_FILE"

# Compress Home Folder and Upload to DropBox
/bin/tar -zcf "$BKP_FILE1" $BKP_DIRS1
$DROPBOX_UPLOADER -f /home/david/.dropbox_uploader upload "$BKP_FILE1" /nuc

# Move Home Backup to USB and remove
/bin/cp "$BKP_FILE1" /var/usb-drive
/bin/rm -fr "$BKP_FILE1"

# Copy Home Assistant Snapshots to DropBox
$DROPBOX_UPLOADER -sf /home/david/.dropbox_uploader upload "$BKP_DIRS2" /homeassistant

# Clean up older snapshots - removes older than 5 days
find /usr/share/hassio/backup/* -mtime +4 -exec rm {} \;

# Reload Snapshots in Home Assistant
docker exec -it addon_a0d7b954_ssh ha sn reload

It backups all my docker configs in /home/docker and also my home directory /home/david It uploads those to dropbox and moves them to a USB drive on my NUC as well. Then it copies only new snapshots to dropbox and removes any older than 5 days and then reloads snapshots in HA (docker exec to the ssh & web terminal addon)

Check location for backups in HA is /usr/share/hassio/backup it should be but check it!

All those scripts live in /home/david Make sure they are executable! sudo crontab -e

00 04 * * * /home/david/backup.sh > /dev/null 2>&1 > /var/log/backup.log

Crontab can be tricky with permissions as well.. My backup runs at 4am every day.

aheath70 commented 3 years ago

I have removed this add-on and effectively replaced my Dropbox backups with Google Drive backups using this.

https://github.com/sabeechen/hassio-google-drive-backup

More feature rich (support for maximum number of backups on both the local drive and the Google Drive as well as generational backups). So far, I am very, very happy with the Google Drive add-on.

RogerSelwyn commented 3 years ago

For now I've forked the two repositories and edited to change the startup parameter to 'application'. I've not done any docker development, so I'm not sure I'm up to enhancing it. I'll chew on it, but for now the error is removed, feel free to use if you wish.

Pirol62 commented 3 years ago

Already moved to google drive as well. The add on is straight forward, easy to configure and has more options. So I could get rid of old automations. My recommendations!

Pirol62 commented 3 years ago

As the problem is solved, I close this thread.

Pirol62 commented 3 years ago

Ah, sorry. I interpreted RogerSelwyn's post as a solution. Ok, as the warning still exist, I reopen it.

RogerSelwyn commented 3 years ago

For reference I'm moving away from this component. The script I now have is based on David's but I run from NodeRed so structured slightly different. I don't have the ssh restart in the script, I'll be adding that to NodeRed.

I also found the first run dumped the config file in the root, so I re-ran with the -f parameter to put it alongside the script. I should probably put it somewhere else for security. Also the first upload run create the /home folder and uploaded the snapshots there, then the second one created /home/backup and uploaded there. I suspect a minor bug. All works fine after that.

#!/usr/bin/env bash

mkdir /mnt/data
mount /dev/sda1 /mnt/data

# Set Variables
DROPBOX_UPLOADER=/config/shell_scripts/dropbox_uploader.sh
BKP_CONFIG=/config/shell_scripts/.dropbox_uploader
BKP_DIR=/mnt/data/usr/share/hassio/backup
BKP_FOLDER=/home

# Copy Home Assistant Snapshots to DropBox
$DROPBOX_UPLOADER -sf $BKP_CONFIG upload "$BKP_DIR" $BKP_FOLDER

# Clean up older snapshots - removes older than 5 days
find "$BKP_DIR"/* -mtime +4 -exec rm {} \;
umount /mnt/data
rmdir /mnt/data
DavidFW1960 commented 3 years ago

I don't have the ssh restart in the script, I'll be adding that to NodeRed.

its a ha sn reload not restart ssh... that command makes HA reload the snapshots which you need to do if you remove them for HA to be able to 'see' them.

My script and config are just in my home directory.

Good job though...

RogerSelwyn commented 3 years ago

I've evolved this slightly. I was running it from NodeRed via a shell command, but those seem to be limited to 60 seconds. But you can run a command in the 'SSH & Web Terminal' add-on, (which I imagine most people have installed), which I don't believe has this restriction. Also no longer need to do the mount/unmount since the backup folder is natively accessible to the terminal. You need to have 'share_sessions' set to false otherwise you get an error.

#!/usr/bin/env bash

# Set Variables
echo Set Variables
DROPBOX_UPLOADER=/config/shell_scripts/dropbox_uploader.sh
BKP_CONFIG=/config/shell_scripts/.dropbox_uploader
BKP_DIR=/backup
BKP_FOLDER=/home

# Copy Home Assistant Snapshots to DropBox
echo Sync Dropbox
$DROPBOX_UPLOADER -sf $BKP_CONFIG upload "$BKP_DIR" $BKP_FOLDER

# Clean up older snapshots - removes older than 5 days
echo Clean up old snapshots
find "$BKP_DIR"/* -mtime +4 -exec rm {} \;

# Reload Snapshots in Home Assistant
echo Reload snapshots
ha sn reload

The service call I'm doing is (which I actually do from NodeRed):

service: hassio.addon_stdin
data:
  addon: a0d7b954_ssh
  input: /config/shell_scripts/run_dropbox_sync.sh >/config/logs/dropbox.log
Pirol62 commented 3 years ago

@RogerSelwyn Hi, I could successfully cal the dropbox_uploader.sh and registered the access token Found out, that the information is stored in .dropbox_uploader but executin the run_dropbox_sync does not work. Where does the addon "number_ssh" comes from?

RogerSelwyn commented 3 years ago

@RogerSelwyn Hi, I could successfully cal the dropbox_uploader.sh and registered the access token Found out, that the information is stored in .dropbox_uploader but executin the run_dropbox_sync does not work. Where does the addon "number_ssh" comes from?

This is the add-on - https://github.com/hassio-addons/addon-ssh. It is a Home Assistant Community Add-On which should be available to you by default.

Pirol62 commented 3 years ago

Ok, found that and it works. One last question - sorry ;-) I have a swap file in the backup folder _swap.swap I would like to set the ignore option. Therefore I found the description: "\t-x Ignores/excludes directories or files from syncing. -x filename -x directoryname. example: -x .git" But where and how do i have to set this option? The syntax is not clear for me.

RogerSelwyn commented 3 years ago

Add it in this line $DROPBOX_UPLOADER -sf $BKP_CONFIG upload "$BKP_DIR" $BKP_FOLDER. This resolves in my environment to:

/config/shell_scripts/dropbox_uploader.sh -sf /config/shell_scripts/.dropbox_uploader upload /backup /home

I think you will need: $DROPBOX_UPLOADER -sf $BKP_CONFIG -x _swap.swap upload "$BKP_DIR" $BKP_FOLDER

Pirol62 commented 3 years ago

yees, thank you. Thats it :-)

Pirol62 commented 3 years ago

hmm...it's not my day. The sync will not work even the scripts are ok. I must have issues with my folders. My config:

DROPBOX_UPLOADER=/config/shell_script/dropbox_uploader.sh
BKP_CONFIG=/config/shell_script/.dropbox_uploader
BKP_DIR=/backup
BKP_FOLDER=/backups

The dropbox_app has an app folder name "myUploaderfromHA"

running the script brings: image

Oviously, the folder cannot be created and therefore the uploads are failing. I have no further idea what to do - sorry, it's friday. I'm obviously through :-( What could be wrong?

RogerSelwyn commented 3 years ago

I think you need to grant the GitHub app you created the right access. Not sure I can help more than that. The Dropbox sync GitHub gives details on how to set it up.

Pirol62 commented 3 years ago

ok, thank you. I will look at this. Have a great weekend

Pirol62 commented 3 years ago

We can close this. The component is not supported anymore. Some moved to GoogleDriveBackup and some use the alternate solution described above.