Bhavya-Sonigra opened a new pull request, #4252:
URL: https://github.com/apache/hertzbeat/pull/4252
Fixes #4218
## What's changed?
The `hertzbeat-postgresql-victoria-metrics` docker-compose deployment
previously hardcoded PostgreSQL credentials (`root`/`123456`) directly in
`docker-compose.yaml`, making it trivial for anyone with network access to
connect to the database using well-known default credentials.
This PR:
- Introduces a `.env.example` file with placeholder credentials and
instructions to copy it to `.env`
- Updates `docker-compose.yaml` to read `POSTGRES_USER`/`POSTGRES_PASSWORD`
from environment variables instead of hardcoding them
- Uses Docker Compose's `${VAR:?error message}` syntax so `docker compose
up` fails with a clear error if `POSTGRES_PASSWORD` isn't set, rather than
silently falling back to a known-weak default
- Passes the same credentials to the `hertzbeat` service via
`SPRING_DATASOURCE_USERNAME`/`SPRING_DATASOURCE_PASSWORD` so the app connects
correctly
- Adds `.env` to `.gitignore` so real passwords are never committed
Tested locally: verified the stack starts and connects correctly with a
password set in `.env`, and verified `docker compose up` fails with a clear
error message when `.env`/`POSTGRES_PASSWORD` is missing.
This fix covers the `hertzbeat-postgresql-victoria-metrics` variant
specifically, matching the deploy guide referenced in the issue. Happy to
follow up with the same fix for the other docker-compose variants if
maintainers want that as a separate PR.
## Checklist
- [x] I have read the Contributing Guide
- [ ] I have written the necessary doc or comment.
- [ ] I have added the necessary unit tests and all cases have passed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]