Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin installation #76

Closed
emilio-sant opened this issue May 10, 2024 · 13 comments
Closed

plugin installation #76

emilio-sant opened this issue May 10, 2024 · 13 comments

Comments

@emilio-sant
Copy link

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
Copy link
Member

Gustry commented May 13, 2024

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

Did you check the checklst which was provided ?

@emilio-sant
Copy link
Author

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:
<ServiceExceptionReport version="1.3.0"> <ServiceException code="Service configuration error"> Service unknown or unsupported. Current supported services (case-sensitive): WMS WFS WCS WMTS SampleService, or use a WFS3 (OGC API Features) endpoint </ServiceException> </ServiceExceptionReport>

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
Copy link
Member

Gustry commented May 13, 2024

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
Copy link
Member

Gustry commented May 13, 2024

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
Copy link
Author

emilio-sant commented May 13, 2024

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
Copy link
Member

Gustry commented May 13, 2024

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:

@Gustry Gustry closed this as not planned Won't fix, can't repro, duplicate, stale May 13, 2024
@emilio-sant
Copy link
Author

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
Copy link
Author

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

Thank you!

@Gustry
Copy link
Member

Gustry commented May 13, 2024

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
Copy link
Author

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

Thank you again for your support. Sorry for the trouble

@Gustry
Copy link
Member

Gustry commented May 13, 2024

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
Copy link
Author

emilio-sant commented May 13, 2024 via email

@Gustry
Copy link
Member

Gustry commented May 13, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants