-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
69dfc9a
commit 64e7282
Showing
2 changed files
with
39 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,25 @@ | ||
# odoo-public | ||
|
||
Patches and fixes can be found in [numigi/odoo repo](https://github.com/Numigi/odoo) | ||
|
||
## extended_entrypoint.sh | ||
|
||
Extension of the intial entrypoint bash script to improve interaction with the database server. | ||
When the database server is part of the docker-compose stack, we need to wait for the | ||
database server to be ready before to start the odoo server. | ||
|
||
That is the purpose of the script. | ||
|
||
### usage | ||
When you launch the odoo server, you see the message `waiting for postgres...on db`. | ||
|
||
The line after displays the status: `no response` or `accepting connections`. | ||
|
||
#### Variables | ||
* WAIT_FOR_DB_HOST: to enable or disable the wait. Default: true. (disabled on any other value). | ||
|
||
_The variable is useful to manage the case of hosted database server that we don't want to wait._ | ||
|
||
* DB_HOST: name of service that hosts to wait for. Default: db. | ||
|
||
_Change the name of the service of the postgres server is different._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,21 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
until pg_isready --host=db; do | ||
echo "$(date) - waiting for postgres...on db" | ||
sleep 1 | ||
done | ||
|
||
# allow to mentioned if the sleep should be operated. | ||
# the wait is useful when the db server is started at the docker-compose up | ||
# useless for hosted servers. | ||
wait_for_db_host=${WAIT_FOR_DB_HOST:-true} | ||
|
||
if [[ "${wait_for_db_host}" = true ]] ; then | ||
|
||
# allow to use a different name for the host of the db than "db" | ||
# useful when multiple odoo stacks are deployed on the same machine | ||
db_host=${DB_HOST:-db} | ||
|
||
until pg_isready --host=${db_host}; do | ||
echo "$(date) - waiting for postgres...on ${db_host}" | ||
sleep 1 | ||
done | ||
fi | ||
|
||
exec /entrypoint.sh "$@" |