Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add [read-database] config #73

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ docker pull ghcr.io/voxpupuli/puppetdb:7.13.0-v1.2.1
| **PUPPETDB_POSTGRES_DATABASE** | The name of the puppetdb database in postgres<br><br>`puppetdb` |
| **PUPPETDB_USER** | The puppetdb database user<br><br>`puppetdb` |
| **PUPPETDB_PASSWORD** | The puppetdb database password<br><br>`puppetdb` |
| **PUPPETDB_READ_USER** | The puppetdb database read-only user<br><br>(optional) |
| **PUPPETDB_READ_PASSWORD** | The puppetdb database read-only password<br><br>(optional) |
| **PUPPETDB_NODE_TTL** | Mark as ‘expired’ nodes that haven’t seen any activity (no new catalogs, facts, or reports) in the specified amount of time<br><br>`7d` |
| **PUPPETDB_NODE_PURGE_TTL** | Automatically delete nodes that have been deactivated or expired for the specified amount of time<br><br>`14d` |
| **PUPPETDB_REPORT_TTL** | Automatically delete reports that are older than the specified amount of time<br><br>`14d` |
Expand Down
2 changes: 2 additions & 0 deletions puppetdb/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ ENV PUPPETDB_POSTGRES_HOSTNAME="postgres" \
WAITFORCERT="" \
PUPPETDB_USER=puppetdb \
PUPPETDB_PASSWORD=puppetdb \
PUPPETDB_READ_USER="" \
PUPPETDB_READ_PASSWORD="" \
PUPPETDB_NODE_TTL=7d \
PUPPETDB_NODE_PURGE_TTL=14d \
PUPPETDB_REPORT_TTL=14d \
Expand Down
5 changes: 5 additions & 0 deletions puppetdb/conf.d/read-database.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
read-database: {
subname: "//"${PUPPETDB_POSTGRES_HOSTNAME}":"${PUPPETDB_POSTGRES_PORT}"/"${PUPPETDB_POSTGRES_DATABASE}
username: ${PUPPETDB_READ_USER}
password: ${PUPPETDB_READ_PASSWORD}
}
5 changes: 5 additions & 0 deletions puppetdb/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

set -e

# Remove optional config files if values are not set
if [[ ( -z "$PUPPETDB_READ_USER" || -z "$PUPPETDB_READ_PASSWORD" ) && -e /etc/puppetlabs/puppetdb/conf.d/read-database.conf ]]; then
rm /etc/puppetlabs/puppetdb/conf.d/read-database.conf
fi

for f in /docker-entrypoint.d/*.sh; do
echo "Running $f"
"$f"
Expand Down
Loading