Skip to content

Commit

Permalink
[IMP] 11.0-13.0: Wait for PostgreSQL before starting Odoo
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rbuisson authored and d-fence committed Oct 16, 2019
1 parent f126d72 commit 14e51ae
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions 11.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ RUN set -x; \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
wait-for-it \
dirmngr \
fonts-noto-cjk \
gnupg \
Expand Down
3 changes: 3 additions & 0 deletions 11.0/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ check_config "db_port" "$PORT"
check_config "db_user" "$USER"
check_config "db_password" "$PASSWORD"

# Wait for the database to be up
wait-for-it $HOST:$PORT --timeout=60 -- sleep 5s

case "$1" in
-- | odoo)
shift
Expand Down
1 change: 1 addition & 0 deletions 12.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ RUN set -x; \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
wait-for-it \
dirmngr \
fonts-noto-cjk \
gnupg \
Expand Down
3 changes: 3 additions & 0 deletions 12.0/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ check_config "db_port" "$PORT"
check_config "db_user" "$USER"
check_config "db_password" "$PASSWORD"

# Wait for the database to be up
wait-for-it $HOST:$PORT --timeout=60 -- sleep 5s

case "$1" in
-- | odoo)
shift
Expand Down
1 change: 1 addition & 0 deletions 13.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ RUN set -x; \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
wait-for-it \
dirmngr \
fonts-noto-cjk \
gnupg \
Expand Down
3 changes: 3 additions & 0 deletions 13.0/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ check_config "db_port" "$PORT"
check_config "db_user" "$USER"
check_config "db_password" "$PASSWORD"

# Wait for the database to be up
wait-for-it $HOST:$PORT --timeout=60 -- sleep 5s

case "$1" in
-- | odoo)
shift
Expand Down

0 comments on commit 14e51ae

Please sign in to comment.