feat(snippets): make database wait conditional on hostname resolution in entrypoint

- Modified `entrypoint.sh` to skip `wait-for-pg` if the database hostname cannot be resolved, logging a warning instead.
- Removed explicit `wait-for-pg` calls from `odoo`, `odoo-nginx`, and default command paths as the check is now handled conditionally.
- Updated `CHANGELOG.md` under the `[Unreleased]` section to document these changes.
This commit is contained in:
Janik von Rotz committed 2026-08-18 10:04:36 +02:00
1 parent a60cebbb63
commit 64a5bade34
2 files changed
+11 -10

No files matched your search

+3 -2
View File
@@ -2,8 +2,7 @@
All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
## Undefined
## [Unreleased]
### Added
@@ -12,6 +11,8 @@ All notable changes to this project will be documented in this file. The format
### Changed
- Renamed `download-git-archive` to `download-odoo-enterprise`.
- Modified `entrypoint.sh` to skip `wait-for-pg` if the database hostname cannot be resolved, logging a warning instead.
- Removed explicit `wait-for-pg` calls from `odoo`, `odoo-nginx`, and default command paths in `entrypoint.sh` as the check is now handled conditionally.
## 2026-05-20
+8 -8
View File
@@ -52,8 +52,11 @@ check_config "db_password" "$PGPASSWORD"
check_config "db_sslmode" "$PGSSLMODE"
log-entrypoint "Resolve database hostname: $PGHOST"
getent hosts "$PGHOST"
wait-for-pg
if getent hosts "$PGHOST"; then
wait-for-pg
else
log-entrypoint "Warning: could not resolve $PGHOST, skipping wait-for-pg"
fi
AUTO_UPDATE_MODULES_LIST="${AUTO_UPDATE_MODULES_LIST:=False}"
if [[ "$AUTO_UPDATE_MODULES_LIST" = "True" ]]; then
@@ -71,20 +74,17 @@ case "$1" in
if [[ "$1" == "scaffold" ]] ; then
exec odoo "$@"
else
wait-for-pg
exec odoo "$@" "${DB_ARGS[@]}"
exec odoo "${DB_ARGS[@]}" "$@"
fi
;;
-- | odoo-nginx)
shift
log-entrypoint 'Start Odoo with nginx.'
wait-for-pg
nginx -c /etc/nginx/nginx.conf &
exec odoo "$@" "${DB_ARGS[@]}"
exec odoo "${DB_ARGS[@]}" "$@"
;;
-*)
wait-for-pg
exec odoo "$@" "${DB_ARGS[@]}"
exec odoo "${DB_ARGS[@]}" "$@"
;;
*)
exec "$@"