{"id":21997522,"url":"https://github.com/stephane-klein/playground-postgresql-walg","last_synced_at":"2025-10-08T22:08:17.099Z","repository":{"id":50651140,"uuid":"251005551","full_name":"stephane-klein/playground-postgresql-walg","owner":"stephane-klein","description":"wal-g - Archival and Restoration for Postgres playground based on Docker","archived":false,"fork":false,"pushed_at":"2022-10-25T18:00:27.000Z","size":26,"stargazers_count":29,"open_issues_count":4,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-30T21:04:52.297Z","etag":null,"topics":["backup-database","backup-solution","playground","postgresql"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stephane-klein.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-29T10:26:31.000Z","updated_at":"2025-02-18T10:32:09.000Z","dependencies_parsed_at":"2023-01-20T11:30:14.772Z","dependency_job_id":null,"html_url":"https://github.com/stephane-klein/playground-postgresql-walg","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stephane-klein/playground-postgresql-walg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephane-klein%2Fplayground-postgresql-walg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephane-klein%2Fplayground-postgresql-walg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephane-klein%2Fplayground-postgresql-walg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephane-klein%2Fplayground-postgresql-walg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stephane-klein","download_url":"https://codeload.github.com/stephane-klein/playground-postgresql-walg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephane-klein%2Fplayground-postgresql-walg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000779,"owners_count":26082851,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-database","backup-solution","playground","postgresql"],"created_at":"2024-11-29T22:16:52.563Z","updated_at":"2025-10-08T22:08:17.050Z","avatar_url":"https://github.com/stephane-klein.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wal-g - Archival and Restoration for Postgres playground based on Docker\n\nThis playground is written as small scenario:\n\n1. start PostgreSQL instance 1\n2. create a schema and insert some data to instance 1\n3. create instance 1 full backup to Minio server (S3 like)\n4. insert other data to instance 1\n5. start and restore data to PostgreSQL instance 2\n6. check all data (first backup + [WAL data](https://www.postgresql.org/docs/12/wal-intro.html))\n\n## Some resources\n\n- [walg-g](https://github.com/wal-g/wal-g)\n- [25.3. Continuous Archiving and Point-in-Time Recovery (PITR)](https://www.postgresql.org/docs/12/continuous-archiving.html#BACKUP-PITR-RECOVERY)\n- [PostgreSQL Sauvegardes et Réplication](https://public.dalibo.com/exports/formation/manuels/formations/dba3/dba3.handout.html)\n- [MikeTangoEcho/postgres-walg](https://github.com/MikeTangoEcho/postgres-walg)\n- [PostgreSQL WAL Archiving with WAL-G and S3: Complete Walkthrough](https://www.fusionbox.com/blog/detail/postgresql-wal-archiving-with-wal-g-and-s3-complete-walkthrough/644/)\n\n## The test scenario\n\nBuild Docker Images:\n\n```\n$ ./scripts/build-postgres-with-wal-g-docker-image.sh\n```\n\nStart PostreSQL instance 1 and Minio (S3 like) server:\n\n```\n$ docker-compose up -d postgres1 s3\n```\n\nWait `postgres1` starting…\n\nCreate database schema and insert some data to instance 1:\n\n```\n$ ./scripts/pg1/load-seed.sh\n$ ./scripts/pg1/insert-fixtures.sh\n```\n\nCheck data inserted\n\n```\n$ ./scripts/pg1/query.sh\n count\n-------\n    10\n(1 row)\n```\n\nCreate instance 1 full backup to Minio server:\n\n```\n$ ./scripts/pg1/make-basebackup.sh\n```\n\nCheck PostgreSQL instance 1 stats archiver informations:\n\n```\n$ ./scripts/pg1/show-pg-stats-archiver.sh\n-[ RECORD 1 ]------+-----------------------------------------\narchived_count     | 4\nlast_archived_wal  | 000000010000000000000003.00000028.backup\nlast_archived_time | 2020-04-01 22:12:52.273572+00\nfailed_count       | 0\nlast_failed_wal    |\nlast_failed_time   |\nstats_reset        | 2020-04-01 22:12:19.392116+00\n```\n\nInsert other data (after first full backup):\n\n```\n$ ./scripts/pg1/insert-fixtures.sh\n$ ./scripts/pg1/query.sh\n count\n-------\n    20\n(1 row)\n```\n\nwait 60s and check PostgreSQL instance 1 stats archiver informations:\n\n```\n$ ./scripts/pg1/show-pg-stats-archiver.sh\nselect * from pg_stat_archiver;\n-[ RECORD 1 ]------+------------------------------\n-[ RECORD 1 ]------+------------------------------\narchived_count     | 5\nlast_archived_wal  | 000000010000000000000004\nlast_archived_time | 2020-04-01 22:15:53.046315+00\nfailed_count       | 0\nlast_failed_wal    |\nlast_failed_time   |\nstats_reset        | 2020-04-01 22:12:19.392116+00\n```\n\nNow, the purpose is to verify the instance 1 data restoration to PostgreSQL instance 2:\n\n```\n$ ./scripts/pg2/restore.sh\n```\n\nWait instance 2 started...\n\n```\n$ ./scripts/pg2/query.sh\n count\n-------\n    20\n(1 row)\n```\n\nIf value is 20 then full data + WAL data are restored to instance 2.\n\n## Configure encryption and decryption with OpenPGP standard\n\nFirst generate GnuPG key:\n\n```\n$ gpg2 --batch --passphrase '' --quick-gen-key wal-g-test-1\n```\n\n```\n$ gpg2 -K\n/Users/stephane/.gnupg/pubring.kbx\n----------------------------------\n...\n\nsec   rsa2048 2020-04-04 [SC] [expire : 2022-04-04]\n      576A8B01273901177B4229788C9D5E81FD721DD8\nuid          [  ultime ] wal-g-test-1\nssb   rsa2048 2020-04-04 [E]\n```\n\nExport key:\n\n```\n$ mkdir -p ./keys\n$ gpg2 -a --export wal-g-test-1 \u003e ./keys/wal-g-test-1.pub\n$ gpg2 -a --export-secret-keys wal-g-test-1 \u003e ./keys/wal-g-test-1.private\n```\n\nUncomment `WALG_PGP_KEY_PATH` variable env in `postgres1` and `postgres2` services in `docker-compose.yml`.\n\nNext, replay « The test scenario ».","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephane-klein%2Fplayground-postgresql-walg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephane-klein%2Fplayground-postgresql-walg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephane-klein%2Fplayground-postgresql-walg/lists"}