[ADD] docker add update_all_db and stop_before_init

- stop_before_init wait before launch odoo script
- update_all_db for an update of database
- docker_build.sh add --no-cache option
- Increate limit_time in odoo_conf
This commit is contained in:
Mathieu Benoit 2020-10-25 02:01:52 -04:00
parent 5b23f32b44
commit 8facd58991
4 changed files with 33 additions and 8 deletions

View file

@ -11,6 +11,9 @@ services:
PASSWORD: mysecretpassword PASSWORD: mysecretpassword
USER: odoo USER: odoo
POSTGRES_DB: postgres POSTGRES_DB: postgres
STOP_BEFORE_INIT: "False"
DB_NAME: ""
UPDATE_ALL_DB: "False"
depends_on: depends_on:
- db - db
command: odoo command: odoo

View file

@ -71,14 +71,29 @@ case "$1" in
exec odoo "$@" || exec odoo-bin "$@" exec odoo "$@" || exec odoo-bin "$@"
else else
cd $ODOO_PREFIX cd $ODOO_PREFIX
if [[ "${STOP_BEFORE_INIT}" == "True" ]] ; then
sleep 999999
fi
./docker/wait-for-psql.py ${DB_ARGS[@]} --timeout=30 ./docker/wait-for-psql.py ${DB_ARGS[@]} --timeout=30
exec ./.venv/bin/python $ODOO_EXEC_BIN "$@" "${DB_ARGS[@]}" -c /etc/odoo/odoo.conf if [[ "${UPDATE_ALL_DB}" == "True" ]] ; then
# --stop-after-init
exec ./.venv/bin/python $ODOO_EXEC_BIN "$@" "${DB_ARGS[@]}" -c /etc/odoo/odoo.conf -u all -d "${DB_NAME}"
else
exec ./.venv/bin/python $ODOO_EXEC_BIN "$@" "${DB_ARGS[@]}" -c /etc/odoo/odoo.conf
fi
fi fi
;; ;;
-*) -*)
cd $ODOO_PREFIX cd $ODOO_PREFIX
if [[ "${STOP_BEFORE_INIT}" == "True" ]] ; then
sleep 999999
fi
./docker/wait-for-psql.py ${DB_ARGS[@]} --timeout=30 ./docker/wait-for-psql.py ${DB_ARGS[@]} --timeout=30
exec ./.venv/bin/python $ODOO_EXEC_BIN "$@" "${DB_ARGS[@]}" -c /etc/odoo/odoo.conf if [[ "${UPDATE_ALL_DB}" == "True" ]] ; then
exec ./.venv/bin/python $ODOO_EXEC_BIN "$@" "${DB_ARGS[@]}" -c /etc/odoo/odoo.conf -u all -d "${DB_NAME}"
else
exec ./.venv/bin/python $ODOO_EXEC_BIN "$@" "${DB_ARGS[@]}" -c /etc/odoo/odoo.conf
fi
;; ;;
*) *)
exec "$@" exec "$@"

View file

@ -446,13 +446,13 @@ max_cron_threads = 1
# Prevents the worker from using more than <limit> CPU seconds for each # Prevents the worker from using more than <limit> CPU seconds for each
# request. If the limit is exceeded, the worker is killed # request. If the limit is exceeded, the worker is killed
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
limit_time_cpu = 600 limit_time_cpu = 2400
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Prevents the worker from taking longer than <limit> seconds to process a # Prevents the worker from taking longer than <limit> seconds to process a
# request. If the limit is exceeded, the worker is killed. # request. If the limit is exceeded, the worker is killed.
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
limit_time_real = 900 limit_time_real = 3600
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Maximum allowed virtual memory per worker. If the limit is exceeded, the # Maximum allowed virtual memory per worker. If the limit is exceeded, the

View file

@ -1,15 +1,22 @@
#!/usr/bin/env bash #!/usr/bin/env bash
. ./env_var.sh . ./env_var.sh
ARGS=""
for arg in "$@"
do
if [ "$arg" == "--no-cache" ]
then
ARGS="${ARGS} --no-cache"
fi
done
# Rewrite docker-compose # Rewrite docker-compose
./script/docker_update_version.py --version=${ERPLIBRE_VERSION} --base=${ERPLIBRE_DOCKER_BASE} --prod=${ERPLIBRE_DOCKER_PROD} ./script/docker_update_version.py --version=${ERPLIBRE_VERSION} --base=${ERPLIBRE_DOCKER_BASE} --prod=${ERPLIBRE_DOCKER_PROD}
cd docker cd docker
ARGS=--build-arg=WORKING_BRANCH=$(git rev-parse --abbrev-ref HEAD) ARGS="${ARGS} --build-arg=WORKING_BRANCH=$(git rev-parse --abbrev-ref HEAD)"
# Clear cache
# ARGS="${ARGS} --no-cache"
set -e set -e