From ba5b3a59d211fc818dc992bccf02a82b63f55027 Mon Sep 17 00:00:00 2001 From: Richard Rosalion Date: Sat, 8 Jul 2023 13:32:29 +1000 Subject: [PATCH 01/21] Add endpoint_url option --- amazon-s3-backup/config.json | 2 ++ amazon-s3-backup/run.sh | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/amazon-s3-backup/config.json b/amazon-s3-backup/config.json index b360dfb..3ea2bd2 100755 --- a/amazon-s3-backup/config.json +++ b/amazon-s3-backup/config.json @@ -22,6 +22,7 @@ "aws_secret_access_key": "", "bucket_name": "", "bucket_region": "eu-central-1", + "endpoint_url": "", "storage_class": "STANDARD", "delete_local_backups": true, "local_backups_to_keep": 3 @@ -31,6 +32,7 @@ "aws_secret_access_key": "password", "bucket_name": "str", "bucket_region": "list(us-east-1|us-east-2|us-west-1|us-west-2|af-south-1|ap-east-1|ap-south-2|ap-southeast-3|ap-southeast-4|ap-south-1|ap-northeast-3|ap-northeast-2|ap-southeast-1|ap-southeast-2|ap-northeast-1|ca-central-1|eu-central-1|eu-west-1|eu-west-2|eu-south-1|eu-west-3|eu-south-2|eu-north-1|eu-central-2|me-south-1|me-central-1|sa-east-1|us-gov-east-1|us-gov-west-1)", + "endpoint_url": "str", "storage_class": "list(STANDARD|REDUCED_REDUNDANCY|STANDARD_IA|ONEZONE_IA|INTELLIGENT_TIERING|GLACIER|DEEP_ARCHIVE)", "delete_local_backups": "bool", "local_backups_to_keep": "int" diff --git a/amazon-s3-backup/run.sh b/amazon-s3-backup/run.sh index c4027b7..58a8d3d 100755 --- a/amazon-s3-backup/run.sh +++ b/amazon-s3-backup/run.sh @@ -9,6 +9,7 @@ bashio::log.info "Starting Amazon S3 Backup..." bucket_name="$(bashio::config 'bucket_name')" storage_class="$(bashio::config 'storage_class' 'STANDARD')" bucket_region="$(bashio::config 'bucket_region' 'eu-central-1')" +endpoint_url="$(bashio::config 'endpoint_url' '')" delete_local_backups="$(bashio::config 'delete_local_backups' 'true')" local_backups_to_keep="$(bashio::config 'local_backups_to_keep' '3')" monitor_path="/backup" @@ -18,9 +19,11 @@ export AWS_ACCESS_KEY_ID="$(bashio::config 'aws_access_key')" export AWS_SECRET_ACCESS_KEY="$(bashio::config 'aws_secret_access_key')" export AWS_REGION="$bucket_region" +[ ! -z ${endpoint_url+x}] && ENDPOINT="--endpoint-url=$endpoint_url + bashio::log.debug "Using AWS CLI version: '$(aws --version)'" bashio::log.debug "Command: 'aws s3 sync $monitor_path s3://$bucket_name/ --no-progress --region $bucket_region --storage-class $storage_class'" -aws s3 sync $monitor_path s3://"$bucket_name"/ --no-progress --region "$bucket_region" --storage-class "$storage_class" +aws $ENDPOINT s3 sync $monitor_path s3://"$bucket_name"/ --no-progress --region "$bucket_region" --storage-class "$storage_class" if bashio::var.true "${delete_local_backups}"; then bashio::log.info "Will delete local backups except the '${local_backups_to_keep}' newest ones." From cde5656b882e0484c74d6f833276f05ac0bb99a2 Mon Sep 17 00:00:00 2001 From: Richard Rosalion Date: Sat, 8 Jul 2023 13:37:58 +1000 Subject: [PATCH 02/21] Change repository url --- amazon-s3-backup/run.sh | 5 +++-- repository.json | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/amazon-s3-backup/run.sh b/amazon-s3-backup/run.sh index 58a8d3d..8a30ffe 100755 --- a/amazon-s3-backup/run.sh +++ b/amazon-s3-backup/run.sh @@ -22,8 +22,9 @@ export AWS_REGION="$bucket_region" [ ! -z ${endpoint_url+x}] && ENDPOINT="--endpoint-url=$endpoint_url bashio::log.debug "Using AWS CLI version: '$(aws --version)'" -bashio::log.debug "Command: 'aws s3 sync $monitor_path s3://$bucket_name/ --no-progress --region $bucket_region --storage-class $storage_class'" -aws $ENDPOINT s3 sync $monitor_path s3://"$bucket_name"/ --no-progress --region "$bucket_region" --storage-class "$storage_class" +COMMAND=aws $ENDPOINT s3 sync $monitor_path s3://"$bucket_name"/ --no-progress --region "$bucket_region" --storage-class "$storage_class" +bashio::log.debug "Command: '$COMMAND'" +$COMMAND if bashio::var.true "${delete_local_backups}"; then bashio::log.info "Will delete local backups except the '${local_backups_to_keep}' newest ones." diff --git a/repository.json b/repository.json index 3224fa5..e1cd175 100755 --- a/repository.json +++ b/repository.json @@ -1,5 +1,5 @@ { "name": "Thomas Fritz Home Assistant Addons", - "url": "https://github.com/thomasfr/hass-addons", + "url": "https://github.com/rarosalion/hass-addons", "maintainer": "Thomas Fritz " } \ No newline at end of file From e5508955ad8a0d4e87293e66f2cce68867d09abe Mon Sep 17 00:00:00 2001 From: Richard Rosalion Date: Sat, 8 Jul 2023 13:46:56 +1000 Subject: [PATCH 03/21] Typo in run.sh --- amazon-s3-backup/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amazon-s3-backup/run.sh b/amazon-s3-backup/run.sh index 8a30ffe..6735982 100755 --- a/amazon-s3-backup/run.sh +++ b/amazon-s3-backup/run.sh @@ -19,7 +19,7 @@ export AWS_ACCESS_KEY_ID="$(bashio::config 'aws_access_key')" export AWS_SECRET_ACCESS_KEY="$(bashio::config 'aws_secret_access_key')" export AWS_REGION="$bucket_region" -[ ! -z ${endpoint_url+x}] && ENDPOINT="--endpoint-url=$endpoint_url +[ ! -z ${endpoint_url+x}] && ENDPOINT="--endpoint-url=$endpoint_url" bashio::log.debug "Using AWS CLI version: '$(aws --version)'" COMMAND=aws $ENDPOINT s3 sync $monitor_path s3://"$bucket_name"/ --no-progress --region "$bucket_region" --storage-class "$storage_class" From e61e59fda50b054904c31b97b2ffc4218653689d Mon Sep 17 00:00:00 2001 From: Richard Rosalion Date: Sat, 8 Jul 2023 13:49:39 +1000 Subject: [PATCH 04/21] Typo in run.sh --- amazon-s3-backup/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amazon-s3-backup/run.sh b/amazon-s3-backup/run.sh index 6735982..8246ae7 100755 --- a/amazon-s3-backup/run.sh +++ b/amazon-s3-backup/run.sh @@ -19,7 +19,7 @@ export AWS_ACCESS_KEY_ID="$(bashio::config 'aws_access_key')" export AWS_SECRET_ACCESS_KEY="$(bashio::config 'aws_secret_access_key')" export AWS_REGION="$bucket_region" -[ ! -z ${endpoint_url+x}] && ENDPOINT="--endpoint-url=$endpoint_url" +[ ! -z ${endpoint_url+x} ] && ENDPOINT="--endpoint-url=$endpoint_url" bashio::log.debug "Using AWS CLI version: '$(aws --version)'" COMMAND=aws $ENDPOINT s3 sync $monitor_path s3://"$bucket_name"/ --no-progress --region "$bucket_region" --storage-class "$storage_class" From 0bb31e166a86892f9ebbc2ea7591a27ba1f5fb39 Mon Sep 17 00:00:00 2001 From: Richard Rosalion Date: Sat, 8 Jul 2023 13:54:17 +1000 Subject: [PATCH 05/21] Typo in run.sh --- amazon-s3-backup/DOCS.md | 5 ++++- amazon-s3-backup/run.sh | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/amazon-s3-backup/DOCS.md b/amazon-s3-backup/DOCS.md index 75bf1fd..61941b7 100644 --- a/amazon-s3-backup/DOCS.md +++ b/amazon-s3-backup/DOCS.md @@ -12,7 +12,7 @@ Follow these steps to get the add-on installed on your system: ## How to use 1. Set the `aws_access_key`, `aws_secret_access_key`, and `bucket_name`. -2. Optionally / if necessary, change `bucket_region`, `storage_class`, and `delete_local_backups` and `local_backups_to_keep` configuration options. +2. Optionally / if necessary, change `bucket_region`, `storage_class`, `endpoint_url`, `delete_local_backups` and `local_backups_to_keep` configuration options. 3. Start the add-on to sync the `/backup/` directory to the configured `bucket_name` on Amazon S3. You can also automate this of course, see example below: ## Automation @@ -73,6 +73,9 @@ Amazon S3 bucket used to store backups. ### Option: `bucket_region` (optional, Default: eu-central-1) AWS region where the S3 bucket was created. See https://aws.amazon.com/about-aws/global-infrastructure/ for all available regions. +### Option: `endpoint_url` (optional, Defaault: (empty)) +If you wish to use a non-AWS S3-compatable server (e.g. minio), you can set the endpoint url (e.g. https://myminioserver.local:9000) here. Leave this value blank if you're using AWS. + ### Option: `storage_class` (optional, Default: STANDARD) Amazon S3 storage class to use for the synced objects, when uploading files to S3. One of STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE. For more information see https://aws.amazon.com/s3/storage-classes/. diff --git a/amazon-s3-backup/run.sh b/amazon-s3-backup/run.sh index 8246ae7..3cfa916 100755 --- a/amazon-s3-backup/run.sh +++ b/amazon-s3-backup/run.sh @@ -19,7 +19,7 @@ export AWS_ACCESS_KEY_ID="$(bashio::config 'aws_access_key')" export AWS_SECRET_ACCESS_KEY="$(bashio::config 'aws_secret_access_key')" export AWS_REGION="$bucket_region" -[ ! -z ${endpoint_url+x} ] && ENDPOINT="--endpoint-url=$endpoint_url" +[ -n "$endpoint_url" ] && ENDPOINT="--endpoint-url=$endpoint_url" bashio::log.debug "Using AWS CLI version: '$(aws --version)'" COMMAND=aws $ENDPOINT s3 sync $monitor_path s3://"$bucket_name"/ --no-progress --region "$bucket_region" --storage-class "$storage_class" From d3e50b22d28f81f1aba5de7a8c98bae3bb0bad4c Mon Sep 17 00:00:00 2001 From: Richard Rosalion Date: Sat, 8 Jul 2023 13:57:36 +1000 Subject: [PATCH 06/21] Fix quotes in run.sh --- amazon-s3-backup/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amazon-s3-backup/run.sh b/amazon-s3-backup/run.sh index 3cfa916..e59c033 100755 --- a/amazon-s3-backup/run.sh +++ b/amazon-s3-backup/run.sh @@ -22,7 +22,7 @@ export AWS_REGION="$bucket_region" [ -n "$endpoint_url" ] && ENDPOINT="--endpoint-url=$endpoint_url" bashio::log.debug "Using AWS CLI version: '$(aws --version)'" -COMMAND=aws $ENDPOINT s3 sync $monitor_path s3://"$bucket_name"/ --no-progress --region "$bucket_region" --storage-class "$storage_class" +COMMAND="aws $ENDPOINT s3 sync $monitor_path s3://\"$bucket_name\"/ --no-progress --region \"$bucket_region\" --storage-class \"$storage_class\"" bashio::log.debug "Command: '$COMMAND'" $COMMAND From 35dd6202a528a3c64c201f56dab6c910798591b6 Mon Sep 17 00:00:00 2001 From: Richard Rosalion Date: Sat, 8 Jul 2023 14:04:01 +1000 Subject: [PATCH 07/21] Turn on debug logging --- amazon-s3-backup/config.json | 2 +- amazon-s3-backup/run.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/amazon-s3-backup/config.json b/amazon-s3-backup/config.json index 3ea2bd2..11ed53f 100755 --- a/amazon-s3-backup/config.json +++ b/amazon-s3-backup/config.json @@ -1,6 +1,6 @@ { "name": "Amazon S3 Backup", - "version": "1.2.2", + "version": "1.2.3", "slug": "amazon-s3-backup", "description": "Sync Backups to your Amazon S3 bucket", "url": "https://github.com/thomasfr/hass-addons/tree/main/amazon-s3-backup", diff --git a/amazon-s3-backup/run.sh b/amazon-s3-backup/run.sh index e59c033..6a7796b 100755 --- a/amazon-s3-backup/run.sh +++ b/amazon-s3-backup/run.sh @@ -2,7 +2,7 @@ # ============================================================================== # Home Assistant Community Add-on: Amazon S3 Backup # ============================================================================== -#bashio::log.level "debug" +bashio::log.level "debug" bashio::log.info "Starting Amazon S3 Backup..." @@ -19,7 +19,7 @@ export AWS_ACCESS_KEY_ID="$(bashio::config 'aws_access_key')" export AWS_SECRET_ACCESS_KEY="$(bashio::config 'aws_secret_access_key')" export AWS_REGION="$bucket_region" -[ -n "$endpoint_url" ] && ENDPOINT="--endpoint-url=$endpoint_url" +[ -n "$endpoint_url" ] && export ENDPOINT="--endpoint-url=$endpoint_url" bashio::log.debug "Using AWS CLI version: '$(aws --version)'" COMMAND="aws $ENDPOINT s3 sync $monitor_path s3://\"$bucket_name\"/ --no-progress --region \"$bucket_region\" --storage-class \"$storage_class\"" From 0aca4e56137a036dfe536dbe27d1e7ebf8ccb623 Mon Sep 17 00:00:00 2001 From: Richard Rosalion Date: Sat, 8 Jul 2023 14:08:03 +1000 Subject: [PATCH 08/21] Fix endpoint_url = --- amazon-s3-backup/CHANGELOG.md | 4 ++++ amazon-s3-backup/run.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/amazon-s3-backup/CHANGELOG.md b/amazon-s3-backup/CHANGELOG.md index 0869c9e..157742b 100644 --- a/amazon-s3-backup/CHANGELOG.md +++ b/amazon-s3-backup/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 1.2.3 + +- Added `endpoint_url` option to allow the use of non-AWS S3-compatable object stores (e.g. minio) + ## 1.2.2 - Backup Script was running twice since it was still in services.d folder. Removed all unnecessary files. diff --git a/amazon-s3-backup/run.sh b/amazon-s3-backup/run.sh index 6a7796b..e36c588 100755 --- a/amazon-s3-backup/run.sh +++ b/amazon-s3-backup/run.sh @@ -19,7 +19,7 @@ export AWS_ACCESS_KEY_ID="$(bashio::config 'aws_access_key')" export AWS_SECRET_ACCESS_KEY="$(bashio::config 'aws_secret_access_key')" export AWS_REGION="$bucket_region" -[ -n "$endpoint_url" ] && export ENDPOINT="--endpoint-url=$endpoint_url" +[ -n "$endpoint_url" ] && export ENDPOINT="--endpoint-url $endpoint_url" bashio::log.debug "Using AWS CLI version: '$(aws --version)'" COMMAND="aws $ENDPOINT s3 sync $monitor_path s3://\"$bucket_name\"/ --no-progress --region \"$bucket_region\" --storage-class \"$storage_class\"" From dcf7b794334162d04dfef67751c0e490203a9fa8 Mon Sep 17 00:00:00 2001 From: Richard Rosalion Date: Sat, 8 Jul 2023 14:10:52 +1000 Subject: [PATCH 09/21] Refactor if statement --- amazon-s3-backup/run.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/amazon-s3-backup/run.sh b/amazon-s3-backup/run.sh index e36c588..6d4b560 100755 --- a/amazon-s3-backup/run.sh +++ b/amazon-s3-backup/run.sh @@ -19,7 +19,12 @@ export AWS_ACCESS_KEY_ID="$(bashio::config 'aws_access_key')" export AWS_SECRET_ACCESS_KEY="$(bashio::config 'aws_secret_access_key')" export AWS_REGION="$bucket_region" -[ -n "$endpoint_url" ] && export ENDPOINT="--endpoint-url $endpoint_url" +if [ -n "$endpoint_url" ] +then + ENDPOINT="--endpoint-url $endpoint_url" +else + ENDPOINT="" +fi bashio::log.debug "Using AWS CLI version: '$(aws --version)'" COMMAND="aws $ENDPOINT s3 sync $monitor_path s3://\"$bucket_name\"/ --no-progress --region \"$bucket_region\" --storage-class \"$storage_class\"" From 67dd05b22b5e985e6881fc36ff2676224ed932b7 Mon Sep 17 00:00:00 2001 From: Richard Rosalion Date: Sat, 8 Jul 2023 15:08:17 +1000 Subject: [PATCH 10/21] Make storage class optional --- amazon-s3-backup/config.json | 2 +- amazon-s3-backup/run.sh | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/amazon-s3-backup/config.json b/amazon-s3-backup/config.json index 11ed53f..66602bd 100755 --- a/amazon-s3-backup/config.json +++ b/amazon-s3-backup/config.json @@ -33,7 +33,7 @@ "bucket_name": "str", "bucket_region": "list(us-east-1|us-east-2|us-west-1|us-west-2|af-south-1|ap-east-1|ap-south-2|ap-southeast-3|ap-southeast-4|ap-south-1|ap-northeast-3|ap-northeast-2|ap-southeast-1|ap-southeast-2|ap-northeast-1|ca-central-1|eu-central-1|eu-west-1|eu-west-2|eu-south-1|eu-west-3|eu-south-2|eu-north-1|eu-central-2|me-south-1|me-central-1|sa-east-1|us-gov-east-1|us-gov-west-1)", "endpoint_url": "str", - "storage_class": "list(STANDARD|REDUCED_REDUNDANCY|STANDARD_IA|ONEZONE_IA|INTELLIGENT_TIERING|GLACIER|DEEP_ARCHIVE)", + "storage_class": "list(None|STANDARD|REDUCED_REDUNDANCY|STANDARD_IA|ONEZONE_IA|INTELLIGENT_TIERING|GLACIER|DEEP_ARCHIVE)", "delete_local_backups": "bool", "local_backups_to_keep": "int" }, diff --git a/amazon-s3-backup/run.sh b/amazon-s3-backup/run.sh index 6d4b560..91a7953 100755 --- a/amazon-s3-backup/run.sh +++ b/amazon-s3-backup/run.sh @@ -19,15 +19,12 @@ export AWS_ACCESS_KEY_ID="$(bashio::config 'aws_access_key')" export AWS_SECRET_ACCESS_KEY="$(bashio::config 'aws_secret_access_key')" export AWS_REGION="$bucket_region" -if [ -n "$endpoint_url" ] -then - ENDPOINT="--endpoint-url $endpoint_url" -else - ENDPOINT="" -fi +# Set optional flags +[[ -n "$endpoint_url" ]] && ENDPOINT="--endpoint-url $endpoint_url" +[[ "$storage_class" != "None" ]] && STORAGECLASS="--storage-class \"$storage_class\"" bashio::log.debug "Using AWS CLI version: '$(aws --version)'" -COMMAND="aws $ENDPOINT s3 sync $monitor_path s3://\"$bucket_name\"/ --no-progress --region \"$bucket_region\" --storage-class \"$storage_class\"" +COMMAND="aws $ENDPOINT s3 sync $monitor_path s3://\"$bucket_name\"/ --no-progress --region \"$bucket_region\" $STORAGECLASS" bashio::log.debug "Command: '$COMMAND'" $COMMAND From f67ff1f64bbd26b366e2205c996474170102396c Mon Sep 17 00:00:00 2001 From: Richard Rosalion Date: Sat, 8 Jul 2023 15:11:55 +1000 Subject: [PATCH 11/21] Make storage class optional --- amazon-s3-backup/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amazon-s3-backup/config.json b/amazon-s3-backup/config.json index 66602bd..ff81ff4 100755 --- a/amazon-s3-backup/config.json +++ b/amazon-s3-backup/config.json @@ -1,6 +1,6 @@ { "name": "Amazon S3 Backup", - "version": "1.2.3", + "version": "1.2.3a", "slug": "amazon-s3-backup", "description": "Sync Backups to your Amazon S3 bucket", "url": "https://github.com/thomasfr/hass-addons/tree/main/amazon-s3-backup", From 8a1d448569355be4dca6982c70f25e5545c2b7ba Mon Sep 17 00:00:00 2001 From: Richard Rosalion Date: Sat, 8 Jul 2023 15:15:16 +1000 Subject: [PATCH 12/21] Fix unbound variables --- amazon-s3-backup/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amazon-s3-backup/run.sh b/amazon-s3-backup/run.sh index 91a7953..ab16f5e 100755 --- a/amazon-s3-backup/run.sh +++ b/amazon-s3-backup/run.sh @@ -24,7 +24,7 @@ export AWS_REGION="$bucket_region" [[ "$storage_class" != "None" ]] && STORAGECLASS="--storage-class \"$storage_class\"" bashio::log.debug "Using AWS CLI version: '$(aws --version)'" -COMMAND="aws $ENDPOINT s3 sync $monitor_path s3://\"$bucket_name\"/ --no-progress --region \"$bucket_region\" $STORAGECLASS" +COMMAND="aws ${ENDPOINT:=} s3 sync $monitor_path s3://\"$bucket_name\"/ --no-progress --region \"$bucket_region\" ${STORAGECLASS:=}" bashio::log.debug "Command: '$COMMAND'" $COMMAND From 15d393aabbf081aa7604bb5e2ec67ab17c6b1e76 Mon Sep 17 00:00:00 2001 From: Richard Rosalion Date: Sat, 8 Jul 2023 15:15:28 +1000 Subject: [PATCH 13/21] Fix unbound variables --- amazon-s3-backup/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amazon-s3-backup/config.json b/amazon-s3-backup/config.json index ff81ff4..bb3471f 100755 --- a/amazon-s3-backup/config.json +++ b/amazon-s3-backup/config.json @@ -1,6 +1,6 @@ { "name": "Amazon S3 Backup", - "version": "1.2.3a", + "version": "1.2.3b", "slug": "amazon-s3-backup", "description": "Sync Backups to your Amazon S3 bucket", "url": "https://github.com/thomasfr/hass-addons/tree/main/amazon-s3-backup", From bc4922cea4926345fb094fe1b12873a6010b7096 Mon Sep 17 00:00:00 2001 From: Richard Rosalion Date: Sat, 8 Jul 2023 15:24:02 +1000 Subject: [PATCH 14/21] Make Bucket Region Optional --- amazon-s3-backup/DOCS.md | 9 ++++++--- amazon-s3-backup/config.json | 5 +++-- amazon-s3-backup/run.sh | 8 +++++++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/amazon-s3-backup/DOCS.md b/amazon-s3-backup/DOCS.md index 61941b7..dfa3ed9 100644 --- a/amazon-s3-backup/DOCS.md +++ b/amazon-s3-backup/DOCS.md @@ -71,13 +71,16 @@ AWS IAM secret access key used to access the S3 bucket. Amazon S3 bucket used to store backups. ### Option: `bucket_region` (optional, Default: eu-central-1) -AWS region where the S3 bucket was created. See https://aws.amazon.com/about-aws/global-infrastructure/ for all available regions. +AWS region where the S3 bucket was created. See https://aws.amazon.com/about-aws/global-infrastructure/ for all available regions. If you set this to 'other', a custom bucket region (or no region) can be set in bucket_region_other -### Option: `endpoint_url` (optional, Defaault: (empty)) +### Option: `bucket_region_other` (optional, Default: empty) +If 'bucket_Region' is set to 'other', then a custom region value set here will be used instead. If this value is empty, no region will be requested. + +### Option: `endpoint_url` (optional, Defaault: empty) If you wish to use a non-AWS S3-compatable server (e.g. minio), you can set the endpoint url (e.g. https://myminioserver.local:9000) here. Leave this value blank if you're using AWS. ### Option: `storage_class` (optional, Default: STANDARD) -Amazon S3 storage class to use for the synced objects, when uploading files to S3. One of STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE. For more information see https://aws.amazon.com/s3/storage-classes/. +Amazon S3 storage class to use for the synced objects, when uploading files to S3. One of STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE. For more information see https://aws.amazon.com/s3/storage-classes/. If you select 'None', no storage class will be specified (leaving the s3 provider to select the default option). ### Option: `delete_local_backups` (optional, Default: true) Should the addon remove oldest local backups after syncing to your Amazon S3 Bucket? You can configure how many local backups you want to keep with the Option `local_backups_to_keep`. Oldest Backups will get deleted first. diff --git a/amazon-s3-backup/config.json b/amazon-s3-backup/config.json index bb3471f..02c5524 100755 --- a/amazon-s3-backup/config.json +++ b/amazon-s3-backup/config.json @@ -1,6 +1,6 @@ { "name": "Amazon S3 Backup", - "version": "1.2.3b", + "version": "1.2.3c", "slug": "amazon-s3-backup", "description": "Sync Backups to your Amazon S3 bucket", "url": "https://github.com/thomasfr/hass-addons/tree/main/amazon-s3-backup", @@ -31,7 +31,8 @@ "aws_access_key": "str", "aws_secret_access_key": "password", "bucket_name": "str", - "bucket_region": "list(us-east-1|us-east-2|us-west-1|us-west-2|af-south-1|ap-east-1|ap-south-2|ap-southeast-3|ap-southeast-4|ap-south-1|ap-northeast-3|ap-northeast-2|ap-southeast-1|ap-southeast-2|ap-northeast-1|ca-central-1|eu-central-1|eu-west-1|eu-west-2|eu-south-1|eu-west-3|eu-south-2|eu-north-1|eu-central-2|me-south-1|me-central-1|sa-east-1|us-gov-east-1|us-gov-west-1)", + "bucket_region": "list(us-east-1|us-east-2|us-west-1|us-west-2|af-south-1|ap-east-1|ap-south-2|ap-southeast-3|ap-southeast-4|ap-south-1|ap-northeast-3|ap-northeast-2|ap-southeast-1|ap-southeast-2|ap-northeast-1|ca-central-1|eu-central-1|eu-west-1|eu-west-2|eu-south-1|eu-west-3|eu-south-2|eu-north-1|eu-central-2|me-south-1|me-central-1|sa-east-1|us-gov-east-1|us-gov-west-1|other)", + "bucket_region_other": "", "endpoint_url": "str", "storage_class": "list(None|STANDARD|REDUCED_REDUNDANCY|STANDARD_IA|ONEZONE_IA|INTELLIGENT_TIERING|GLACIER|DEEP_ARCHIVE)", "delete_local_backups": "bool", diff --git a/amazon-s3-backup/run.sh b/amazon-s3-backup/run.sh index ab16f5e..30ea45e 100755 --- a/amazon-s3-backup/run.sh +++ b/amazon-s3-backup/run.sh @@ -9,6 +9,7 @@ bashio::log.info "Starting Amazon S3 Backup..." bucket_name="$(bashio::config 'bucket_name')" storage_class="$(bashio::config 'storage_class' 'STANDARD')" bucket_region="$(bashio::config 'bucket_region' 'eu-central-1')" +bucket_region_other="$(bashio::config 'bucket_region_other' '')" endpoint_url="$(bashio::config 'endpoint_url' '')" delete_local_backups="$(bashio::config 'delete_local_backups' 'true')" local_backups_to_keep="$(bashio::config 'local_backups_to_keep' '3')" @@ -22,9 +23,14 @@ export AWS_REGION="$bucket_region" # Set optional flags [[ -n "$endpoint_url" ]] && ENDPOINT="--endpoint-url $endpoint_url" [[ "$storage_class" != "None" ]] && STORAGECLASS="--storage-class \"$storage_class\"" +if [ "$bucket_region" == "Other"]; then + [[ -n "$bucket_region_other" ]] && BUCKETREGION="--region \"$bucket_region_other\"" +else + BUCKETREGION="--region \"$bucket_region\"" +fi bashio::log.debug "Using AWS CLI version: '$(aws --version)'" -COMMAND="aws ${ENDPOINT:=} s3 sync $monitor_path s3://\"$bucket_name\"/ --no-progress --region \"$bucket_region\" ${STORAGECLASS:=}" +COMMAND="aws ${ENDPOINT:=} s3 sync $monitor_path s3://\"$bucket_name\"/ --no-progress ${BUCKETREGION:=} ${STORAGECLASS:=}" bashio::log.debug "Command: '$COMMAND'" $COMMAND From 33e111501e74eeac93a86ea0d310ed5af50564d9 Mon Sep 17 00:00:00 2001 From: Richard Rosalion Date: Sat, 8 Jul 2023 15:27:35 +1000 Subject: [PATCH 15/21] Make Bucket Region Optional --- amazon-s3-backup/config.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/amazon-s3-backup/config.json b/amazon-s3-backup/config.json index 02c5524..49bdba0 100755 --- a/amazon-s3-backup/config.json +++ b/amazon-s3-backup/config.json @@ -1,6 +1,6 @@ { "name": "Amazon S3 Backup", - "version": "1.2.3c", + "version": "1.2.3d", "slug": "amazon-s3-backup", "description": "Sync Backups to your Amazon S3 bucket", "url": "https://github.com/thomasfr/hass-addons/tree/main/amazon-s3-backup", @@ -22,6 +22,7 @@ "aws_secret_access_key": "", "bucket_name": "", "bucket_region": "eu-central-1", + "bucket_region_other": "", "endpoint_url": "", "storage_class": "STANDARD", "delete_local_backups": true, From 38b1da5cf3e9ede97d270027aebcfbf916b30b69 Mon Sep 17 00:00:00 2001 From: Richard Rosalion Date: Sat, 8 Jul 2023 15:29:03 +1000 Subject: [PATCH 16/21] Make Bucket Region Optional --- amazon-s3-backup/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amazon-s3-backup/config.json b/amazon-s3-backup/config.json index 49bdba0..e0caf4b 100755 --- a/amazon-s3-backup/config.json +++ b/amazon-s3-backup/config.json @@ -33,7 +33,7 @@ "aws_secret_access_key": "password", "bucket_name": "str", "bucket_region": "list(us-east-1|us-east-2|us-west-1|us-west-2|af-south-1|ap-east-1|ap-south-2|ap-southeast-3|ap-southeast-4|ap-south-1|ap-northeast-3|ap-northeast-2|ap-southeast-1|ap-southeast-2|ap-northeast-1|ca-central-1|eu-central-1|eu-west-1|eu-west-2|eu-south-1|eu-west-3|eu-south-2|eu-north-1|eu-central-2|me-south-1|me-central-1|sa-east-1|us-gov-east-1|us-gov-west-1|other)", - "bucket_region_other": "", + "bucket_region_other": "str", "endpoint_url": "str", "storage_class": "list(None|STANDARD|REDUCED_REDUNDANCY|STANDARD_IA|ONEZONE_IA|INTELLIGENT_TIERING|GLACIER|DEEP_ARCHIVE)", "delete_local_backups": "bool", From 6b10d981bd9239f06f2bd130dc72bc4ab5ffe7b1 Mon Sep 17 00:00:00 2001 From: Richard Rosalion Date: Sat, 8 Jul 2023 15:29:33 +1000 Subject: [PATCH 17/21] Make Bucket Region Optional --- amazon-s3-backup/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amazon-s3-backup/config.json b/amazon-s3-backup/config.json index e0caf4b..419e070 100755 --- a/amazon-s3-backup/config.json +++ b/amazon-s3-backup/config.json @@ -1,6 +1,6 @@ { "name": "Amazon S3 Backup", - "version": "1.2.3d", + "version": "1.2.3e", "slug": "amazon-s3-backup", "description": "Sync Backups to your Amazon S3 bucket", "url": "https://github.com/thomasfr/hass-addons/tree/main/amazon-s3-backup", From 760911779ac9da5adc3e738de8b10932776079d3 Mon Sep 17 00:00:00 2001 From: Richard Rosalion Date: Sat, 8 Jul 2023 15:30:55 +1000 Subject: [PATCH 18/21] Make Bucket Region Optional --- amazon-s3-backup/config.json | 2 +- amazon-s3-backup/run.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/amazon-s3-backup/config.json b/amazon-s3-backup/config.json index 419e070..4c41855 100755 --- a/amazon-s3-backup/config.json +++ b/amazon-s3-backup/config.json @@ -1,6 +1,6 @@ { "name": "Amazon S3 Backup", - "version": "1.2.3e", + "version": "1.2.3f", "slug": "amazon-s3-backup", "description": "Sync Backups to your Amazon S3 bucket", "url": "https://github.com/thomasfr/hass-addons/tree/main/amazon-s3-backup", diff --git a/amazon-s3-backup/run.sh b/amazon-s3-backup/run.sh index 30ea45e..a894088 100755 --- a/amazon-s3-backup/run.sh +++ b/amazon-s3-backup/run.sh @@ -23,7 +23,7 @@ export AWS_REGION="$bucket_region" # Set optional flags [[ -n "$endpoint_url" ]] && ENDPOINT="--endpoint-url $endpoint_url" [[ "$storage_class" != "None" ]] && STORAGECLASS="--storage-class \"$storage_class\"" -if [ "$bucket_region" == "Other"]; then +if [ "$bucket_region" == "other" ]; then [[ -n "$bucket_region_other" ]] && BUCKETREGION="--region \"$bucket_region_other\"" else BUCKETREGION="--region \"$bucket_region\"" From 642eb66caca1eb234710f44ef90705e3a9f61c3f Mon Sep 17 00:00:00 2001 From: Richard Rosalion Date: Sat, 8 Jul 2023 15:34:04 +1000 Subject: [PATCH 19/21] Fix extra quotes --- amazon-s3-backup/config.json | 2 +- amazon-s3-backup/run.sh | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/amazon-s3-backup/config.json b/amazon-s3-backup/config.json index 4c41855..899a870 100755 --- a/amazon-s3-backup/config.json +++ b/amazon-s3-backup/config.json @@ -1,6 +1,6 @@ { "name": "Amazon S3 Backup", - "version": "1.2.3f", + "version": "1.2.3g", "slug": "amazon-s3-backup", "description": "Sync Backups to your Amazon S3 bucket", "url": "https://github.com/thomasfr/hass-addons/tree/main/amazon-s3-backup", diff --git a/amazon-s3-backup/run.sh b/amazon-s3-backup/run.sh index a894088..485ed3c 100755 --- a/amazon-s3-backup/run.sh +++ b/amazon-s3-backup/run.sh @@ -22,15 +22,15 @@ export AWS_REGION="$bucket_region" # Set optional flags [[ -n "$endpoint_url" ]] && ENDPOINT="--endpoint-url $endpoint_url" -[[ "$storage_class" != "None" ]] && STORAGECLASS="--storage-class \"$storage_class\"" +[[ "$storage_class" != "None" ]] && STORAGECLASS="--storage-class $storage_class" if [ "$bucket_region" == "other" ]; then - [[ -n "$bucket_region_other" ]] && BUCKETREGION="--region \"$bucket_region_other\"" + [[ -n "$bucket_region_other" ]] && BUCKETREGION="--region $bucket_region_other" else - BUCKETREGION="--region \"$bucket_region\"" + BUCKETREGION="--region $bucket_region" fi bashio::log.debug "Using AWS CLI version: '$(aws --version)'" -COMMAND="aws ${ENDPOINT:=} s3 sync $monitor_path s3://\"$bucket_name\"/ --no-progress ${BUCKETREGION:=} ${STORAGECLASS:=}" +COMMAND="aws ${ENDPOINT:=} s3 sync $monitor_path s3://$bucket_name/ --no-progress ${BUCKETREGION:=} ${STORAGECLASS:=}" bashio::log.debug "Command: '$COMMAND'" $COMMAND From 2d7e914d231cc41310c7f941ccb3db5ac65d1443 Mon Sep 17 00:00:00 2001 From: Richard Rosalion Date: Sat, 8 Jul 2023 15:40:58 +1000 Subject: [PATCH 20/21] Ready for PR --- amazon-s3-backup/config.json | 2 +- amazon-s3-backup/run.sh | 2 +- repository.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/amazon-s3-backup/config.json b/amazon-s3-backup/config.json index 899a870..7cc015a 100755 --- a/amazon-s3-backup/config.json +++ b/amazon-s3-backup/config.json @@ -1,6 +1,6 @@ { "name": "Amazon S3 Backup", - "version": "1.2.3g", + "version": "1.2.3", "slug": "amazon-s3-backup", "description": "Sync Backups to your Amazon S3 bucket", "url": "https://github.com/thomasfr/hass-addons/tree/main/amazon-s3-backup", diff --git a/amazon-s3-backup/run.sh b/amazon-s3-backup/run.sh index 485ed3c..af07066 100755 --- a/amazon-s3-backup/run.sh +++ b/amazon-s3-backup/run.sh @@ -2,7 +2,7 @@ # ============================================================================== # Home Assistant Community Add-on: Amazon S3 Backup # ============================================================================== -bashio::log.level "debug" +#bashio::log.level "debug" bashio::log.info "Starting Amazon S3 Backup..." diff --git a/repository.json b/repository.json index e1cd175..3224fa5 100755 --- a/repository.json +++ b/repository.json @@ -1,5 +1,5 @@ { "name": "Thomas Fritz Home Assistant Addons", - "url": "https://github.com/rarosalion/hass-addons", + "url": "https://github.com/thomasfr/hass-addons", "maintainer": "Thomas Fritz " } \ No newline at end of file From 1276433fadb6cf2fc8a15a517fbcbe31559da857 Mon Sep 17 00:00:00 2001 From: Richard Rosalion Date: Sat, 8 Jul 2023 15:52:25 +1000 Subject: [PATCH 21/21] Reset to rarosalion --- README.md | 6 +++--- repository.json | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9f6f5a9..86e4608 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Home Assistant Addons: Thomas' repository +# Home Assistant Addons: rarosalion repository -Add-ons for Home Assistant written by Thomas Fritz. +Add-ons for Home Assistant written by rarosalion. To add this repository: 1. Go to your Home Assistant Frontend 2. Open **Supervisor** > **Add-On Store**, @@ -12,4 +12,4 @@ You should now see the add-ons of this repository in your Home Assistant Add-On ## Add-ons provided by this repository -- **[Amazon S3 Backup](/amazon-s3-backup)** - Sync your Home Assistant backups to Amazon S3 \ No newline at end of file +- **[Amazon S3 Backup](/amazon-s3-backup)** - Sync your Home Assistant backups to Amazon S3 (update of thomasfr's plugin) \ No newline at end of file diff --git a/repository.json b/repository.json index 3224fa5..53c55ad 100755 --- a/repository.json +++ b/repository.json @@ -1,5 +1,5 @@ { - "name": "Thomas Fritz Home Assistant Addons", - "url": "https://github.com/thomasfr/hass-addons", - "maintainer": "Thomas Fritz " + "name": "rarosalion Home Assistant Addons", + "url": "https://github.com/rarosalion/hass-addons", + "maintainer": "rarosalion@github" } \ No newline at end of file