You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/docker.rst
+22-26Lines changed: 22 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,9 @@
1
-
.. _running-with-docker:
1
+
.. _docker:
2
2
3
3
Docker
4
4
======
5
5
6
-
pygeoapi provides an official `Docker`_ image which is made available on both the `geopython Docker Hub`_ and our `GitHub Container Registry`_. Additional
7
-
Docker examples can be found in the `pygeoapi GitHub repository`_, each with sample configurations, test data,
8
-
deployment scenarios and provider backends.
6
+
pygeoapi provides an official Docker image which is made available on the `geopython Docker Hub`_ as well as the `GitHub Container Registry`_. Additional Docker examples can be found in the `pygeoapi-examples GitHub repository`_, each with sample configurations, test data, deployment scenarios and provider backends.
9
7
10
8
The `pygeoapi demo server`_ runs various services from Docker images which also serve as `useful examples`_.
11
9
@@ -15,7 +13,7 @@ The `pygeoapi demo server`_ runs various services from Docker images which also
15
13
The basics
16
14
----------
17
15
18
-
The official pygeoapi Docker image will start a pygeoapi Docker container using `Gunicorn <https://docs.gunicorn.org/en/latest/>`_ on internal port 80.
16
+
The official pygeoapi Docker image will start a pygeoapi Docker container using `Gunicorn <https://gunicorn.org>`_ on internal port 80.
19
17
20
18
Either ``IMAGE`` can be called with the ``docker`` command, ``geopython/pygeoapi`` from DockerHub or ``ghcr.io/geopython/pygeoapi`` from the GitHub Container Registry. Examples below use ``geopython/pygeoapi``.
21
19
@@ -80,19 +78,23 @@ A corresponding example can be found in https://github.com/geopython/demo.pygeoa
80
78
Environment Variables for Configuration
81
79
---------------------------------------
82
80
83
-
In addition to **`PYGEOAPI_CONFIG`** and **`PYGEOAPI_OPENAPI`**, the base Docker image supports additional environment variables for configuring the `pygeoapi` server behavior:
81
+
In addition to ``PYGEOAPI_CONFIG`` and ``PYGEOAPI_OPENAPI``, the base Docker image supports additional environment variables for configuring server behavior:
84
82
85
-
1. **`PYGEOAPI_SERVER_URL`**:
86
-
This variable sets the `pygeoapi` server URL in the configuration. It is useful for dynamically configuring the server URL during container deployment. For example:
83
+
* ``PYGEOAPI_SERVER_URL``: sets the `pygeoapi` server URL in the configuration. It is useful for dynamically configuring the server URL during container deployment
87
84
88
85
.. code-block:: bash
89
86
90
87
docker run -p 2018:80 -e PYGEOAPI_SERVER_URL='http://localhost:2018' -it geopython/pygeoapi
91
88
92
89
This ensures the service URLs in the configuration file are automatically updated to reflect the specified URL.
93
90
94
-
2. **`PYGEOAPI_SERVER_ADMIN`**:
95
-
This boolean environment variable enables or disables the `pygeoapi` Admin API. By default, the Admin API is disabled. To enable it:
91
+
* ``PYGEOAPI_OPENAPI_GENERATE_FAIL_ON_INVALID_COLLECTION``: enables or disables generation of the OpenAPI document if one or more collections are invalid (default is ``true``)
92
+
93
+
.. code-block:: bash
94
+
95
+
docker run -p 5000:80 -e PYGEOAPI_OPENAPI_GENERATE_FAIL_ON_INVALID_COLLECTION=false -it geopython/pygeoapi
96
+
97
+
* ``PYGEOAPI_SERVER_ADMIN``: enables or disables the `pygeoapi` Admin API (default is ``false``)
96
98
97
99
.. code-block:: bash
98
100
@@ -102,44 +104,40 @@ In addition to **`PYGEOAPI_CONFIG`** and **`PYGEOAPI_OPENAPI`**, the base Docker
102
104
103
105
To learn more about the Admin API see :ref:`admin-api`.
104
106
105
-
3. **`CONTAINER_HOST`**:
106
-
This variable sets the listening address for incoming connections. Normally the server is listening on ``localhost`` (the default), but other values are also possible.
107
+
* ``CONTAINER_HOST``: sets the listening address for incoming connections (default is ``localhost``)
107
108
108
109
.. code-block:: bash
109
110
110
111
docker run -p 5000:80 -e CONTAINER_HOST=192.168.0.7 -it geopython/pygeoapi
111
112
112
-
4. **`CONTAINER_PORT`**:
113
-
This variable sets the listening port for incoming connections. The default port is ``80``; in this example, we change it to ``5001``.
113
+
* ``CONTAINER_PORT``: sets the listening port for incoming connections (default is ``80``)
114
114
115
115
.. code-block:: bash
116
116
117
117
docker run -p 5000:5001 -e CONTAINER_PORT=5001 -it geopython/pygeoapi
118
118
119
-
5. **`WSGI_WORKERS`**:
120
-
121
-
This variable sets the number of workers used by the Gunicorn server, the default being ``4``.
122
-
For performance reasons, `it is not recommended to use a high number of workers <https://docs.gunicorn.org/en/latest/design.html#how-many-workers>`_ .
119
+
* ``WSGI_WORKERS``: sets the number of workers used by the Gunicorn server (default is ``4``)
123
120
124
121
.. code-block:: bash
125
122
126
123
docker run -p 5000:80 -e WSGI_WORKERS=10 -it geopython/pygeoapi
127
124
128
-
6. **`WSGI_WORKER_TIMEOUT`**:
125
+
.. note::
126
+
For performance reasons, `it is not recommended to use a high number of workers <https://docs.gunicorn.org/en/latest/design.html#how-many-workers>`_
129
127
130
-
Gunicorn workers silent for more than the seconds set by this variable are killed and restarted. The default value is ``6000``.
128
+
* ``WSGI_WORKER_TIMEOUT``: sets the number of seconds before silent Gunicorn workers are killed and restarted (default is ``6000``)
131
129
132
130
.. code-block:: bash
133
131
134
132
docker run -p 5000:80 -e WSGI_WORKERS=10 -it geopython/pygeoapi
135
133
136
-
You can read more about this and other Gunicorn settings in the `official documentation <https://docs.gunicorn.org/en/stable/>`_
134
+
.. note::
135
+
More information on Gunicorn settings can be found in the `official Gunicorn documentation <https://docs.gunicorn.org>`_
137
136
138
137
Deploying on a sub-path
139
138
-----------------------
140
139
141
-
By default the ``pygeoapi`` Docker image will run from the ``root`` path (``/``). If you need to run from a
142
-
sub-path and have all internal URLs properly configured, you can set the ``SCRIPT_NAME`` environment variable.
140
+
By default the ``pygeoapi`` Docker image will run from the ``root`` path (``/``). If you need to run from a sub-path and have all internal URLs properly configured, you can set the ``SCRIPT_NAME`` environment variable.
143
141
144
142
For example to run with ``my.config.yml`` on ``http://localhost:5000/mypygeoapi``:
145
143
@@ -176,11 +174,9 @@ Docker is an easy and reproducible approach to deploying systems.
176
174
Additional approaches are welcome and encouraged; see :ref:`contributing` for more information on
177
175
how to contribute to and improve the documentation
0 commit comments