-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using unique service db names #515
Conversation
629560c
to
0ee4957
Compare
@ap-wtioit How does this look to you? |
This to me seems not just a problem with db service but with all services (e.g. smtp). I'm not sure if it is wise to run multiple Odoo projects/instances in the same network. (Or are you talking about the inverseproxy_shared network only?) What i get from the changes:
When using this please make sure the value of _key is a valid hostname otherwise some key values might cause connection issues. E.g. We are using a modified prod.yaml with and additional .docker/db-host.env file where PGHOST is defined and on deployment the file is created by symlinking to something like To prevent multiple services:
odoo:
...
networks:
default: {}
globalwhitelist_shared: {}
inverseproxy_shared:
aliases:
- "${DB_NAME:-odoo}-${DOODBA_ENVIRONMENT:-prod}"
... We use this for nginx providing access to Odoo from the web (instead of using traeffik). So to sum it up, it looks ok. Only if someone already added PGHOST in db-access.env (or in our case new db-host.env) this could be a breaking change if Edit: expected to need longer to find this. But indeed |
Hi Andreas, First of all, thank you for your detailed feedback and suggestions! 😊 To clarify, yes, this issue occurs specifically with the inverseproxy_shared network. It's a very odd problem because it only happens on a couple of servers, while on the rest everything works just fine. Also, regarding your setup, we actually use one PostgreSQL container per Odoo instance, rather than having one container per PostgreSQL version. This approach helps us avoid conflicts between instances, but the shared network issue seems to still persist in those specific cases (I think it cloud be a kind of bug on Docker Compose). Our PGHOST is currently defined here. However, I need it to change dynamically based on the unique db service name, which is the reason behind my changes. |
ca133d6
to
a39a3e3
Compare
d6765c0
to
c5362b7
Compare
5e432a2
to
64f1ba8
Compare
ff7d505
to
6fe3c9f
Compare
6fe3c9f
to
6d5d3e0
Compare
Setting environment variable PGHOST to current service name
6d5d3e0
to
ac1375c
Compare
Could you please, check this out @pedrobaeza ? I think it's ready to go. |
Hey @josep-tecnativa, it seems I'm a bit late to the party, but I just noticed this change after we ran an update on one of our projects and saw that scripts were failing due to the I personally believe that compose service names (together with volume and network names) should be treated as part of the template's "API" and should remain stable throughout (perhaps with the exception of major releases). I've tried to replicate in various ways the issue this PR address and haven't been able to. You mentioned the issue only appears in a couple of servers, and just like @ap-wtioit said this does not appear to be a problem exclusive to the database service. Perhaps you could provide additional information on the specific setups that cause the issue so that we could address the compose issue instead? In the meantime, do you think this same fix could be achieved by using network aliases instead of outright changing the default name of all database services? That way the fix would keep working while preventing potential disruptions to user scripts depending on the name of the database service. |
For me, these changes break databases... :( |
For the record, this change doesn't break any database. If you do The problem we faced was real, and reproduced already in 2 servers, having The options you have (apart from forking or freeze the copier updates, which I think are not adequate) are:
|
If I'm the only one with these problems... it must be because of how we update... What happened to me is that I got a PANIC: could not locate a valid checkpoint record. |
This is something only at docker compose level and how the DB service is called, so the checkpoint you are talking about should be another thing, and more if you didn't even update the scaffolding. |
I have to investigate more what has happened to us... :/ If I find anything that I think may be relevant to here I will comment :) |
CC @Tecnativa TT54598
When multiple Odoo projects are deployed within the same Docker network, there is a risk that an instance of Odoo may inadvertently connect to the database of another project due to identical service names. This PR addresses the issue by ensuring unique service names, preventing unintended cross-project database connections and ensuring proper project isolation.