3liz / qgis-lizmap-server-plugin

QGIS Server plugin for Lizmap
GNU General Public License v2.0
6 stars 6 forks source link

plugin installation #76

Closed emilio-sant closed 5 months ago

emilio-sant commented 6 months ago

Hi, I'm having problems installing the plugin on debian 12.5.

I installed qgis-server and nginx following the official guide. It seems to work as it shows the world map as the example. I installed the lizmap server plugin via the manager, the I added:

fastcgi_param QGIS_SERVER_LIZMAP_REVEAL_SETTINGS True;

to nginx configuration for qgis-server (/ect/nginx/sites-avaiable/qgis.conf) and restarted nginx.

Unfortunately lizmap web client says : QGIS Server returns HTTP error for Lizmap plugin: 500. the guide talks about the api: http://your.qgis.server.url/lizmap/server.json But my qgis server returns a serverException, for that url:Project file error. For OWS services: please provide a SERVICE and a MAP parameter pointing to a valid QGIS project file Is there any way to tell if the plugin is loaded correctly. Thank you

Some info: OS: Debian 12.5 QGIS-SERVER version: 3.36.2 Lizmap server plugin version: 2.9.0 Lizmap Web Client: 3.6.12

Gustry commented 5 months ago

Unfortunately lizmap web client says : QGIS Server returns HTTP error for Lizmap plugin: 500.

Did you check the checklst which was provided ?

emilio-sant commented 5 months ago

I followed the checklist on admin page of web client, however i can't make it works. the page says that qgis server work correctly. qgis-plugin-manager list on /usr/lib/qgis/plugins show lizmap_server ver 2.9.0 i'v add on nginx conf: fastcgi_param QGIS_PROJECT_FILE /home/qgis/projects/world.qgs; (qgis docs example) and now the error is not 500 but unknow. if i call /lizmap/server.json from browser i get: `

Service unknown or unsupported. Current supported services (case-sensitive): WMS WFS WCS WMTS SampleService, or use a WFS3 (OGC API Features) endpoint

`

i start the server by doing: spawn-fcgi -s /var/run/qgisserver.socket \ -U www-data -G www-data -n \ /usr/lib/cgi-bin/qgis_mapserv.fcgi i just followed the documentation, but i think i'm missing something. thanks if you can help me and sorry for the trouble, I know it's not really a bug

Gustry commented 5 months ago

i'v add on nginx conf: fastcgi_param QGIS_PROJECT_FILE /home/qgis/projects/world.qgs; (qgis docs example)

This is not needed, because you are setting a single project for QGIS Server.

I followed the checklist on admin page of web client, however i can't make it works.

The checklist is inviting your to check your QGIS Server logs, and maybe increase its log level. You will find if the plugin was loaded or not when QGIS server is starting, and also the log when you are hitting the HTTP request /lizmap/server.json

Gustry commented 5 months ago

In every software, when you have a 500 error, you must check your logs on the server. There is something logged somewhere about the error.

emilio-sant commented 5 months ago

hi. nginx error log is empty. (there are some other log for qgis-server?). i try to run qgis-server as yours README: QGIS_PROJECT_FILE=/home/qgis/projects/world.qgs QGIS_PLUGINPATH=/usr/lib/qgis/plugins QGIS_SERVER_LOG_FILE=/tmp/bob.txt QGIS_SERVER_LOG_LEVEL=0 QGIS_SERVER_LIZMAP_REVEAL_SETTINGS=True REQUEST_URI=/lizmap/server.json /usr/lib/cgi-bin/qgis_mapserv.fcgi and it's reaturs a json. however if i delete QGIS_PLUGINPATH return an error: Service unknown or unsupported. like when called by nginx. i add fastcgi_param QGIS_PLUGINPATH /usr/lib/qgis/plugins; on nginx conf, but it's like the plugin it's not loaded

Gustry commented 5 months ago

and it's reaturs a json. however if i delete QGIS_PLUGINPATH return an error: Service unknown or unsupported. like when called by nginx.

This is correct, there must be a JSON if the plugin is correctly loaded. If you remove your QGIS_PLUGINPATH, then indeed, the plugin might not be loaded, so therefore a error from QGIS Server.

there are some other log for qgis-server?).

Of course, you must be able to read logs from QGIS server. (even later for debugging slow requests etc) https://docs.qgis.org/3.34/en/docs/server_manual/config.html#logging

i add fastcgi_param QGIS_PLUGINPATH /usr/lib/qgis/plugins; on nginx conf, but it's like the plugin it's not loaded

So it seems user and rights according to user running your QGIS Server process. That's why there is a column user/rights in QGIS Plugin manager and you have this tip when installing a plugin with QGIS-Plugin-Manager about current user.

