Last active
October 27, 2024 16:31
-
-
Save MathiasReker/f1c8cadfe0d01add5e4613f1d43b3cb2 to your computer and use it in GitHub Desktop.
Revisions
-
MathiasReker revised this gist
Oct 27, 2024 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -59,7 +59,6 @@ COMMIT_MESSAGE=":safety_vest: [$HA_VERSION]: $COMMIT_CURRENT_DATE" sudo git add /backup sudo git commit -m "$COMMIT_MESSAGE" sudo git push -u origin master -f ``` # Create a NodeRed flow that creates a full backup and run /backup.sh afterwards -
MathiasReker revised this gist
Oct 27, 2024 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -59,6 +59,7 @@ COMMIT_MESSAGE=":safety_vest: [$HA_VERSION]: $COMMIT_CURRENT_DATE" sudo git add /backup sudo git commit -m "$COMMIT_MESSAGE" sudo git push -u origin master -f sudo git lfs prune ``` # Create a NodeRed flow that creates a full backup and run /backup.sh afterwards -
MathiasReker revised this gist
Oct 27, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # Home Assistant Backup to GitHub This guide explain how to automates the process of backing up your Home Assistant backup files (`/backup` directory) to a private GitHub repository. It includes steps for setting up GitHub, configuring Git, and running backups from a NodeRed flow. -
MathiasReker revised this gist
Oct 27, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ This guide explain how to automates the process of backing up your Home Assistan - Configure the addon with a password. You need this password later on in the Node Red flow. ### 3. Initialize Git Repository SSH into the server and run the following commands in your terminal: ``` cd / -
MathiasReker revised this gist
Oct 27, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # Home Assistant Backup This guide explain how to automates the process of backing up your Home Assistant backup files (`/backup` directory) to a private GitHub repository. It includes steps for setting up GitHub, configuring Git, and running backups from a NodeRed flow. > This guide is for advanced users. This guide is for Alpine Linux. -
MathiasReker revised this gist
Oct 27, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # Home Assistant Backup This guide explain how to automates the process of backing up your Home Assistant backup files (`/backup` directory) to a private GitHub repository. It includes steps for setting up GitHub, configuring Git, and running backups via NodeRed. > This guide is for advanced users. This guide is for Alpine Linux. -
MathiasReker revised this gist
Oct 27, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # Home Assistant Backup This guide explain how to automates the process of backing up your Home Assistant backup files (`/backup` directory) to a private GitHub repository. It includes steps for setting up GitHub, configuring Git, and running backups via a NodeRed. > This guide is for advanced users. This guide is for Alpine Linux. -
MathiasReker revised this gist
Oct 27, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # Home Assistant Backup This guide explain how to automates the process of backing up your Home Assistant backup files (`/backup` directory) to a private GitHub repository. It includes steps for setting up GitHub, configuring Git, and running backups via a script. > This guide is for advanced users. This guide is for Alpine Linux. -
MathiasReker revised this gist
Oct 27, 2024 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,7 +26,7 @@ sudo echo "/*\n!/backup/\n!.gitattributes" >> .gitignore sudo git remote add origin https://REPLACE_WITH_USERNAME:[email protected]/REPLACE_WITH_USERNAME/homeassistant-backup.git ``` ### Install Git LFS to uplodad files > 100 MB ``` sudo apk add git-lfs sudo git lfs install @@ -37,7 +37,7 @@ sudo git commit -m "Track .tar files with Git LFS" sudo git push -u origin master -f ``` # Create the backup script ``` cd / sudo nano backup.sh @@ -61,7 +61,7 @@ sudo git commit -m "$COMMIT_MESSAGE" sudo git push -u origin master -f ``` # Create a NodeRed flow that creates a full backup and run /backup.sh afterwards ``` [{"id":"fd49290bbbf4cafa","type":"exec","z":"a6541044a83813f3","command":"sshpass -pREPLACE_THIS_WITH_PASSWORD ssh -o StrictHostKeyChecking=no [email protected] 'bash /backup.sh'","addpay":"","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":490,"y":300,"wires":[[],[],[]]}] -
MathiasReker revised this gist
Oct 27, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # Home Assistant Backup This project automates the process of backing up your Home Assistant backup files (`/backup` directory) to a private GitHub repository. It includes steps for setting up GitHub, configuring Git, and running backups via a script. > This guide is for advanced users. This guide is for Alpine Linux. -
MathiasReker revised this gist
Oct 27, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -38,7 +38,7 @@ sudo git push -u origin master -f ``` # Create the backup script: ``` cd / sudo nano backup.sh ``` -
MathiasReker revised this gist
Oct 27, 2024 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,15 +19,15 @@ This project automates the process of backing up your Home Assistant configurati ### 3. Initialize Git Repository SSH in to the server and run the following commands in your terminal: ``` cd / sudo git init sudo echo "/*\n!/backup/\n!.gitattributes" >> .gitignore sudo git remote add origin https://REPLACE_WITH_USERNAME:[email protected]/REPLACE_WITH_USERNAME/homeassistant-backup.git ``` #### Install Git LFS to uplodad files > 100 MB ``` sudo apk add git-lfs sudo git lfs install sudo git lfs track "*.tar" @@ -45,7 +45,7 @@ sudo nano backup.sh Add: ``` #!/usr/bin/env bash set -e HA_VERSION_FILE="/homeassistant/.HA_VERSION" @@ -63,6 +63,6 @@ sudo git push -u origin master -f # Create a NodeRed flow that creates a full backup and run /backup.sh afterwards: ``` [{"id":"fd49290bbbf4cafa","type":"exec","z":"a6541044a83813f3","command":"sshpass -pREPLACE_THIS_WITH_PASSWORD ssh -o StrictHostKeyChecking=no [email protected] 'bash /backup.sh'","addpay":"","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":490,"y":300,"wires":[[],[],[]]}] ``` -
MathiasReker renamed this gist
Oct 27, 2024 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
MathiasReker created this gist
Oct 27, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,68 @@ # Home Assistant Backup This project automates the process of backing up your Home Assistant configuration to a private GitHub repository. It includes steps for setting up GitHub, configuring Git, and running backups via a script. > This guide is for advanced users. This guide is for Alpine Linux. ## Setup Instructions ### 1. GitHub Repository 1. Go to [GitHub](https://github.com). 2. Create a private repository named `homeassistant-backup`. 3. Set the default branch to `master`. 4. Generate a token with no expiration and full permissions for this specific repository. ### 2. Install Required Add-ons - Install the **Advanced SSH & Web Terminal** add-on in Home Assistant. - Configure the addon with a password. You need this password later on in the Node Red flow. ### 3. Initialize Git Repository SSH in to the server and run the following commands in your terminal: ```bash cd / sudo git init sudo echo "/*\n!/backup/\n!.gitattributes" >> .gitignore sudo git remote add origin https://REPLACE_WITH_USERNAME:[email protected]/REPLACE_WITH_USERNAME/homeassistant-backup.git ``` #### Install Git LFS to uplodad files > 100 MB bash``` sudo apk add git-lfs sudo git lfs install sudo git lfs track "*.tar" sudo git add .gitattributes .gitignore sudo git commit -m "Track .tar files with Git LFS" sudo git push -u origin master -f ``` # Create the backup script: bash``` cd / sudo nano backup.sh ``` Add: bash``` #!/usr/bin/env bash set -e HA_VERSION_FILE="/homeassistant/.HA_VERSION" if [[ ! -f $HA_VERSION_FILE ]]; then echo "Error: Home Assistant version file not found at $HA_VERSION_FILE" exit 1 fi HA_VERSION=$(cat "$HA_VERSION_FILE") COMMIT_CURRENT_DATE=$(date +'%d-%m-%Y %H:%M:%S') COMMIT_MESSAGE=":safety_vest: [$HA_VERSION]: $COMMIT_CURRENT_DATE" sudo git add /backup sudo git commit -m "$COMMIT_MESSAGE" sudo git push -u origin master -f ``` # Create a NodeRed flow that creates a full backup and run /backup.sh afterwards: json``` [{"id":"fd49290bbbf4cafa","type":"exec","z":"a6541044a83813f3","command":"sshpass -pREPLACE_THIS_WITH_PASSWORD ssh -o StrictHostKeyChecking=no [email protected] 'bash /backup.sh'","addpay":"","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":490,"y":300,"wires":[[],[],[]]}] ```