Skip to content

Automatically create Hass.io snapshots to remote server location.

License

Notifications You must be signed in to change notification settings

rccoleman/hassio-remote-backup

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Remote Backup

GitHub Release Build Status GitHub license

Automatically create Hass.io snapshots to remote server location using SCP.


Table of Contents

About

Note: For anyone using this as a local addon, it appears that the latest base image now requires updating to the new "OPENSSH" private key format. If you were previously using a private key that started "RSA PRIVATE KEY", you'll need to follow the instructions here to update your private key and add the new key in the addon config. Using the older key format will result in "Load pubkey "xxx": Invalid format" as described at the link.

When the add-on is started the following happens:

  1. Snapshot are being created locally with a timestamp name, e.g. Automatic backup 2018-03-04 04:00.
  2. The snapshot are copied to the specified remote location using SCP.
  3. The local backup are removed locally again.

Note the filenames of the backup are given by their assigned slug.

Installation

  1. Add the add-ons repository to your Hass.io instance: https://github.com/rccoleman/hassio-remote-backup.
  2. Install the Remote Backup add-on.
  3. Configure the add-on with your SSH credentials and desired output directory (see configuration below).

See my repository of addons for more information.

Configuration

Parameter Required Description
ssh_host Yes The hostname/url to the remote server.
ssh_port Yes The port to use to SCP on to the server.
ssh_user Yes Username to use for SCP.
ssh_key Yes The ssh key to use. Not that it should NOT be password protected.
remote_directory Yes The directory to put the backups on the remote server.
zip_password No If set then the backup will be contained in a password protected zip
keep_local_backup No Control how many local backups you want to preserve. Default ("") is to keep no local backups created from this addon. If all then all loocal backups will be preserved. A positive integer will determine how many of the latest backups will be preserved. Note this will delete other local backups created outside this addon.

Example: daily backups at 4 AM

Personally I've added the following automation to make a daily backup. It is password-protected and the last two weeks of snapshots are kept locally as well.

configuration.yaml

automations:
  - alias: Daily Backup at 4 AM
  trigger:
    platform: time
    at: '4:00:00'
  action:
  - service: hassio.addon_start
    data:
      addon: ce20243c_remote_backup

Add-on configuration:

{
  "ssh_host": "192.168.1.2",
  "ssh_port": 22,
  "ssh_user": "root",
  "ssh_key": [
"-----BEGIN RSA PRIVATE KEY-----",
"MIICXAIBAAKBgQDTkdD4ya/Qxz5xKaKojVIOVWjyeyEoEuAafAvYvppqmaBhyh4N",
"5av4i87y8tdGusdq7V0Zj0+js4jEdvJRDrXJBrp1neLfsjkF6t1XLfrA51Ll9SXF",
"...",
"X+6r/gTvUEQv1ufAuUE5wKcq9FsbnTa3FOF0PdQDWl0=",
"-----END RSA PRIVATE KEY-----"
  ],
  "remote_directory": "~/hassio-backups",
  "zip_password": "password_protect_it",
  "keep_local_backup": "14"
}

Note: This is just an example, don't copy and past it! Create your own!

Changelog & Releases

This repository keeps a change log. The format of the log is based on Keep a Changelog.

Releases are based on Semantic Versioning, and use the format of MAJOR.MINOR.PATCH. In a nutshell, the version will be incremented based on the following:

  • MAJOR: Incompatible or major changes.
  • MINOR: Backwards-compatible new features and enhancements.
  • PATCH: Backwards-compatible bugfixes and package updates.

Docker status

Docker Architecture Docker Version Docker Layers Docker Pulls

Docker Architecture Docker Version Docker Layers Docker Pulls

Docker Architecture Docker Version Docker Layers Docker Pulls

Docker Architecture Docker Version Docker Layers Docker Pulls

About

Automatically create Hass.io snapshots to remote server location.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 74.2%
  • Dockerfile 25.8%