mysticmind-postgresembed icon indicating copy to clipboard operation
mysticmind-postgresembed copied to clipboard

Figure out a way to get minimal Postgres binaries for *nix

Open mysticmind opened this issue 4 years ago • 10 comments

Currently, we are using minimum Postgres binaries available for Windows as NuGet package. To truly make this a cross-platform library, need to figure out a way to get minimal Postgres binaries for *nix including extensions.

mysticmind avatar Aug 09 '19 03:08 mysticmind

In the Java world this is solved e.g. by https://github.com/opentable/otj-pg-embedded and https://github.com/yandex-qatools/postgresql-embedded whereas the opentable implementation is superior.

AndreasKl avatar Dec 04 '19 22:12 AndreasKl

Thanks @AndreasKl I have had a look at these projects when I was starting on the implementation but had focused on using https://www.nuget.org/packages/PostgreSql.Binaries.Lite/ which only supported Windows. I will have a re-look at the opentable implementation on how the *nix PG binary files are used.

mysticmind avatar Dec 05 '19 16:12 mysticmind

So at this point this package only works on windows right?

jefemarques avatar Jul 11 '21 13:07 jefemarques

So at this point this package only works on windows right?

Yep!

mysticmind avatar Jul 11 '21 14:07 mysticmind

It looks like PostgreSql.Binaries.Lite has support for linux64 now. Any chance this library can be updated to work with linux?

atrauzzi avatar Dec 31 '21 16:12 atrauzzi

I have some plans to deal with this, will keep you posted. Note that the binaries lite is also not kept upto date.

mysticmind avatar Jan 04 '22 01:01 mysticmind

Cross referencing two tickets: https://github.com/npgsql/npgsql/issues/4266#issuecomment-1006114247

https://github.com/aivascu/EntityFrameworkCore.AutoFixture/issues/101

atrauzzi avatar Jan 06 '22 00:01 atrauzzi

To people subscribed to this thread: I've been working over the last bit to create an up-to-date embedded postgres package similar to this one that will also include Linux support: https://github.com/atrauzzi/protoculture-dotnet-postgres

@mysticmind -- I've taken a little bit of a different approach to what you've done here, but I would still love any input or tales from the trenches you might have in creating this library.

I'm working to get through a few Windows-specific snags but once that's done, it'll be an embedded postgres that will work on linux, Windows and with the door open to add macOS support later down the line. ARM and AMD64 alike.

atrauzzi avatar Jan 30 '22 22:01 atrauzzi

@atrauzzi I had a look at what you have implemented, the embedding approach look okay since you don't need to download the files on demand. But it only supports running on 14.1.

With regards to my library, the following were few goals to support (all of these are supported in the current version):

  • Allow to run multiple Postgres versions like 10.x, 11.x, 12.x etc
  • Allow adding the required extensions while running on a specific Postgres version.

Note that for the case of running unit tests, users definitely want to use different Postgres versions and running a bunch of extensions as well according to their requirement. So just running on the highest version like 14.x many not be sufficient. If you look at cloud providers, managed Postgres also includes a bunch of popular extensions as well, this is a definite requirement as I see it.

I am still planning to enhance my library to support Linux and also handle the goals outlined above. I have been busy with my day job and also was down sick for several weeks now so couldn't spend much time on this.

All said, thanks for reaching out and being open. I am happy that you have an implementation functional on Linux using the embedded approach bundling the files which is a good thing and will be useful for end users 👍

mysticmind avatar Jan 31 '22 08:01 mysticmind

Thank you!

I have some ideas around supporting extensions by layering dependent package outputs. I might bundle in very common ones like postgis though.

Regarding postgres version, are you aware of any really glaring backwards incompatibility scenarios? I definitely should make myself aware, but I figure the package version itself would end up abstracting the postgres version.

atrauzzi avatar Jan 31 '22 14:01 atrauzzi

are there any updates on *nix support?

murlakatam avatar Feb 20 '23 03:02 murlakatam

@murlakatam I had not been able to spend time and bandwidth on this, will see if I can spend time to get this going in March.

mysticmind avatar Feb 22 '23 16:02 mysticmind

I spent some time today and figured out a very elegant and easy solution to solve this. Keep an eye on this, I should be able to close this by next week.

@murlakatam FYI.

mysticmind avatar Feb 25 '23 15:02 mysticmind

Apparently, it took so long for me to commit time on this to get it done. It is done now. Fixed via https://github.com/mysticmind/mysticmind-postgresembed/commit/2c8fdefaa2e983196e01c6ff334eaa881839a779. There will be a 3.x published soon after a bit of tests. Now the lib supports running embedded postgres server on Windows, OSX (including Silicon) and Linux. It is major version bump since there are few breaking changes.

mysticmind avatar Aug 12 '23 16:08 mysticmind

v3.0.0 is available in NuGet.

mysticmind avatar Aug 12 '23 17:08 mysticmind