Skip to content

Conversation

@doublebyte1
Copy link
Contributor

@doublebyte1 doublebyte1 commented Jun 25, 2025

Overview

There are quite a few environmental variables about server behaviour that can be injected into the docker image:

# gunicorn env settings with defaults
SCRIPT_NAME=${SCRIPT_NAME:=/}
CONTAINER_NAME=${CONTAINER_NAME:=pygeoapi}
CONTAINER_HOST=${CONTAINER_HOST:=0.0.0.0}
CONTAINER_PORT=${CONTAINER_PORT:=80}
WSGI_APP=${WSGI_APP:=pygeoapi.flask_app:APP}
WSGI_WORKERS=${WSGI_WORKERS:=4}
WSGI_WORKER_TIMEOUT=${WSGI_WORKER_TIMEOUT:=6000}
WSGI_WORKER_CLASS=${WSGI_WORKER_CLASS:=gevent}

This PR adds information about them in the documentation.

Additional information

The server port in particular is quite important to document; as it currently stands, the server is ignoring whatever is set in pygeoapi config, and overriding it with port 80.

Dependency policy (RFC2)

  • I have ensured that this PR meets RFC2 requirements

Updates to public demo

Contributions and licensing

(as per https://github.com/geopython/pygeoapi/blob/master/CONTRIBUTING.md#contributions-and-licensing)

  • I'd like to contribute [feature X|bugfix Y|docs|something else] to pygeoapi. I confirm that my contributions to pygeoapi will be compatible with the pygeoapi license guidelines at the time of contribution
  • I have already previously agreed to the pygeoapi Contributions and Licensing Guidelines

@doublebyte1 doublebyte1 added the documentation Documentation label Jun 25, 2025
docker run -p 5000:80 -e CONTAINER_HOST=192.168.0.7 -it geopython/pygeoapi
4. **`CONTAINER_PORT`**:
This variable sets the listening port for incoming connections. The default port is `80`; in this example, we change it to 5001.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fence 5001 in backticks (5001 -> 5001)

6. **`WSGI_WORKER_TIMEOUT`**:

Gunicorn workers silent for more than the seconds set by this variable are killed and restarted. The default value is 6000.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6000 -> 6000.

To learn more about the Admin API see :ref:`admin-api`.

3. **`CONTAINER_HOST`**:
This variable sets the listening address for incoming connections. Normally the server is listening on localhost (the default), but other values are also possible.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

localhost -> localhost

@webb-ben
Copy link
Member

webb-ben commented Jun 25, 2025

Is the understanding that variables not documented, but used in the entrypoint are adequately documented here? The two env variables I most commonly override here are WSGI_APP and WSGI_WORKER_CLASS to deploy with starlette / uvicorn, but at that point they are no longer WSGI

@doublebyte1
Copy link
Contributor Author

doublebyte1 commented Jun 26, 2025

Is the understanding that variables not documented, but used in the entrypoint are adequately documented here? The two env variables I most commonly override here are WSGI_APP and WSGI_WORKER_CLASS to deploy with starlette / uvicorn, but at that point they are no longer WSGI

To assume that the users will figure out these variables exist without even pointing to the documentation of Gunicorn, seems a bit far fetched; but maybe that is just me... (:

@tomkralidis tomkralidis added this to the 0.21.0 milestone Jun 26, 2025
@tomkralidis tomkralidis merged commit 31c28bb into geopython:master Jun 26, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants