{"id":21029762,"url":"https://github.com/loafoe/iron-streaming-backup","last_synced_at":"2026-05-08T01:35:46.309Z","repository":{"id":46226419,"uuid":"250258884","full_name":"loafoe/iron-streaming-backup","owner":"loafoe","description":"IronIO schedulable PostgreSQL backup task ","archived":false,"fork":false,"pushed_at":"2021-11-05T10:13:14.000Z","size":33,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-28T17:59:37.905Z","etag":null,"topics":["backup","docker","hsdp","ironio","postgresql"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/loafoe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null}},"created_at":"2020-03-26T12:57:38.000Z","updated_at":"2022-03-18T12:22:11.000Z","dependencies_parsed_at":"2022-09-19T07:31:28.166Z","dependency_job_id":null,"html_url":"https://github.com/loafoe/iron-streaming-backup","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/loafoe/iron-streaming-backup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loafoe%2Firon-streaming-backup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loafoe%2Firon-streaming-backup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loafoe%2Firon-streaming-backup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loafoe%2Firon-streaming-backup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loafoe","download_url":"https://codeload.github.com/loafoe/iron-streaming-backup/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loafoe%2Firon-streaming-backup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32763484,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-07T02:14:30.463Z","status":"ssl_error","status_checked_at":"2026-05-07T02:14:29.405Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backup","docker","hsdp","ironio","postgresql"],"created_at":"2024-11-19T12:14:10.400Z","updated_at":"2026-05-08T01:35:46.294Z","avatar_url":"https://github.com/loafoe.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iron-streaming-backup\n\nA Docker image that you can schedule on HSDP IronIO to perform PostgreSQL backups to an S3 bucket\n\n# Features\n- Streaming backups so not dependent on runner disk storage\n- Compresses and encrypts backups\n\n# Usage\n\n## Prerequisites\n- IronIO CLI\n- Siderite CLI\n- Provisioned: one or more PostgreSQL RDS instances you want to backup\n- Provisioned: HSDP Iron instance\n- Provisioned: HSDP S3 bucket for storing backups\n\n## Preparing payload.json\nAs the image uses [siderite](https://github.com/philips-labs/siderite) for runtime orchestration all the required credentials will be passed through a `payload.json` file which will be stored encrypted in the IronIO scheduled task definition.\n\nThe payload should have the following `cmd` and `env`-ironment variables\n\n```json\n{\n  \"version\": \"1\",\n  \"cmd\": [\"/app/backup.sh\"],\n  \"env\": {\n\t\"PGPASS_FILE_BASE64\": \"cG9zdGdyZXMtZGIuZGVmc2ZzYS51cy1lYXN0LTEucmRzLmFtYXpvbmF3cy5jb206NTQzMjpoc2RwX3BnOnh4VXNlckF4eDp5eVBhc3N3ZEF5eTpkYjEKcG9zdGdyZXMtZGIuZGVmc2ZzYi51cy1lYXN0LTEucmRzLmFtYXpvbmF3cy5jb206NTQzMjpoc2RwX3BnOnh4VXNlckJ4eDp5eVBhc3N3ZEJ5eTpkYjIK\",\n\t\"PASS_FILE_BASE64\": \"TXlTZWNyZXRQYXNzd29yZAo=\",\n\t\"AWS_ACCESS_KEY_ID\": \"APIKeyHere\",\n\t\"AWS_SECRET_ACCESS_KEY\": \"SecretKeyHere\",\n\t\"S3_BUCKET\": \"cf-s3-some-random-uuid-here\"\n  }\n}\n```\n\n### PGPASS_FILE_BASE64\nThe pgpass file contains the credentials for each PostgreSQL database you want to back up. The format is one database per line:\n\n```\nhostname:port:database:username:password:someprefix\n```\n\nExample:\n\n```\npostgres-db.defsfsa.us-east-1.rds.amazonaws.com:5432:hsdp_pg:xxUserAxx:yyPasswdAyy:db1\npostgres-db.defsfsb.us-east-1.rds.amazonaws.com:5432:hsdp_pg:xxUserBxx:yyPasswdByy:db2\n```\n\nOnce you've prepared the file encode it using base64 to get the value to use:\n\n```shell\ncat pgpass|base64\ncG9zdGdyZXMtZGIuZGVmc2ZzYS51cy1lYXN0LTEucmRzLmFtYXpvbmF3cy5jb206NTQzMjpoc2RwX3BnOnh4VXNlckF4eDp5eVBhc3N3ZEF5eTpkYjEKcG9zdGdyZXMtZGIuZGVmc2ZzYi51cy1lYXN0LTEucmRzLmFtYXpvbmF3cy5jb206NTQzMjpoc2RwX3BnOnh4VXNlckJ4eDp5eVBhc3N3ZEJ5eTpkYjIK\n```\n\n### PASS_FILE_BASE64\nThe pass file contains the key (password) that will be used to encrypt the database backups using AES-256\n\n```shell\necho -n 'MySecretPassword'|base64\nTXlTZWNyZXRQYXNzd29yZA==\n```\n\n### AWS_ACCESS_KEY_ID\nThis should be the `api_key` of the HSDP S3 Bucket you provisioned\n\n### AWS_SECRET_ACCESS_KEY\nThis should be the `secret_key` of the HSDP S3 Bucket you provisioned\n\n### S3_BUCKET\nThis should be the `bucket` of the HSDP S3 Bucket you provisioned\n\n# Scheduling the task\nOnce you've prepared the `payload.json` file can you encrypt it using `siderite`\n\n```shell\ncat payload.json|siderite encrypt \u003e payload.enc\n```\n\nNow you need the IronIO cluster ID\n\n```shell\ncat ~/.iron.json |jq -r .cluster_info[0].cluster_id\n56someclusteridhere34554\n````\n\nRegister the `iron-streaming-backup` Docker image in IronIO. You only need to do this once or after updating or publishing the Docker image in this repository\n\n```shell\niron register philipslabs/iron-streaming-backup:latest\n```\n\nFinally, you can schedule the task. In the below example the backup task will run once every day\n\n```shell\niron worker schedule \\\n\t-cluster 56someclusteridhere34554 \\\n\t-run-every 86400 \\\n\t-payload-file payload.enc philipslabs/iron-streaming-backup\n```\n\n# Bucket lifecycle policy\nIt is advised to set a S3 Bucket lifecycle policy. A good practice is to move your database backups to the `GLACIER` storage class after a couple of days and to set a expiration date to automatically delete older backups. The below policy moves dumps to `CLACIER` after 7 days and deletes them after 6 months (180 days)\n\n```json\n[\n  {\n    \"Expiration\": {\n      \"Days\": 180\n    },\n    \"ID\": \"Move to Glacier and expire after 6 months\",\n    \"Prefix\": \"\",\n    \"Status\": \"Enabled\",\n    \"Transitions\": [\n      {\n        \"Days\": 7,\n        \"StorageClass\": \"GLACIER\"\n      }\n    ]\n  }\n]\n```\n\n# Retrieving and decrypting a backup\n- Copy the `.gz.aes` file from the bucket back to your restore system\n- Decrypting the file, assuming your password is stored in the file `${password_file}`:\n```shell\nopenssl enc -in backup_file.gz.aes -aes-256-cbc -d -pass file:${password_file} |gzip -d \u003e pg_dump_file.sql\n```\n\n# License\n\nLicense is MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floafoe%2Firon-streaming-backup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floafoe%2Firon-streaming-backup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floafoe%2Firon-streaming-backup/lists"}