[qgis-qwc2] QWC-services without Docker?

Thomas Schüttenberg thomas at qgis.de
Thu Jan 28 00:41:25 PST 2021


Hi Sando,
thank you very much for your really valuable advice!

In the meantime I was able to install mod_wsgi in the Python of my existing OSGeo4W stack (used for QGIS server) using pip. (Very helpful was e.g. [1,2], even if I could only work around the PyPI TLS problem and not solve it [3,4]). 
The 'Hello World' example of the Quick Configuration Guide of the mod_wsgi documentation[5] works however. - By the way, these docs are absolutely fantastic, Kudos to Graham Dumpleton!

What is still missing are the Python virtual environments. AFAIU these are linked copies of my Python installation, which are necessary for the separate execution of various WSGI applications (see [5/virtual-environments]).
On the one hand, I'm still not clear where best to create these venv and on the other hand, the creation still aborts with an error (Error: Command '['D:\\gdi\\htdocs\\webgis\venv1\\Scripts\\python3.exe', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 3221226505.), which I need to fix.

However, I think I am beginning to understand the procedure of your script example. Since I am on Windows, the WSGIDaemonProcess is not available to me. Consequently, I will have to run multiple WSGI applications (qwc-services) in "embedded mode" [5/virtual-environments.html#embedded-mode-multiple-applications], if that is possible in the end.

What still confuses me is whether the qwc-services can/should be built into my existing qwc-demo-app, or whether a new QWC is/would have to be created this way?
For a start, could I include a simple (i.e. without further dependencies) qwc-service and which one would that be? (permalink-service?) 
And would I always need qwc-services-core (which does not appear in your script) and/or qwc-map-viewer for this?

Sorry for asking the potentially obvious.
All the best
Thomas

[1] https://github.com/GrahamDumpleton/mod_wsgi/blob/develop/README.rst
[2] https://stackoverflow.com/questions/59801387/how-to-install-mod-wsgi-into-apache-on-windows
[3] https://pypi.org/help/#tls-deprecation
[4] https://stackoverflow.com/questions/25981703/pip-install-fails-with-connection-error-ssl-certificate-verify-failed-certi
[5] https://modwsgi.readthedocs.io/en/develop/user-guides.html


> Sandro Mani <manisandro at gmail.com> hat am 21.01.2021 13:28 geschrieben:
> 
> 
> Hi Thomas
> You can run the services also through other means, for instance Apache + WSGI with a Python virtualenv. There is currently no generic example published, but essentially you can clone all services you want to use to some root directory and write something like
> 
> ----
> 
> # Root directory
> Define root_dir /var/www/qwc-services
> 
> # WSGI setup
> WSGIDaemonProcess qwc2 user=www-data group=www-data processes=2 threads=5 python-home=/var/www/venv-qwc2
> WSGIProcessGroup qwc2
> WSGIPassAuthorization on
> 
> <Directory ${root_dir}>
>     Require all granted
> </Directory>
> 
> # Application environment
> SetEnv JWT_SECRET_KEY MY_SECRET_KEY
> SetEnv CONFIG_PATH ${root_dir}/config
> 
> WSGIScriptAlias /qwc/admin                              ${root_dir}/qwc-admin-gui/server.wsgi
> WSGIScriptAlias /qwc/ows                                ${root_dir}/qwc-ogc-service/server.wsgi
> WSGIScriptAlias /qwc                                    ${root_dir}/qwc-map-viewer/server.wsgi
> # etc...
> 
> WSGIScriptAlias /intern/config_generator                ${root_dir}/qwc-config-generator/server.wsgi
> SetEnv INPUT_CONFIG_PATH ${root_dir}/config-in/
> SetEnv OUTPUT_CONFIG_PATH ${root_dir}/config/
> 
> <Location /intern>
>     Require ip 127.0.0.1 ::1
> </Location>
> 
> 
> ----
> You need to make sure the services play together, look at the docker-compose.yml / sample tenantConfig.json as a starting point.
> The demo app is just a sample application built on top of the QWC2 components. The qwc-map-viewer is the service serving a production build of a QWC2 application. See the qwc-map-viewer README for more details.
> Best
>  Sandro
>


More information about the qgis-qwc2 mailing list