I'm closing, because there isn't any bug. Feel free to continue https://docs.lizmap.com/current/en/install/pre_requirements.html#server-administration-knowledge

You will need to be familiar with:

emilio-sant commented 5 months ago

I think i solved, somehow. the qgis-server docs says: When using spawn-fcgi, you may directly define environment variables before running the server. For example: export QGIS_SERVER_LOG_STDERR=1 however if i export QGIS_PLUGINPATH=/usr/lib/qgis/plugins and then: spawn-fcgi -s /var/run/qgisserver.socket \ -U www-data -G www-data -n \ /usr/lib/cgi-bin/qgis_mapserv.fcgi the pluging doesn't work/load.

i'd to create a service: `[Unit] Description=QGIS server After=network.target

[Service] ;; set env var as needed ;Environment="LANG=en_EN.UTF-8" Environment="QGIS_SERVER_LIZMAP_REVEAL_SETTINGS=1" Environment="QGIS_PROJECT_FILE=/etc/qgis/projects/world.qgs" Environment="QGIS_SERVER_LOG_LEVEL=0" Environment="QGIS_SERVER_LOG_STDERR=1" Environment="QGIS_PLUGINPATH=/usr/lib/qgis/plugins" ;; or use a file: ;EnvironmentFile=/etc/qgis-server/env

ExecStart=spawn-fcgi -s /var/run/qgisserver.socket -U www-data -G www-data -n /usr/lib/cgi-bin/qgis_mapserv.fcgi

[Install] WantedBy=multi-user.target` and now it works!!

Hoewever, now if i try to load a map (i'v downloaded the example of Montpellier) i get an error page: An error occurred while loading the map. Some resources may be temporarily unavailable. Try later.

emilio-sant commented 5 months ago

ok...found the error: without QGIS_PROJECT_FILE it works.

Thank you!

Gustry commented 5 months ago

Hoewever, now if i try to load a map (i'v downloaded the example of Montpellier) i get an error page: An error occurred while loading the map. Some resources may be temporarily unavailable. Try later.

That's again about logs. You must have some logs about this error on QGIS server side. Maybe invalid layer or something else.

And indeed, QGIS_PROJECT_FILE is not needed, because Lizmap doesn't handle a single project. The MAP parameter is given for each request to QGIS Server.

emilio-sant commented 5 months ago

as you can see, i figured out the problem :-)

Thank you again for your support. Sorry for the trouble

Gustry commented 5 months ago

as you can see, i figured out the problem :-)

Yes I saw, but as written in the documentation https://docs.lizmap.com/current/en/install/pre_requirements.html#server-administration-knowledge

checking QGIS server logs is a requirements. Having a Lizmap instance requires some admin sys skills.

The "Lizmap server" plugin is writing logs about loading, incoming requests etc. It helps to debug such requests.

emilio-sant commented 5 months ago

You are right. However the qgis docs says to add the plugin path to apache (i use nginx) but i doesnt work. It says to export path before spawn-fcgid from shell, and it doesn't work. There are a section to deploy qgis server with systemd units ...and not works right. Nginx error logs are empty, but log level is set to 0. Seems server ignores env var settings when using spawn-fcgid. I dont know if its my virtualbox issues, but its a bit hard to figured out what happening in this case.

So...im lacking some admin skill since im a dev, but the docs also lacks some troubleshouting section :-)

Il Lun 13 Mag 2024, 11:41 Étienne Trimaille @.***> ha scritto:

as you can see, i figured out the problem :-)

Yes I saw, but as written in the documentation

https://docs.lizmap.com/current/en/install/pre_requirements.html#server-administration-knowledge

checking QGIS server logs is a requirements. Having a Lizmap instance requires some admin sys skills.

The "Lizmap server" plugin is writing logs about loading, incoming requests etc. It helps to debug such requests.

— Reply to this email directly, view it on GitHub https://github.com/3liz/qgis-lizmap-server-plugin/issues/76#issuecomment-2107113196, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQIQRUZ2VOTKODJTYWSYJZTZCCDEZAVCNFSM6AAAAABHQTGZHOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBXGEYTGMJZGY . You are receiving this because you authored the thread.Message ID: @.***>

Gustry commented 5 months ago

Seems server ignores env var settings when using spawn-fcgid.

When QGIS Server is starting, it is writing all parameters and from where the config come from (default value, conf file etc)

So...im lacking some admin skill since im a dev, but the docs also lacks some troubleshouting section :-)

You should report and/or add precisions in docs. https://github.com/qgis/QGIS-Documentation https://github.com/3liz/lizmap-documentation

There are dozens of ways to install/manage QGIS Server : spawn-fcgi, fcgiwrap, apache, nginx, docker, systemd... We personally use Py-QGIS-Server : https://github.com/3liz/py-qgis-server