odoo / docker

Other
969 stars 1.56k forks source link

PORT environment variable conflicts with Google Cloud Run #344

Open sffc opened 3 years ago

sffc commented 3 years ago

As documented in the Odoo Docker Readme, the Odoo container expects the following environment variables:

Unfortunately, the name for PORT conflicts with the PORT variable used in Google Cloud Run, which is the port of the application server, not the port of the database. This means that Odoo cannot be deployed on Google Cloud Run without additional workarounds.

Suggested backwards-compatible fix: allow DB_HOST and DB_PORT as environment variables, and if they are present, they are used instead of HOST and PORT when connecting to Postgres.

tbinna commented 3 years ago

Same issue here and I think the idea suggested above is a good solution. It would also help clarity to prefix the environment variables with DB_ as it would be instantly clear that they are not for the Odoo server itself.

helloworlddan commented 2 years ago

Cloud Run is not the only compute platform that will prepopulate a PORT env var, so I guess @sffc 's suggested change makes a lot of sense. Additionally, having something as unspecific as PORT refer to a very specific downstream PGSQL dependency feels really counter-intuitive. The same is true for HOST, PASSWORD and USER, all refering to PGSQL starting here but probably well extending into the web server configuration of upstream odoo.

helloworlddan commented 2 years ago

So it seems that database connectivity can also be specified in a config file. Assuming that the config in the file takes precedence over ENV vars, one could build a slight variation of the odoo image that configures PGSQL in /etc/odoo.conf and that may be able to run on platforms like Cloud Run.

LeonFedotov commented 1 year ago

Same issue with amazon appRunner here, there seems no way of overriding that behavior in apprunner either

LeonFedotov commented 1 year ago

iv'e been able to get everything working, if you have access to the cmd and you can overwrite it. env PORT=5432 /entrypoint.sh odoo this will be executed within entrypoint and will reset the port number. another option might be changing the postgress port to the preset PORT internally.

mooperd commented 1 year ago

+1

lathama commented 7 months ago

@sffc do the responses in this issue help you at all? Do you need this issue or can it be closed?

sffc commented 7 months ago

I don't use this deployment any more, but if it hasn't been fixed, this would still be a pain point in deploying Odoo on Google Cloud Platform. The only workaround suggested in this thread is https://github.com/odoo/docker/issues/344#issuecomment-1378624472, which requires running a custom command line in the container, meaning that the Odoo image can't be used off-the-shelf in GCP.

lathama commented 7 months ago

So we need a PR against https://github.com/docker-library/docs/blob/master/odoo/content.md and the entrypoint.sh to update to a more Odoo ENV name. And they would need to be committed at the same time.

sffc commented 7 months ago

My suggestion in the OP is to add additional variables that don't require breaking existing customers and documentation.