Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Simplify expire logic and update to hassio-cli 3.3.1 #34

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/homeassistant-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: 'Publish'

on:
release:
types: [published]

jobs:
publish:
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Publish
uses: home-assistant/builder@master
with:
args: |
--all \
--target remote-backup \
--image hassio-remote-backup-{arch} \
--version ${{ github.event.release.tag_name }} \
--docker-hub nigelm

# end
22 changes: 22 additions & 0 deletions .github/workflows/homeassistant-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: 'Test'

on: [push, pull_request]

jobs:
build:
name: Test build
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2
- name: Test build
uses: home-assistant/builder@master
with:
args: |
--test \
--all \
--target remote-backup \
--image hassio-remote-backup-{arch} \
--docker-hub nigelm

# end
8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

47 changes: 43 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,58 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog][keep-a-changelog] this project adheres to [Semantic Versioning][semantic-versioning].

## [v0.4.3++] (????-??-??)

[Full Changelog](https://github.com/nigelm/hassio-remote-backup/compare/v0.3.2...master)

### Fixed

## [v0.4.3] (2021-02-27)

- Updated `hassio-cli` to version 3.1.1
- Modified `run.sh` hassio calls to work with version 3.1.1
- Converted snapshot removal selection logic to a jq filter
- Merged in changes from rccoleman - https://github.com/rccoleman/hassio-remote-backup
- Updated `hassio-cli` to 4.3.0
- Added README notes
- Reformatted run.sh for change of `hassio-cli` binary name
- Updated `hassio-cli` to 4.10.1
- Since the previous maintainers do not appear to be keeping up with this, and
have not got available docker builds, I have updated the references to point
to my repositories.
- Fixed updating changelog on release :-)

## [v0.3.2] (2018-10-12)

