Skip to content
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

Admin server returns HTTP 503 in 12.x #3128

Closed
mkleczek opened this issue Dec 19, 2023 · 17 comments
Closed

Admin server returns HTTP 503 in 12.x #3128

mkleczek opened this issue Dec 19, 2023 · 17 comments
Assignees
Labels

Comments

@mkleczek
Copy link
Contributor

mkleczek commented Dec 19, 2023

Environment

  • PostgreSQL version: 14
  • PostgREST version: 12.0.0 and 12.0.1
  • Operating system: Windows

Description of issue

Command to start postgrest:

PGRST_ADMIN_SERVER_PORT=3001 PGUSER=postgres PGPASSWORD=[password] postgrest.exe

Version 11.2.2 starts and returns HTTP OK from http://localhost:3001/ready and http://localhost:3001/live

Version 12.0.x starts but returns HTTP 503 from both above URLs

@steve-chavez
Copy link
Member

This is likely related to #3034

cc @develop7

@develop7 develop7 self-assigned this Dec 19, 2023
@develop7
Copy link
Collaborator

Yup, will look into tomorrow

@develop7
Copy link
Collaborator

PGRST_ADMIN_SERVER_PORT=3001 PGUSER=postgres PGPASSWORD=[password] postgrest.exe

@mkleczek I don't think CMD or PowerShell support such syntax, what shell are you using? If mingw/cygwin and/or WSL are involved, I'd like to know that too. In fact, now that postgrest installed from scoop doesn't run for me (which is another issue to file), I'd like to know even more details about your Windows & postgrest setup to reproduce the issue.

Thank you in advance.

@mkleczek
Copy link
Contributor Author

Ahh, right. I run it from Git bash shell. I guess it is mingw then?

@develop7
Copy link
Collaborator

I guess it is. What release did you use?

@mkleczek
Copy link
Contributor Author

mkleczek commented Dec 26, 2023

2.43.0 (I suppose you mean Git release: https://github.com/git-for-windows/git/releases/download/v2.43.0.windows.1/Git-2.43.0-64-bit.exe

If you mean Postgrest release then it's provided here: both 12.0.0 and 12.0.1 downloaded and extracted from Github releases: https://github.com/PostgREST/postgrest/releases/download/v12.0.1/postgrest-v12.0.1-windows-x64.zip

@develop7
Copy link
Collaborator

develop7 commented Jan 9, 2024

Thank you for your patience. Could you do post the output of postgrest.exe --dump-config here as well (masking sensitive data, of course)?

@mkleczek
Copy link
Contributor Author

Will try to provide it but there is no configuration except the environment variables provided in the description.

@develop7
Copy link
Collaborator

there is no configuration except the environment variables provided in the description.

Yes, and default configuration too, which I am after.

@steve-chavez steve-chavez added needs-repro pending reproduction and removed bug labels Jan 14, 2024
@develop7
Copy link
Collaborator

Could you do post the output of postgrest.exe --dump-config here as well

I've managed to get it, here:

postgrest.exe --dump-config
db-aggregates-enabled = false
db-anon-role = ""
db-channel = "pgrst"
db-channel-enabled = true
db-extra-search-path = "public"
db-max-rows = ""
db-plan-enabled = false
db-pool = 10
db-pool-acquisition-timeout = 10
db-pool-max-lifetime = 1800
db-pool-max-idletime = 30
db-pool-automatic-recovery = true
db-pre-request = ""
db-prepared-statements = true
db-root-spec = ""
db-schemas = "public"
db-config = true
db-pre-config = ""
db-tx-end = "commit"
db-uri = "postgresql://"
jwt-aud = ""
jwt-role-claim-key = ".\"role\""
jwt-secret = ""
jwt-secret-is-base64 = false
jwt-cache-max-lifetime = 0
log-level = "error"
openapi-mode = "follow-privileges"
openapi-security-active = false
openapi-server-proxy-uri = ""
server-cors-allowed-origins = ""
server-host = "!4"
server-port = 3000
server-trace-header = ""
server-timing-enabled = false
server-unix-socket = ""
server-unix-socket-mode = "660"
admin-server-port = ""

@wolfgangwalther
Copy link
Member

I've managed to get it, here:

So the admin server is not enabled. Probably because the env var is not set correctly.

@develop7
Copy link
Collaborator

@wolfgangwalther right, just got it enabled; thanks for the heads-up.

and voilà:

PS C:\Program Files\PostgreSQL\16> curl -v "http://localhost:3001/ready"
*   Trying [::1]:3001...
*   Trying 127.0.0.1:3001...
* Connected to localhost (127.0.0.1) port 3001
> GET /ready HTTP/1.1
> Host: localhost:3001
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/1.1 503 Service Unavailable
< Transfer-Encoding: chunked
< Date: Mon, 19 Feb 2024 17:24:56 GMT
< Server: postgrest/12.0.2 (a4e00ff)
<
* Connection #0 to host localhost left intact
PS C:\Program Files\PostgreSQL\16> curl -v "http://localhost:3001/live"
*   Trying [::1]:3001...
*   Trying 127.0.0.1:3001...
* Connected to localhost (127.0.0.1) port 3001
> GET /live HTTP/1.1
> Host: localhost:3001
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/1.1 503 Service Unavailable
< Transfer-Encoding: chunked
< Date: Mon, 19 Feb 2024 17:25:13 GMT
< Server: postgrest/12.0.2 (a4e00ff)
<
* Connection #0 to host localhost left intact
* ```

@develop7 develop7 added bug and removed needs-repro pending reproduction labels Feb 19, 2024
@develop7
Copy link
Collaborator

@mkleczek consider setting server-host to explicit IP/hostname instead of the default !4, this seems to work the issue around:

PS > $env:PGRST_SERVER_HOST = '127.0.0.1'; postgrest.exe

and

PS C:\Program Files\PostgreSQL\16> curl -v "http://localhost:3001/ready"
*   Trying [::1]:3001...
*   Trying 127.0.0.1:3001...
* Connected to localhost (127.0.0.1) port 3001
> GET /ready HTTP/1.1
> Host: localhost:3001
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Transfer-Encoding: chunked
< Date: Mon, 19 Feb 2024 17:35:06 GMT
< Server: postgrest/12.0.2 (a4e00ff)
<
* Connection #0 to host localhost left intact
PS C:\Program Files\PostgreSQL\16> curl -v "http://localhost:3001/live"
*   Trying [::1]:3001...
*   Trying 127.0.0.1:3001...
* Connected to localhost (127.0.0.1) port 3001
> GET /live HTTP/1.1
> Host: localhost:3001
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Transfer-Encoding: chunked
< Date: Mon, 19 Feb 2024 17:35:12 GMT
< Server: postgrest/12.0.2 (a4e00ff)
<
* Connection #0 to host localhost left intact

@wolfgangwalther
Copy link
Member

@mkleczek consider setting server-host to explicit IP/hostname instead of the default !4, this seems to work the issue around:

Aha! That means, this is related to #3202 and #3203.

@wolfgangwalther
Copy link
Member

Or rather a duplicate of #3204

@develop7
Copy link
Collaborator

Duplicate of #3204 it is

@develop7 develop7 closed this as not planned Won't fix, can't repro, duplicate, stale Feb 20, 2024
@mkleczek
Copy link
Contributor Author

Sorry for long silence (been away) and thanks for info - will verify ASAP

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

No branches or pull requests

4 participants