Py-qgis-server is a asynchronous HTTP Qgis server written in python on top of the tornado framework and the 0MQ messaging framework for distributing requests workers.
It is based on the new Qgis 3 server API for efficiently passing requests/responses using 0MQ messaging framework to workers.
The server may be run as a self-contained single service or as a proxy server with an arbitrary number of workers running remotely or locally. Independent workers connect automatically to the front-end proxy with no need of special configuration on the proxy side. Thus, this is ideal for auto-scaling configuration for use with container orchestrator as Rancher, Swarm or Kubernetes.
The server is aimed at solving some real situations encountered in production environment: zero conf scalability, handle long-running request situation, auto restart…
- Multiples workers
- Fair queuing request dispatching
- Timeout for long running/stalled requests
- Full support of qgis server plugins
- Auto-restart trigger for workers
- Support streamed/chunked responses
- SSL support
- OS: Unix/Posix variants (Linux or OSX) (Windows not officially supported)
- Python >= 3.5
- QGIS >= 3.10 installed
- libzmq >= 4.0.1 and pyzmq >= 17
Install from source¶
Install from pypi.org:
pip install py-qgis-server
Install from sources:
pip install -e .
Install from build version X.Y.Z:
make dist pip install py-qgis-server-X.Y.Z.tar.gz
Running the server¶
The server does not run as a daemon by itself, there is several way to run a command as a daemon.
- Use Supervisor. Will gives you full control over logs and server status notifications.
- Use the
- Use systemd
Use the configuration file located at
Run only as proxy.
Running proxy and workers separately¶
--proxy option is set the server will act as a proxy server to talk to independent qgis workers.
QGIS workers can be run using the command:
The options are the same as
Running with Docker¶
Docker image is available on docker-hub.
All options are passed with environment variables. See the Configuration settings for a description of the options.
Install server plugins with the Docker container¶
The docker image is shipped with the qgis-plugin-manager <https://www.3liz.com/news/qgis-plugin-manager.html>.
To install or manage your server plugins, use the docker exec command into your container, the plugins will install in the folder defined by the SERVER_PLUGINPATH option.
docker exec myserver -it qgis-plugin-manager install "Lizmap server"