OpenDRR / pygeoapi

pygeoapi is a Python server implementation of the OGC API suite of standards. The project emerged as part of the next generation OGC API efforts in 2018 and provides the capability for organizations to deploy a RESTful OGC API endpoint using OpenAPI, GeoJSON, and HTML. pygeoapi is open source and released under an MIT license.
https://pygeoapi.io
MIT License
0 stars 1 forks source link

[For Discussion] Add environment variables to set SSL certs for Gunicorn #20

Open anthonyfok opened 2 years ago

anthonyfok commented 2 years ago

This is to allow pygeoapi to serve over HTTPS.

The environment variables are:

See https://docs.gunicorn.org/en/stable/settings.html#ssl for Gunicorn's SSL-related parameters.

Sample command:

docker run -p 5000:80 \
    -e PYGEOAPI_SSL_KEYFILE=/certs/tls.key \
    -e PYGEOAPI_SSL_CERTFILE=/certs/tls.crt \
    -v /path/to/tls.crt:/certs/tls.crt:ro \
    -v /path/to/tls.key:/certs/tls.key:ro \
    -v $(pwd)/my.config.yml:/pygeoapi/local.config.yml \
    -it ghcr.io/opendrr/pygeoapi:pr-20

where url: https://localhost:5000 is set in the server section in my.config.yml

Fixes #19


Despite discovering GUNICORN_CMD_ARGS which might negate the need for this pull request, I decided to go ahead and complete it because I was almost done, and wanted to refresh myself on the procedure of updating and testing pygeoapi Docker image, and maybe to start test building Docker image for pull requests too. (New issue to be filed later.)

As to whether we actually want to merge this PR, that is up for discussion. Perhaps worth approaching upstream to see if they are interested in these explicit PYGEOAPI_SSL_* variables, and, probably more importantly, where to add a HOWTO for getting pygeoapi to serve HTTPS in the official documentation / FAQ.