I’m still learning. It worked fine with the configuration file. Thanks!
Great! Could you share how you do?
Sure! I gotta run pick up the kids so can post more detail later if need be. Basically, the flow is like this:
Prereqs:
- Install rclone on the host machine
- Setup a google drive remote (or any rclone remote for that matter)
- Setup ssh access from the node-RED container into the host machine using pre-shared keys
#3 is particularly tricky. Doing this will allow you to make command line executions on the host from node-RED. I ended up bind mounting my id_rsa and id_rsa.pub keys into the node-RED container using docker compose. Now I can use my normal keys in the container and not get overwhelmed with all the keys floating out there:
volumes:
- /home/pi/node-red:/data
- /home/pi/.ssh/id_rsa:/data/ssh/id_rsa:ro
- /home/pi/.ssh/id_rsa.pub:/data/ssh/id_rsa.pub:ro
Now, with all of this out of the way, you can use the exec
node to first tar
the config directory, then mv
move the tar to a backup folder, then last use rclone
to push the files to google drive. I added a switch in node-RED to let me trigger a backup from HA, plus I also use an inject node to trigger a backup each morning at 1:00am:
Here’s an example of one of the tar
commands:
ssh -o StrictHostKeyChecking=no -i /data/ssh/id_rsa [email protected] sudo tar cvf node-red.tar -C / home/pi/node-red/
Here’s the move:
ssh -o StrictHostKeyChecking=no -i /data/ssh/id_rsa [email protected] sudo mv home-assistant.tar /home/pi/backup
And here’s the backup to Google Drive:
ssh -o StrictHostKeyChecking=no -i /data/ssh/id_rsa [email protected] rclone copy "/home/pi/backup" "Drive:Backup"
Last, I get a push notification on error. Seems to work great so far. I’m much more visual, so I like doing it this way versus doing something with a shell script and systemd or whatever. I’m still tweaking it, and I’m sure there are nodes that make this even easier (like the ssh
node). But this works, so I’m happy.
This is also how I installed it almost two years ago… and how I reinstalled it twice when I got new systems … works fine… you just have to make sure it starts on boot and the settings in mosquitto.conf are correct… never touched it since the initial setup