Open sffc opened 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.
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.
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.
Same issue with amazon appRunner here, there seems no way of overriding that behavior in apprunner either
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.
+1
@sffc do the responses in this issue help you at all? Do you need this issue or can it be closed?
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.
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.
My suggestion in the OP is to add additional variables that don't require breaking existing customers and documentation.
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
andDB_PORT
as environment variables, and if they are present, they are used instead ofHOST
andPORT
when connecting to Postgres.