{"id":25132088,"url":"https://github.com/archef2000/ha-postgres","last_synced_at":"2025-10-06T17:57:20.525Z","repository":{"id":276298842,"uuid":"923521294","full_name":"archef2000/ha-postgres","owner":"archef2000","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-22T12:30:21.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-02T02:31:29.131Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/archef2000.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-28T11:55:18.000Z","updated_at":"2025-02-22T12:30:24.000Z","dependencies_parsed_at":"2025-02-07T12:36:37.803Z","dependency_job_id":null,"html_url":"https://github.com/archef2000/ha-postgres","commit_stats":null,"previous_names":["archef2000/ha-postgres"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/archef2000/ha-postgres","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archef2000%2Fha-postgres","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archef2000%2Fha-postgres/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archef2000%2Fha-postgres/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archef2000%2Fha-postgres/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/archef2000","download_url":"https://codeload.github.com/archef2000/ha-postgres/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archef2000%2Fha-postgres/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278655139,"owners_count":26022967,"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-06T02:00:05.630Z","response_time":65,"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":[],"created_at":"2025-02-08T14:16:44.734Z","updated_at":"2025-10-06T17:57:20.480Z","avatar_url":"https://github.com/archef2000.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ha-postgres\n## deploy\n1. copy the docker-compose file to the desired location\n2. edit the volumes path\n3. set all environment variables to random secret values\n4. run `docker compose up -d`\n\n## motivation\nI wanted to have an easy way to deploy a postgres cluster that has the least amount of moving parts and has one of the latest portgres versions with a posibility to upgrade it later.\n\n## constraints\n* at least 3 etcd containers\n* at lease 2 postgres containers, but 3 are recommended\n* at least 1 postgres-proxy container, but 2 are recommended for less downtime between updates\n\n## architecture\n```mermaid\nflowchart TD\n\nA[App] --\u003e proxy\n\nsubgraph proxy[proxy service]\notherProxies[...]\nsubgraph proxy1\n:5432[Listens on port 5432 for the current primary]\n:5433[Listens on port 5433 for the replicas]\nend\nend\n\n:5432 --\u003e postgres1 --\u003e etcd\n:5433 --\u003e postgres2 --\u003e etcd\n:5433 --\u003e postgres3 --\u003e etcd\n\nproxy1 --\u003e etcd  \n\nsubgraph postgres service\npostgres1[primary]\nsubgraph replicas\npostgres3[\"replica of primary (postgres3)\"]\npostgres2[\"replica of primary (postgres2)\"]\nend\nend\n\nsubgraph etcd[etcd service]\netcd1\netcd2\netcd3\nend\n```\n\n## Usefull commands\n```bash\netcdctl endpoint status --write-out=table\netcdctl member list\npatronictl list\n# check if postgres1 is the master\ncurl http://postgres1:8008/master\n# test connection to proxy\npsql postgres://postgres:postgres@postgresha:5432\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchef2000%2Fha-postgres","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farchef2000%2Fha-postgres","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchef2000%2Fha-postgres/lists"}