diff --git a/README.md b/README.md index b6731bc..df1f438 100644 --- a/README.md +++ b/README.md @@ -8,19 +8,20 @@ ### Environment variables -| Variable | Required | Default value | Description | -|-----------------------|:--------:|----------------|-------------------------------------------------------------------------| -| AWS_ACCESS_KEY_ID | ✔ | | Access key id for the AWS account | -| AWS_REGION | ✔ | | Region for the AWS bucket | -| AWS_S3_ENDPOINT | ✔ | | AWS S3 endpoint with bucket and path (e.g. "my-bucket/postgres-backup") | -| AWS_SECRET_ACCESS_KEY | ✔ | | Secret access key for the AWS account | -| POSTGRES_DB | ✔ | | Postgres server database | -| POSTGRES_HOST | | postgres | Postgres server host | -| POSTGRES_PASSWORD | ✔ | | Postgres server password | -| POSTGRES_PORT | | 5432 | Postgres server port | -| POSTGRES_USER | | postgres | Postgres server user | -| POSTGRES_VERSION | | 15 | Postgres server version (12, 13, 14 or 15) | -| WEBGAZER_PULSE_URL | | | [WebGazer Pulse](https://www.webgazer.io/pulse) URL | +| Variable | Required | Default value | Description | +|-----------------------|:--------:|---------------|-------------------------------------------------------------------------------------------------------------------------------| +| AWS_ACCESS_KEY_ID | ✔ | | Access key id for the AWS account | +| AWS_REGION | ✔ | | Region for the AWS bucket | +| AWS_S3_ENDPOINT | ✔ | | AWS S3 endpoint with bucket and path (e.g. "my-bucket/postgres-backup") | +| AWS_S3_STORAGE_CLASS | | STANDARD_IA | AWS S3 storage class (see https://aws.amazon.com/s3/storage-classes/ and https://rclone.org/s3/#s3-storage-class for options. | +| AWS_SECRET_ACCESS_KEY | ✔ | | Secret access key for the AWS account | +| POSTGRES_DB | ✔ | | Postgres server database | +| POSTGRES_HOST | | postgres | Postgres server host | +| POSTGRES_PASSWORD | ✔ | | Postgres server password | +| POSTGRES_PORT | | 5432 | Postgres server port | +| POSTGRES_USER | | postgres | Postgres server user | +| POSTGRES_VERSION | | 15 | Postgres server version (12, 13, 14 or 15) | +| WEBGAZER_PULSE_URL | | | [WebGazer Pulse](https://www.webgazer.io/pulse) URL | ### Running @@ -33,6 +34,7 @@ -e POSTGRES_VERSION= \ -e AWS_ACCESS_KEY_ID= \ -e AWS_SECRET_ACCESS_KEY= \ + -e AWS_S3_STORAGE_CLASS= \ -e AWS_S3_ENDPOINT= \ -e WEBGAZER_PULSE_URL= @@ -48,6 +50,7 @@ -e AWS_ACCESS_KEY_ID=g9XqNnqKmUk6xqwkStkN \ -e AWS_SECRET_ACCESS_KEY=GLBZ8mQf27UL57YHbkLhXWtfJWVwtUBbQup6mFzw \ -e AWS_S3_ENDPOINT=my-bucket/postgres-backup \ + -e AWS_S3_STORAGE_CLASS=GLACIER \ -e WEBGAZER_PULSE_URL=https://pulse.webgazer.io/1-8f713c75d659 ## Shameless plug @@ -58,7 +61,8 @@ I am an indie hacker, and I am running two services that might be useful for you [WebGazer](https://www.webgazer.io/?utm_source=github&utm_campaign=postgres-s3-backup-readme) -[WebGazer](https://www.webgazer.io/?utm_source=github&utm_campaign=postgres-s3-backup-readme) is a monitoring service that checks your website, cron jobs, or scheduled tasks on a regular basis. It notifies +[WebGazer](https://www.webgazer.io/?utm_source=github&utm_campaign=postgres-s3-backup-readme) is a monitoring service +that checks your website, cron jobs, or scheduled tasks on a regular basis. It notifies you with instant alerts in case of a problem. That way, you have peace of mind about the status of your service without manually checking it. @@ -66,9 +70,11 @@ manually checking it. [PoeticMetric](https://www.poeticmetric.com/?utm_source=github&utm_campaign=postgres-s3-backup-readme) -[PoeticMetric](https://www.poeticmetric.com/?utm_source=github&utm_campaign=postgres-s3-backup-readme) is a privacy-first, regulation-compliant, blazingly fast analytics tool. +[PoeticMetric](https://www.poeticmetric.com/?utm_source=github&utm_campaign=postgres-s3-backup-readme) is a +privacy-first, regulation-compliant, blazingly fast analytics tool. -No cookies or personal data collection. So you don't have to worry about cookie banners or GDPR, CCPA, and PECR compliance. +No cookies or personal data collection. So you don't have to worry about cookie banners or GDPR, CCPA, and PECR +compliance. ## License diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 1cca6f7..bcd0343 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -13,6 +13,7 @@ SECONDS=0 : "${POSTGRES_PASSWORD:?Please set the environment variable.}" # optional environment variables with defaults +AWS_S3_STORAGE_CLASS="${AWS_S3_STORAGE_CLASS:-STANDARD_IA}" POSTGRES_HOST="${POSTGRES_HOST:-postgres}" POSTGRES_PORT="${POSTGRES_PORT:-5432}" POSTGRES_USER="${POSTGRES_USER:-postgres}" @@ -43,7 +44,7 @@ echo "Uploading to S3..." rclone copyto \ --s3-no-check-bucket \ "./${BACKUP_FILE_NAME}" \ - ":s3,access_key_id=${AWS_ACCESS_KEY_ID},provider=AWS,region=${AWS_REGION},secret_access_key=${AWS_SECRET_ACCESS_KEY},storage_class=GLACIER:${AWS_S3_ENDPOINT}/${BACKUP_FILE_NAME}" + ":s3,access_key_id=${AWS_ACCESS_KEY_ID},provider=AWS,region=${AWS_REGION},secret_access_key=${AWS_SECRET_ACCESS_KEY},storage_class=${AWS_S#AWS_S3_STORAGE_CLASS}:${AWS_S3_ENDPOINT}/${BACKUP_FILE_NAME}" echo "Uploading to S3... Done." if [ -n "${WEBGAZER_PULSE_URL}" ]; then