odoo / docker

Other
960 stars 1.55k forks source link

[12] /usr/bin/odoo ignores options set by entrypoint #282

Open hleb-rubanau opened 4 years ago

hleb-rubanau commented 4 years ago

It seems /entrypoint.sh in 12.0 is the same as for 11.0

it checks some variables (also towards config file) and sets a line of database arguments to be appended to /usr/bin/odoo invocation

The problem is, when server starts it reports database as default@default:default

I do not see any parsing of --db_name, --db_host, --db_port and --db_password in the code of odoo12.

Also it seems odoo12 checks variables PGPORT, PGHOST, etc which are not checked by entrypoint at all.

Seems some contract was changed on odoo side but changes ignored in Docker image

d-fence commented 4 years ago

Odoo 12.0 parses those arguments here

Also, I'm not sure that it would be a good idea to transfer PGPORT and PGHOST from the host environment to the guest docker container ?!

llacroix commented 4 years ago

@d-fence You don't have to transfer the env variables from the host to the guest docker container. But you could well defined them using the db_host, db_port, db_password and db_name.

Inside the entrypoint, you'd just have to export the values to PGHOST, PGPORT, PGPASSWORD and PGDATABASE so when odoo starts, you don't have to pass any configuration to odoo. In practice, you can create a connection to the database using the defaults available. So no need to hardcode anything inside a script.

the connection to postgres becomes connect("") instead of passing parameters. This way if your postgres server doesn't require passwords defining proper variables will allow psycopg2 to connect to the server regardless of passing a password or not. Env variables can be passed to the container using -e or by adding env variables to the service.. It has nothing to do with the Host.

That said, PGPASSWORD shouldn't be defined as it will be available in the env variables so anything that can dump os.environ will see the password of the database. Instead use .pgpass to define passwords.

lathama commented 6 months ago

@hleb-rubanau Have you checked this in Odoo 17? If this issue is no longer current can you close?