Script de déploiement de odoo dans un docker
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

entrypoint.sh 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. echo "ARGS are : $@"
  3. set -e
  4. ODOO="/opt/odoo/odoo/odoo-bin"
  5. if [ -v PASSWORD_FILE ]; then
  6. PASSWORD="$(< $PASSWORD_FILE)"
  7. fi
  8. # set the postgres database host, port, user and password according to the environment
  9. # and pass them as arguments to the odoo process if not present in the config file
  10. : ${HOST:=${DB_PORT_5432_TCP_ADDR:='db'}}
  11. : ${PORT:=${DB_PORT_5432_TCP_PORT:=5432}}
  12. : ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}}
  13. : ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='9fbacb5390fa08b1cea5c141498134021bead7ada7aa1731e6fdd3eae60af92b'}}}
  14. DB_ARGS=()
  15. function check_config() {
  16. param="$1"
  17. value="$2"
  18. if grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then
  19. value=$(grep -E "^\s*\b${param}\b\s*=" "$ODOO_RC" |cut -d " " -f3|sed 's/["\n\r]//g')
  20. fi;
  21. DB_ARGS+=("--${param}")
  22. DB_ARGS+=("${value}")
  23. }
  24. check_config "db_host" "$HOST"
  25. check_config "db_port" "$PORT"
  26. check_config "db_user" "$USER"
  27. check_config "db_password" "$PASSWORD"
  28. case "$1" in
  29. -- | odoo)
  30. shift
  31. if [[ "$1" == "scaffold" ]] ; then
  32. exec $ODOO "$@"
  33. else
  34. wait-for-psql.py ${DB_ARGS[@]} --timeout=30
  35. exec $ODOO "$@" "${DB_ARGS[@]}"
  36. fi
  37. ;;
  38. -*)
  39. wait-for-psql.py ${DB_ARGS[@]} --timeout=30
  40. exec $ODOO "$@" "${DB_ARGS[@]}"
  41. ;;
  42. *)
  43. exec "$@"
  44. esac
  45. exit 1