qgis / qgis-docker

Official Docker image for QGIS Server and Desktop
GNU Affero General Public License v3.0
67 stars 21 forks source link

add caddy config #106

Open paulwalko opened 1 month ago

paulwalko commented 1 month ago

Description

Add caddy configuration for reference

I had been using this config for quite a while using the Dockerfile at https://docs.qgis.org/3.34/en/docs/server_manual/containerized_deployment.html with no issue.

I have verified this works following the url structure https://example.com/qgis_mapserv.fcgi?SERVICE=WMTS&REQUEST=GetCapabilities&MAP=/io/data/test/test.qgz with the ltr tag.

JakobMiksch commented 1 month ago

@paulwalko just to understand this correctly. In this example you would not use NGINX at all and use Caddy instead?

paulwalko commented 1 month ago

Yes, that's correct. In my testing qgis-server was run with the SKIP_NGINX=true env var

mbernasocchi commented 1 month ago

@paulwalko Thanks; I also prefer Caddyfiles, but is the committed Caddyfile functional? it looks a bit too skinny (isn't local_certs, file_server root, and maybe env QUER_STRING missing).

I usually use https://github.com/opengisch/micro-sdi/blob/master/conf/Caddyfile as a minimal version (it could for sure be reduced to remove the matches.

paulwalko commented 1 month ago

@paulwalko Thanks; I also prefer Caddyfiles, but is the committed Caddyfile functional? it looks a bit too skinny (isn't local_certs, file_server root, and maybe env QUER_STRING missing).

I usually use https://github.com/opengisch/micro-sdi/blob/master/conf/Caddyfile as a minimal version (it could for sure be reduced to remove the matches.

Global config can vary widely based on user preference. In my case the domain is externally available so the local_certs property (or any global config) is not needed at all. I'll add a comment about that in the readme.

The QUERY_STRING parameter (and many others) is already passed by default in caddy: https://github.com/caddyserver/caddy/blob/2ce5c6526938b604586c987fa3d31117721e40a6/modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go#L299

As for the other configuration in the Caddyfile you linked, I'm wondering is that necessarily required? If all the functionality works without it I could see that causing more confusion than intended.

mbernasocchi commented 1 month ago

Global config can vary widely based on user preference. In my case the domain is externally available so the local_certs property (or any global config) is not needed at all. I'll add a comment about that in the readme. Perfect,

As for the other configuration in the Caddyfile you linked, I'm wondering is that necessarily required? If all the functionality works without it I could see that causing more confusion than intended.

As I said, it could be reduced, but the way you setup the Caddyfile does not mimic the NGINX config which offers nice urls (https://github.com/qgis/qgis-docker/blob/c9d5e5afcd28f31c920e45cae82dabab5435bfea/server/conf/nginx-fcgi-sample.conf#L88)

I think Ideally we should try to keep those (or remove them in NGINX) but not have 2 different entry points. I'd prefer having the /ogc entrypoint in Caddy as well.

paulwalko commented 4 weeks ago

Alright, I think it should be good to go now. Admittedly I don't have much experience using the services except for WMTS, but the other endpoints seem to be very similar (using your provided file as reference), they just have a different path prefix.