Skip to content

Allow PostgresApp to manage servers w/Homebrew binaries#795

Closed
robertjpayne wants to merge 1 commit intoPostgresApp:masterfrom
robertjpayne:feature/homebrew-binaries
Closed

Allow PostgresApp to manage servers w/Homebrew binaries#795
robertjpayne wants to merge 1 commit intoPostgresApp:masterfrom
robertjpayne:feature/homebrew-binaries

Conversation

@robertjpayne
Copy link

PostgresApp is a fantastic way to manage Postgres on macOS however only being allowed to use the built-in binaries can be limiting:

  1. Some users may have custom builds of Postgres with their own extensions or modifications
  2. No access to pgxnclient to install extra extensions
  3. The PostgresApp team having to pick and choose / maintain build scripts for which versions and tech goes into the bundled versions.

For us the magic of PostgresApp is how it manages the data directory, starting and stopping and permissions. We'd actually prefer to install postgres elsewhere for extension support.

This PR is somewhat rudimentary but scans the /opt/homebrew/Cellar folder for installed versions of Postgres and allows creating servers off of that.

Perhaps this is too "magic" and it would be best if PostgresApp allowed adding custom binary paths when creating a server instead?

@robertjpayne
Copy link
Author

This would help resolve a lot of issues people have with extensions as they could use Homebrew installed versions which can be augmented with brew install pgxnclient and pgxnclient install plv8

#779 #773 #728 #644

@robertjpayne
Copy link
Author

And this is what it looks like in action:

Screenshot 2025-01-09 at 1 50 32 AM

@jakob
Copy link
Member

jakob commented Jan 8, 2025

This looks like a useful addition, and something we have talked about in the past.

At a first glance, I wonder how Homebrew deals with version updates? Does this solution keep working after a brew update?

@robertjpayne
Copy link
Author

robertjpayne commented Jan 9, 2025

@jakob that's a good point I'm not 100% sure. Thinking about this more since I submitted the PR. It really might be easier just to allow people to add their own "Postgres" installations in Preferences and then make those available in the dropdown?

Make it less dependent on a 3rd party thing.

Could even be super simple by putting a "Custom" option in the dropdown and when selected it opens up a file browser to select the binaries directory.

@tbussmann
Copy link
Member

Please note that there has already been other attempts in that direction. One can still be found in branch find-other-binaries. I think we should first discuss and agree on a design for such a feature if we are going to support it.

@robertjpayne
Copy link
Author

@tbussmann thats fair. I understand supporting and maintaining such a feature can add overhead and turn into issues to track/triage etc…

From my perspective this is a power user feature and as such it may be easiest to add/support the ability just to specify custom "versions" in preferences and then those versions become available in the dropdown menu.

There would need to be work done incase the configuration of said path is invalid (missing binaries) or becomes invalid (deleted etc…)

@jakob
Copy link
Member

jakob commented Jan 9, 2025

We could use a combo box like this:

Bildschirmfoto 2025-01-09 um 09 48 50

The advantage for power users is that they can create servers with arbitrary binaries (eg. built from source) just by typing something into the box, and it would still allow convenient selection of bundled versions.

I'm not sure if it is too confusing for inexperienced users. What I like about the feature is that it exposes the "inner workings". Selecting a different PostgreSQL version is just changing the path where PostgreSQL is installed. The current popup hides this implementation detail.

@jakob
Copy link
Member

jakob commented Jan 9, 2025

Could even be super simple by putting a "Custom" option in the dropdown and when selected it opens up a file browser to select the binaries directory

I think this is something we could easily do which would not confuse inexperienced users.

@robertjpayne
Copy link
Author

@jakob only tricky part is the way the UI auto-generates a var path using the known numerical version. If someone put in a custom version there would need to be a deterministic way to generate the var path?

@jakob
Copy link
Member

jakob commented Jan 9, 2025

@jakob only tricky part is the way the UI auto-generates a var path using the known numerical version. If someone put in a custom version there would need to be a deterministic way to generate the var path?

We could just use var-custom and let the user pick something else. Or we could check pg_config --version to get the version number, but that's probably overkill. Users are probably going to want to customise the directory anyway.

@robertjpayne
Copy link
Author

Closing this in favor of #797 as per our discussions here around an implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants