[IMP] 11.0-13.0: Wait for PostgreSQL before starting Odoo

In some situations, like when a docker compose file use a data volume
to persist postgresql databases, the Odoo server starts and tries to
connect to database server before the postgresql server is ready.

In such a case, the Odoo containers fails to start.

With this commit, the wait-for-it script is used to wait for the
database server service to be ready before starting Odoo.

This script is available as a Debian package.

Closes #258, closes #259
This commit is contained in:
rbuisson 2019-07-16 15:16:04 +02:00 committed by Christophe Monniez
parent f126d72f66
commit 14e51ae334
6 changed files with 12 additions and 0 deletions

View File

@ -13,6 +13,7 @@ RUN set -x; \
&& apt-get install -y --no-install-recommends \ && apt-get install -y --no-install-recommends \
ca-certificates \ ca-certificates \
curl \ curl \
wait-for-it \
dirmngr \ dirmngr \
fonts-noto-cjk \ fonts-noto-cjk \
gnupg \ gnupg \

View File

@ -23,6 +23,9 @@ check_config "db_port" "$PORT"
check_config "db_user" "$USER" check_config "db_user" "$USER"
check_config "db_password" "$PASSWORD" check_config "db_password" "$PASSWORD"
# Wait for the database to be up
wait-for-it $HOST:$PORT --timeout=60 -- sleep 5s
case "$1" in case "$1" in
-- | odoo) -- | odoo)
shift shift

View File

@ -13,6 +13,7 @@ RUN set -x; \
&& apt-get install -y --no-install-recommends \ && apt-get install -y --no-install-recommends \
ca-certificates \ ca-certificates \
curl \ curl \
wait-for-it \
dirmngr \ dirmngr \
fonts-noto-cjk \ fonts-noto-cjk \
gnupg \ gnupg \

View File

@ -23,6 +23,9 @@ check_config "db_port" "$PORT"
check_config "db_user" "$USER" check_config "db_user" "$USER"
check_config "db_password" "$PASSWORD" check_config "db_password" "$PASSWORD"
# Wait for the database to be up
wait-for-it $HOST:$PORT --timeout=60 -- sleep 5s
case "$1" in case "$1" in
-- | odoo) -- | odoo)
shift shift

View File

@ -10,6 +10,7 @@ RUN set -x; \
&& apt-get install -y --no-install-recommends \ && apt-get install -y --no-install-recommends \
ca-certificates \ ca-certificates \
curl \ curl \
wait-for-it \
dirmngr \ dirmngr \
fonts-noto-cjk \ fonts-noto-cjk \
gnupg \ gnupg \

View File

@ -23,6 +23,9 @@ check_config "db_port" "$PORT"
check_config "db_user" "$USER" check_config "db_user" "$USER"
check_config "db_password" "$PASSWORD" check_config "db_password" "$PASSWORD"
# Wait for the database to be up
wait-for-it $HOST:$PORT --timeout=60 -- sleep 5s
case "$1" in case "$1" in
-- | odoo) -- | odoo)
shift shift