-
Notifications
You must be signed in to change notification settings - Fork 654
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
Docker PGadmin only loads servers.json on first startup, not after. #8071
Comments
Having the same issues with docker dpage/pgadmin4:2024-10-19-2 on SAP BTP CLoud Foundry. |
@moelaj that sounds like you don't have persistence set up. this is.a different issue. the servers.Json file Allows pre-populating the servers a user sees on login, and is useful for ie setups deployed with infrastructure as code. The issue I'm describing here is that updating the list of servers in the servers.Json file (ie If your infrastructure as code updates what servers should be vissable ) does not update the servers actually being shared due to when loading the servers.Json file happens. |
This is the intended and documented behaviour. From: https://www.pgadmin.org/docs/pgadmin4/latest/container_deployment.html#mapped-files-and-directories
This primarily stems from the original thinking that pgAdmin containers would not be immutable as their configuration would be stored within them, and thus simply re-launching would cause the configuration database to be recreated and loaded with the latest version of the servers.json file. That is of course at odd with more recent deployments where people often map /var/lib/pgadmin to a persistent location, thus effectively making the container itself immutable (which is generally considered the correct way to deploy nowadays). I don't see any particular reason why we couldn't allow additional servers to be loaded, should someone take an interest in writing the code to do so. That is probably a touch more complicated that it might seem at first glance, because it would be necessary to avoid re-loading servers that have previously been loaded, and allow for any that users have manually loaded through the UI. |
I was unaware of that particular piece of documentation. I was referencing the import/export page, which describes the servers.Json format, and that has no mention of it loading only once. at minimum that piece of docs shoup probably be duplicated over there. I have a few ideas on tackling loading in the servers every boot. I'll take a look at them soon. |
Having dug into the code a little bit, I have a few solutions and would like some thoughts on them.
I lean towards 1 as its the quickest to implement and will be fine for I suspect 99% of cases, and basically all normal use-cases. I can't think of any reason someone would create a servers.json file and have all their servers be the same group & same name. |
Describe the bug
Loading in of the servers.json file only occurs once when using the docker file, even if changed.
To Reproduce
alternatively
Expected behavior
If the servers.json file has changed, load in the new servers, or provide some other method of forcing the servers to be loaded in on restart. (this would likely require gating behind a new env variable to be set as #7811 implies that, atleast to some, re-importing every boot is undesirable)
Desktop (please complete the following information):
Additional context
The specific root cause is that, due to the call to load in the servers here being inside an if block here (that only runs if the pgadmin.db file has not been created yet), changing/adding the server.json file after the first boot will not load in the servers as they have been updated.
I believe that this is the root cause of a number of un-reproducable bugs reported in both the pgadmin repository, and the helm chart repository.
The text was updated successfully, but these errors were encountered: