Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 15:33
    ksonda commented #615
  • 04:14
    ksonda commented #173
  • 04:08
    ksonda commented #173
  • 04:07
    ksonda commented #173
  • 04:03
    ksonda commented #173
  • 02:28
    dblodgett-usgs commented #173
  • 01:34
    l0b0 labeled #686
  • 01:34
    l0b0 opened #686
  • May 06 18:30
    ksonda commented #173
  • May 06 18:16
    ksonda commented #173
  • May 06 18:15
    ksonda commented #173
  • May 06 18:12
    ksonda commented #173
  • May 06 14:14
    jkreft-usgs commented #685
  • May 06 14:05
    ksonda commented #685
  • May 06 14:04
    ksonda commented #685
  • May 06 14:03
    ksonda commented #685
  • May 06 12:29
    jkreft-usgs commented #685
  • May 05 13:27
    ksonda commented #685
  • May 05 13:26
    ksonda commented #685
  • May 05 13:25
    ksonda commented #685
Sander Schaminee
@GeoSander
@tomkralidis I have updated PR #664 once again according to your suggestions earlier. I really hope someone else can have a look too...
I put some code examples in the docstring of the APIRequest class as well.
Tom Kralidis
@tomkralidis
thanks Sander. I think Francesco will review soon.
Sander Schaminee
@GeoSander
:+1: :grinning:
Chris Barrett
@christophersbarrett
Hi all, I'm having trouble with relative paths - for example I am deploying pygeoapi as a docker container to a Fargate cluster on AWS ECS. The cluster is access through ALB (load balancer) which also assigns a domain to the ip address. I'd like pygeoapi to be accessible from the path <domain>/pygeoapi. I have that working, but none of the links work in the UI. So the link is constructed as <domain>/pygeoapi/collections, but it 404s
So in short, pygeoapi image is accessible at the path we want - but none of the links work. So app routing isn't working it seems like. Server config in local config:
server:
bind:
host: 0.0.0.0
port: 80
url: /pygeoapi
mimetype: application/json; charset=UTF-8
encoding: utf-8
language: en-US
cors: true
Another clue: it can't find the static resources either.
Just van den Broecke
@justb4
@christophersbarrett are you following config conventions as described here?
Chris Barrett
@christophersbarrett
I have SCRIPT_NAME hard coded in entrypoint.sh:
SCRIPT_NAME="/pygeoapi"
But I don't see where it's actually consuming? It's not passed into gunicorn's start?
Just van den Broecke
@justb4
Mm, SCRIPT_NAME is usually set in the Docker environment like docker-compose. It is something Flask-specific, not gunicorn. It needs to be in the global env. Two hints you may try:
export SCRIPT_NAME="/pygeoapi" and local config url: /pygeoapi IMO must be external/full URL.
Chris Barrett
@christophersbarrett
I just added SCRIPT_NAME="/pygeoapi" to the docker file as an ENV, not sure if that is the right approach.
Oh, so the url config should have domain/pygeoapi?
Just van den Broecke
@justb4
yes, that is what we use in most deployments like the demo server: url: https://demo.pygeoapi.io/master plus ```
environment:
  • SCRIPT_NAME=/master
    ```
    in docker-compose.yml.
Chris Barrett
@christophersbarrett
okay, i'll give that a try as well :) It's interesting that the urls in the templates are being constructed properly, but the app isn't routing correctly
Chris Barrett
@christophersbarrett
@justb4 made changes: put whole url in server config in config yml file, added SCRIPT_NAME env var in docker file - neither made any difference unfortunately
can you think of anything else that might contribute to it failing to route? How is SCRIPT_NAME actually used as an env variable? I see it used in severless wsgi - but that file isn't used afaict when you are running in a docker container?
Chris Barrett
@christophersbarrett
2021-04-09 14:32:49[2021-04-09 20:32:49 +0100] [20] [ERROR] Error handling request /
2021-04-09 14:32:49Traceback (most recent call last):
2021-04-09 14:32:49File "/usr/lib/python3/dist-packages/gunicorn/workers/base_async.py", line 55, in handle
2021-04-09 14:32:49self.handle_request(listener_name, req, client, addr)
2021-04-09 14:32:49File "/usr/lib/python3/dist-packages/gunicorn/workers/ggevent.py", line 143, in handle_request
2021-04-09 14:32:49super().handle_request(listener_name, req, sock, addr)
2021-04-09 14:32:49File "/usr/lib/python3/dist-packages/gunicorn/workers/base_async.py", line 94, in handle_request
2021-04-09 14:32:49resp, environ = wsgi.create(req, sock, addr,
2021-04-09 14:32:49File "/usr/lib/python3/dist-packages/gunicorn/http/wsgi.py", line 183, in create
2021-04-09 14:32:49path_info = path_info.split(script_name, 1)[1]
2021-04-09 14:32:49IndexError: list index out of range
Chris Barrett
@christophersbarrett
So I put SCRIPT_NAME='/pygeoapi' into CDK's container start up environment variables, and it does appear to be taking effect inside of the startup logs. However, I still get this error ^ as well as the routing still isn't working for anything other than the root page
Another thing to note, if I build this image and run it locally - it does work fine. Which is very annoying.
localhost:5000/pygeoapi/collections, etc
If thats transferable to your setup
Just van den Broecke
@justb4
@christophersbarrett : @KoalaGeo shows the same conventions (url + SCRIPT_NAME) as I mentioned above when using a domain plus subpath. Providing GitHub or other code paths helps us to understand your deployment-context. My AWS knowledge is minimal.
Tom Kralidis
@tomkralidis
@kalxas @francbartoli @justb4 @jorgejesus @pvgenuchten I’d like to have a PSC Gitter meeting. Is anyone around this Friday at 11h or 12h UTC?
Just van den Broecke
@justb4
@kalxas @francbartoli @justb4 @jorgejesus @pvgenuchten friday ok with me 11 or 12 UTC.
Angelos Tzotsos
@kalxas
ok for me
Tom Kralidis
@tomkralidis
@pvgenuchten @francbartoli ?
I spefically want to address the multilingual and CQL PRs
Francesco Bartoli
@francbartoli
Sorry folks, it’s hard for me this week. What about Monday 19th at the same time?
Tom Kralidis
@tomkralidis
how about Monday 19 April at 11h or 12h UTC?
Francesco Bartoli
@francbartoli
It works for me @tomkralidis
Sander Schaminee
@GeoSander
Looking at @pvgenuchten 's calendar (if it's up to date), I think that 11h UTC works best next Monday. He has another meeting at 12 UTC. I could also join silently and perhaps answer some questions about the multilingual PR, if needed.
Tom Kralidis
@tomkralidis
thanks Sander. I will let @pvgenuchten confirm and then setup the agenda/call the meeting on the mailing list.
paul van genuchten
@pvgenuchten
both fine for me
Just van den Broecke
@justb4
Sorry folks monday 19 11h or 12h does not work for me, but go ahead.
Tom Kralidis
@tomkralidis
samtc
@freenode_samtc:matrix.org
[m]
hi!
samtc
@freenode_samtc:matrix.org
[m]
it's possible to use pygeoapi with the yml config? only as a flask blueprint?
Tom Kralidis
@tomkralidis
samtc: you can use pygeoapi standalone or as part of a flask blueprint, yes
samtc
@freenode_samtc:matrix.org
[m]
@tomkralidis: pygeoapi seems to hijack lots of flask config
Tom Kralidis
@tomkralidis
samtc: not following, but interested to hear your feedback
Tom Kralidis
@tomkralidis
Note Flask 2 will support async/await
Francesco Bartoli
@francbartoli
That’s great @tomkralidis! I guess we should be looking for a way to support both modes (sync/async) in core at that point since they would be common to flask and starlette
Tom Kralidis
@tomkralidis
good point. @francbartoli . At which levels would this apply to? For example if the core is async but providers are not?
Francesco Bartoli
@francbartoli
Eh good question, it’s likely we should take two levels: the in/out from the web http to the core api and then the in/out from core api to providers
Or having two different implementations for sync/async of core api and providers (where possible)
Sander Schaminee
@GeoSander

At which levels would this apply to? For example if the core is async but providers are not?

Just throwing in my 2 cents here... Since provider instances don't stay alive and aren't reused after the response has been sent, I don't see a lot of issues there actually. Each routed API method instantiates a provider (which is garbage collected once the response has been returned), so all provider functionality can stay synchronous, I think. However, the API method handling the request should be async of course and awaited by the Flask/Starlette app endpoint that called it.