puppetlabs / puppetlabs/puppetlabs-postgresql
Support `standby.signal` file to mark postgres 12+ instances as replicas
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 232
- Forks
- 610
- Avg merge
- 5d 23h
- Merged PRs (30d)
- 4
Description
Use Case
Currently this role supports recovery.conf to configure a server to be a replica. As of postgresql 12+ recovery.conf has been removed and instead requires an empty file standby.signal to be in the data directory to mark the server as a replica.
it will then look to the config file to obtain settings such as primary_conninfo and restore_command amongst others to talk to upstream server for replication
Describe the Solution You Would Like
An option to mark postgresql 12+ servers as replicas with an option to tag replica=true or similar
Describe Alternatives You've Considered
Using the simple instance_directories functionality i tried to add the file
# “standby.signal” — which is an empty file—has replaced the recovery.conf file
# and the presence of this file will signal to the cluster to run in standby / replica mode.
#"/var/lib/postgresql/14/mydatabase/standby.signal":
# ensure: file
# owner: postgres
# group: postgres
This works fine for an existing database and we can see that the output of pg_lsclusters shows as online,recovery howere on a fresh install and Init db the file is placed before init.db is run and then init.db complains that it cant initialise the database because the data dir is not empty (because standby.signal is in there)
Additional Context
Happy to make a PR - currently just wanted to log the issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the existing recovery.conf replica handling and the instance_directories functionality, then trace how a fresh PostgreSQL installation initializes its data directory. Define how a replica option should create standby.signal without causing initdb to reject a non-empty directory, while preserving the existing behavior for initialized databases. Done means PostgreSQL 12+ instances can be marked as replicas during both fresh installation and subsequent management.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, ruby
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100