Postgrest: Chocolatey or scoop package for PostgREST

Created on 3 Feb 2020  路  17Comments  路  Source: PostgREST/postgrest

Installation on windows is still troublesome. To install PostgREST users need to do the whole PostgreSQL installation(just for getting libpq).

Creating a package for https://chocolatey.org/ or https://scoop.sh/ would ease installation. Not sure if they already have libpq available.

All 17 comments

Pandoc is already on chocolatey https://chocolatey.org/packages/pandoc. Maybe it could serve as an example of how to do this.

Hi. I just want to let you know I put together scoop manifest and there is a PR in the main scoop bucket
https://github.com/ScoopInstaller/Main/pull/1250

If you want help with documentation or guidelines let me know. Cheers

Hey @littleli, thanks!

I see the depends: postgresql part, looks like that covers the libpq dependency.

Once your scoop PR is merged, you could add the installation instructions in https://github.com/PostgREST/postgrest-docs/blob/master/install.rst

I am making this. It will be on my repo and follow releases here (as automatic package) with latency up to a day. I also maintain postgresql packages.

https://github.com/majkinetor/au-packages/issues/156

== EDIT ==

Done: https://chocolatey.org/packages/postgrest

I will add some parameters in the nearfuture, like /Service to install it as Windows service and anything else I deem useful. If you need something else let me know.

Installation on windows is still troublesome. To install PostgREST users need to do the whole PostgreSQL installation(just for getting libpq).

My postgrest-test repository shows how to automate entire process.

I didn't embed libpq inside the package for now so it requires local postgresql installation (cinst postgresql). I don't depend on postgresql as you may want to use remote database. For this to work libpq must be embedded in the package. I didn't do that now as I am not sure is is enogh to just take latest one, but I can easily change that in future package release. This can be automated by downloading latest postgresql during package update, and extracting libpq from it, or libpq can be manually added to repository. The benefit of first method is that libpq will always be automatically up to date.

Any thoughts on this ? Particularly, is it satisfactory to add libpq from the latest postgre version in the package dir ?

I also maintain postgresql packages.

@majkinetor Cool! Great to have you helping us!

I don't depend on postgresql as you may want to use remote database

If postgresql is not installed, what would happen when trying to run postgrest it after cisnt postgrest? I'm guessing it'll show a DDL error that might not be helpful.

In this case I think it'll be better to include libpq in the package. The latest stable version would be good. libpq changes slowly, I think it wouldn't demand much maintenance.

I forgot that pg_config also needs to be available in the path, check the note in: http://postgrest.org/en/v7.0.0/install.html#running.

If it gets difficult, for now you could require the full postgresql package.

In this case I think it'll be better to include libpq in the package. The latest stable version would be good. libpq changes slowly, I think it wouldn't demand much maintenance.

I forgot that pg_config also needs to be available in the path,

OK, so it needs libpq & pg_config which itself depends on several DLLs: I tried to move it to another machine along with libintl-8.dll and libiconv-2.dll but it refused to start. I also tried moving all dlls with it from bin\ folder but it still didn't run.

So if somebody provides a way how to include pg_config in portable manner, I can automate extraction from latest postgresql version and embed it in the package. If pg_config is not necessary for all functionality of postgrest, I could still embed libpq (without any maintenance required whatsoever).

For now, this stays like it is. Its not a big deal IMO to require postgresql installation even if it doesn't get used locally. Apart from ~1GB extra space on disk, installation is over within a minute via chocolatey and it also sets correct PATH so users simply:

choco install postgresql12 --params '/Password:test'
choco install postgrest --version 7.0.1

I can make it depend on postgresql (not 12, but any version) but in which case cinst postgrest would suffice, but then you would get some random password for postgresql as you didn't provide its parameter /Password. I could change the postgresql package tho to use default password which is not randomized.

NOTE: version is required for now for postgrest until package gets approved by choco admins which will happen in next few days or so.

@majkinetor Oh, I didn't know that choco install postgresql also created a pg cluster. I thought it would only install pg and put its binaries on the path. In that case, I think its fine to not require postgresql.

@littleli @majkinetor I was wondering, have you guys bumped into https://github.com/PostgREST/postgrest/issues/1373?

Maybe that error could happen for choco/scoop install postgrest since the packages use our binary from the release page,

No, but I run it on dev machine which certainly contains required DLLs. Sorry for not being able to test it in pristine VM ATM.

I have Windows 10 Home edition, x86_64 and I haven't seen this. Sorry, but I cannot really add anything more to this issue.

@steve-chavez

I checked this with Windows sandbox and it works without problems. Here is the script used:

choco install postgresql12 --params '/Password:test'
choco install postgrest

cd postgrest-test
Set-Alias ib $pwd\Invoke-Build.ps1
ib RecreateDb, Run, Todo, Todos

Screenshot: on the left, client test; on the upper right installation summary; on the bottom right postgrest server:

image

Notice the number of stuff installed in the right upper window that come from the postgresql package dependencies.

I provided more information here:

So I guess the folks that have a problem should try installing it via chocolatey.

@majkinetor Thanks a lot for testing on a sandbox. It looks good!

You could add a PR on the docs for chocolatey so users can try it.
(Example PR for scoop: https://github.com/PostgREST/postgrest-docs/pull/342)

It seems like this is pretty much solved, except for a PR to the docs. Therefore I removed the help wanted label and unpinned this issue.

@wolfgangwalther Agree. I've opened https://github.com/PostgREST/postgrest-docs/issues/369, so the doc issue can be tracked there. I'll close this one.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kishyr picture kishyr  路  3Comments

Chaz6 picture Chaz6  路  4Comments

skinkie picture skinkie  路  4Comments

rvernica picture rvernica  路  4Comments

fusionbeam picture fusionbeam  路  4Comments