[Full Changelog](https://github.com/overkill32/hassio-remote-backup/compare/v0.3.1...v0.3.2)

### Fixed

- Role-based permissions in hassio - use `backup` permissions

## [v0.3.1] (2018-10-12)

[Full Changelog](https://github.com/overkill32/hassio-remote-backup/compare/v0.3.0...v0.3.1)

### Fixed

- Fix `config.json` for multidigit `keep_local_backup` values
- Role-based permissions in hassio - use `manager` permissions

## [v0.3.0] (2018-03-12)

[Full Changelog](https://github.com/mr-bjerre/hassio-remote-backup/compare/v0.2.1...v0.3.0)
[Full Changelog](https://github.com/overkill32/hassio-remote-backup/compare/v0.2.1...v0.3.0)

### Added

- New input `keep_local_backup` to control how many local snapshots there should be preserved.

## [v0.2.1] (2018-03-11)

[Full Changelog](https://github.com/mr-bjerre/hassio-remote-backup/compare/v0.2.0...v0.2.1)
[Full Changelog](https://github.com/overkill32/hassio-remote-backup/compare/v0.2.0...v0.2.1)

### Fixed

Expand All @@ -22,7 +61,7 @@ The format is based on [Keep a Changelog][keep-a-changelog] this project adheres

## [v0.2.0] (2018-03-07)

[Full Changelog](https://github.com/mr-bjerre/hassio-remote-backup/compare/v0.1.0...v0.2.0)
[Full Changelog](https://github.com/overkill32/hassio-remote-backup/compare/v0.1.0...v0.2.0)

### Added

Expand All @@ -36,4 +75,4 @@ The format is based on [Keep a Changelog][keep-a-changelog] this project adheres

[keep-a-changelog]: http://keepachangelog.com/en/1.0.0/
[semantic-versioning]: http://semver.org/spec/v2.0.0.html
[addons-repo]: https://github.com/mr-bjerre/hassio-addons/blob/master/remote-backup/config.json
[addons-repo]: https://github.com/overkill32/hassio-addons/blob/master/remote-backup/config.json
79 changes: 48 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@

# Remote Backup

[![GitHub Release][releases-shield]][releases]
[![Build Status][travis-build-shield]][travis-build]
[![Build Status](https://github.com/nigelm/hassio-remote-backup/actions/workflows/homeassistant-test.yml/badge.svg)
[![Release Status](https://github.com/nigelm/hassio-remote-backup/actions/workflows/homeassistant-publish.yml/badge.svg)
[![GitHub license][license-shield]](LICENSE.md)

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

<hr>
----

## Table of Contents

* [About](#about)
* [Installation](#installation)
* [Configuration](#configuration)
* [Example](#example)
* [Issues](#issues)
* [Changelog & Releases](#changelog)
* [Docker status](#docker)

## <a name='about'></a>About

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*.
1. The snapshot are copied to the specified remote location using `SCP`.
Expand All @@ -30,7 +32,7 @@ _Note_ the filenames of the backup are given by their assigned slug.

## <a name='installation'></a>Installation

1. Add the add-ons repository to your Hass.io instance: `https://github.com/overkill32/hassio-addons`.
1. Add the add-ons repository to your Hass.io instance: `https://github.com/nigelm/hassio-addons`.
1. Install the Remote Backup add-on.
1. Configure the add-on with your SSH credentials and desired output directory
(see configuration below).
Expand All @@ -49,6 +51,10 @@ See my [repository of addons][hassio-addons] for more information.
|`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.

Remember that no matter what `keep_local_backup` is set to, you will add one
new snapshot backup file to the remote location each time this is run. You
may wish to have some form of expiry of these snapshots.

## <a name='example'></a>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.
Expand Down Expand Up @@ -88,6 +94,17 @@ _Add-on configuration_:

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

## <a name='issues'></a>Issues

*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](https://serverfault.com/questions/854208/ssh-suddenly-returning-invalid-format/960647)
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.*

## <a name='changelog'></a>Changelog & Releases

This repository keeps a [change log](CHANGELOG.md). The format of the log
Expand Down Expand Up @@ -126,37 +143,37 @@ based on the following:


[aarch64-arch-shield]: https://img.shields.io/badge/architecture-aarch64-blue.svg
[aarch64-dockerhub]: https://hub.docker.com/r/fixated/remote-backup-aarch64
[aarch64-layers-shield]: https://images.microbadger.com/badges/image/fixated/remote-backup-aarch64.svg
[aarch64-microbadger]: https://microbadger.com/images/fixated/remote-backup-aarch64
[aarch64-pulls-shield]: https://img.shields.io/docker/pulls/fixated/remote-backup-aarch64.svg
[aarch64-version-shield]: https://images.microbadger.com/badges/version/fixated/remote-backup-aarch64.svg
[aarch64-dockerhub]: https://hub.docker.com/r/nigelm/hassio-remote-backup-aarch64
[aarch64-layers-shield]: https://images.microbadger.com/badges/image/nigelm/hassio-remote-backup-aarch64.svg
[aarch64-microbadger]: https://microbadger.com/images/nigelm/hassio-remote-backup-aarch64
[aarch64-pulls-shield]: https://img.shields.io/docker/pulls/nigelm/hassio-remote-backup-aarch64.svg
[aarch64-version-shield]: https://images.microbadger.com/badges/version/nigelm/hassio-remote-backup-aarch64.svg
[amd64-arch-shield]: https://img.shields.io/badge/architecture-amd64-blue.svg
[amd64-dockerhub]: https://hub.docker.com/r/fixated/remote-backup-amd64
[amd64-layers-shield]: https://images.microbadger.com/badges/image/fixated/remote-backup-amd64.svg
[amd64-microbadger]: https://microbadger.com/images/fixated/remote-backup-amd64
[amd64-pulls-shield]: https://img.shields.io/docker/pulls/fixated/remote-backup-amd64.svg
[amd64-version-shield]: https://images.microbadger.com/badges/version/fixated/remote-backup-amd64.svg
[amd64-dockerhub]: https://hub.docker.com/r/nigelm/hassio-remote-backup-amd64
[amd64-layers-shield]: https://images.microbadger.com/badges/image/nigelm/hassio-remote-backup-amd64.svg
[amd64-microbadger]: https://microbadger.com/images/nigelm/hassio-remote-backup-amd64
[amd64-pulls-shield]: https://img.shields.io/docker/pulls/nigelm/hassio-remote-backup-amd64.svg
[amd64-version-shield]: https://images.microbadger.com/badges/version/nigelm/hassio-remote-backup-amd64.svg
[armhf-arch-shield]: https://img.shields.io/badge/architecture-armhf-blue.svg
[armhf-dockerhub]: https://hub.docker.com/r/fixated/remote-backup-armhf
[armhf-layers-shield]: https://images.microbadger.com/badges/image/fixated/remote-backup-armhf.svg
[armhf-microbadger]: https://microbadger.com/images/fixated/remote-backup-armhf
[armhf-pulls-shield]: https://img.shields.io/docker/pulls/fixated/remote-backup-armhf.svg
[armhf-version-shield]: https://images.microbadger.com/badges/version/fixated/remote-backup-armhf.svg
[armhf-dockerhub]: https://hub.docker.com/r/nigelm/hassio-remote-backup-armhf
[armhf-layers-shield]: https://images.microbadger.com/badges/image/nigelm/hassio-remote-backup-armhf.svg
[armhf-microbadger]: https://microbadger.com/images/nigelm/hassio-remote-backup-armhf
[armhf-pulls-shield]: https://img.shields.io/docker/pulls/nigelm/hassio-remote-backup-armhf.svg
[armhf-version-shield]: https://images.microbadger.com/badges/version/nigelm/hassio-remote-backup-armhf.svg
[i386-arch-shield]: https://img.shields.io/badge/architecture-i386-blue.svg
[i386-dockerhub]: https://hub.docker.com/r/fixated/remote-backup-i386
[i386-layers-shield]: https://images.microbadger.com/badges/image/fixated/remote-backup-i386.svg
[i386-microbadger]: https://microbadger.com/images/fixated/remote-backup-i386
[i386-pulls-shield]: https://img.shields.io/docker/pulls/fixated/remote-backup-i386.svg
[i386-version-shield]: https://images.microbadger.com/badges/version/fixated/remote-backup-i386.svg

[license-shield]: https://img.shields.io/github/license/overkill32/hassio-remote-backup.svg
[releases]: https://github.com/overkill32/hassio-remote-backup/releases
[releases-shield]: https://img.shields.io/github/release/overkill32/hassio-remote-backup.svg
[travis-build]: https://travis-ci.org/overkill32/hassio-remote-backup
[travis-build-shield]: https://travis-ci.org/overkill32/hassio-remote-backup.svg?branch=master
[i386-dockerhub]: https://hub.docker.com/r/nigelm/hassio-remote-backup-i386
[i386-layers-shield]: https://images.microbadger.com/badges/image/nigelm/hassio-remote-backup-i386.svg
[i386-microbadger]: https://microbadger.com/images/nigelm/hassio-remote-backup-i386
[i386-pulls-shield]: https://img.shields.io/docker/pulls/nigelm/hassio-remote-backup-i386.svg
[i386-version-shield]: https://images.microbadger.com/badges/version/nigelm/hassio-remote-backup-i386.svg

[license-shield]: https://img.shields.io/github/license/nigelm/hassio-remote-backup.svg
[releases]: https://github.com/nigelm/hassio-remote-backup/releases
[releases-shield]: https://img.shields.io/github/release/nigelm/hassio-remote-backup.svg
[travis-build]: https://travis-ci.org/nigelm/hassio-remote-backup
[travis-build-shield]: https://travis-ci.org/nigelm/hassio-remote-backup.svg?branch=master

[keepchangelog]: http://keepachangelog.com/en/1.0.0/
[semver]: http://semver.org/spec/v2.0.0.html

[hassio-addons]: https://github.com/overkill32/hassio-addons
[hassio-addons]: https://github.com/nigelm/hassio-addons
31 changes: 0 additions & 31 deletions build.sh

This file was deleted.

12 changes: 6 additions & 6 deletions remote-backup/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ RUN apk add --no-cache jq openssh-client zip
ARG BUILD_ARCH
ARG CLI_VERSION
RUN apk add --no-cache curl \
&& curl -Lso /usr/bin/hassio https://github.com/home-assistant/hassio-cli/releases/download/1.2.1/hassio_${BUILD_ARCH} \
&& chmod a+x /usr/bin/hassio
&& curl -Lso /usr/bin/ha https://github.com/home-assistant/cli/releases/download/4.10.1/ha_${BUILD_ARCH} \
&& chmod a+x /usr/bin/ha

# Copy data
COPY run.sh /
Expand All @@ -32,12 +32,12 @@ LABEL \
io.hass.arch="${BUILD_ARCH}" \
io.hass.type="addon" \
io.hass.version=${BUILD_VERSION} \
maintainer="Nicolai Bjerre Pedersen <[email protected]>" \
maintainer="Nigel Metheringham <[email protected]>" \
org.label-schema.description="Automatically create Hass.io snapshots to remote server location using `SCP`." \
org.label-schema.build-date=${BUILD_DATE} \
org.label-schema.name="Remote Backup" \
org.label-schema.schema-version="1.0" \
org.label-schema.usage="https://github.com/overkill32/hassio-remote-backup/tree/master/README.md" \
org.label-schema.usage="https://github.com/nigelm/hassio-remote-backup/tree/master/README.md" \
org.label-schema.vcs-ref=${BUILD_REF} \
org.label-schema.vcs-url="https://github.com/overkill32/hassio-remote-backup/" \
org.label-schema.vendor="Hass.io add-ons by Nicolai"
org.label-schema.vcs-url="https://github.com/nigelm/hassio-remote-backup/" \
org.label-schema.vendor="Hass.io add-ons by Nigel Metheringham"
Loading