Skip to content

Commit

Permalink
add variables (TA#11537) (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
foutoucour authored May 3, 2019
1 parent 69dfc9a commit 64e7282
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 4 deletions.
22 changes: 22 additions & 0 deletions README.md
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._
21 changes: 17 additions & 4 deletions docker_files/extended_entrypoint.sh
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 "$@"

0 comments on commit 64e7282

Please sign in to comment.