From e7da2cacdf930dbf90ab3e1924c280dca1062aed Mon Sep 17 00:00:00 2001 From: David Marteau Date: Mon, 18 Nov 2024 18:31:03 +0100 Subject: [PATCH] Use QJazz in tests --- .gitlab-ci.yml | 2 +- tests/Makefile | 26 ++++---- tests/docker-compose.yml | 59 +++++++++++-------- tests/docker-conf/phpfpm/lizmapConfig.ini.php | 4 +- tests/docker-conf/qgis-server.toml | 39 ++++++++++++ tests/run-docker | 2 - 6 files changed, 85 insertions(+), 47 deletions(-) create mode 100644 tests/docker-conf/qgis-server.toml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 407b446c08..d7d865a655 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -149,7 +149,7 @@ deploy-package-unstable: - fabric deploy-docker-unstable: - image: ${REGISTRY_URL}/factory-ci-runner:build-package + image: ${REGISTRY_URL}/factory-ci-runner:factory-ci stage: deploy script: - update-service lizmap diff --git a/tests/Makefile b/tests/Makefile index 1272966ead..9060dea7cf 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -13,9 +13,10 @@ PREFIX:=lizmap-$(LZMBRANCH)-tests LIZMAP_USER_ID ?= $(shell id -u) LIZMAP_GROUP_ID ?= $(shell id -g) LZMPOSTGISVERSION ?= 14-3 -LZMQGSRVVERSION ?= 3.34 +LZMQGSRVVERSION ?= qgis-ltr-eager LZMPGPORT ?= 8132 LZMQGSRVPORT ?= 8131 +LZMQGSADMINPORT ?= 9876 LZMWEBPORT ?= 8130 LIZMAP_ADMIN_LOGIN ?= admin LIZMAP_ADMIN_EMAIL ?= admin@localhost.local @@ -33,6 +34,7 @@ env: LZMBRANCH=$(LZMBRANCH) LZMPGPORT=$(LZMPGPORT) LZMQGSRVPORT=$(LZMQGSRVPORT) + LZMQGSADMINPORT=$(LZMQGSADMINPORT) LZMWEBPORT=$(LZMWEBPORT) LIZMAP_ADMIN_LOGIN=$(LIZMAP_ADMIN_LOGIN) LIZMAP_ADMIN_EMAIL=$(LIZMAP_ADMIN_EMAIL) @@ -44,23 +46,14 @@ env: build-plugins: - docker run \ - -u $(LIZMAP_USER_ID):$(LIZMAP_GROUP_ID) \ - --rm -i \ - -e QGSRV_SERVER_PLUGINPATH=/srv/plugins \ - -e QGIS_PLUGIN_MANAGER_SOURCES_FILE=/tmp/sources-plugin-manager.list \ - -e QGIS_PLUGIN_MANAGER_CACHE_DIR=/tmp/cache-plugin-manager \ - -v $(shell pwd)/qgis-server-plugins:/srv/plugins \ - -v $(shell pwd)/:/src \ - --entrypoint /src/add_server_plugins.sh \ - 3liz/qgis-map-server:${LZMQGSRVVERSION} \ + echo "Plugins are auto installed at qgis worker startup" show-qgis-server-versions: docker run \ --rm -i \ - --entrypoint qgisserver \ - 3liz/qgis-map-server:${LZMQGSRVVERSION} \ - --version + --entrypoint qjazz-config \ + 3liz/qjazz:${LZMQGSRVVERSION} \ + version docker run \ -u $(LIZMAP_USER_ID):$(LIZMAP_GROUP_ID) \ --rm -i \ @@ -68,8 +61,9 @@ show-qgis-server-versions: -e QGIS_PLUGIN_MANAGER_SKIP_SOURCES_FILE=True \ -v $(shell pwd)/qgis-server-plugins:/srv/plugins \ -v $(shell pwd)/:/src \ + --workdir /srv/plugins \ --entrypoint qgis-plugin-manager \ - 3liz/qgis-map-server:${LZMQGSRVVERSION} \ + 3liz/qjazz:${LZMQGSRVVERSION} \ list upgrade-projects: @@ -80,7 +74,7 @@ upgrade-projects: -v $(shell pwd)/qgis-server-plugins:/srv/plugins \ -v $(shell pwd)/qgis-projects/tests:/tmp/qgis-projects \ --entrypoint /srv/plugins/upgrade_projects.py \ - 3liz/qgis-map-server:${LZMQGSRVVERSION} \ + 3liz/qjazz:${LZMQGSRVVERSION} \ up: env docker compose up -V --force-recreate -d diff --git a/tests/docker-compose.yml b/tests/docker-compose.yml index 487c596c77..26d35e330e 100644 --- a/tests/docker-compose.yml +++ b/tests/docker-compose.yml @@ -8,7 +8,7 @@ services: POSTGRES_USER: lizmap volumes: - pg_data:/var/lib/postgresql/data - - "../:/srv/lzm/" + - { type: bind, source: "..", target: /srv/lzm/ } ports: - ${LZMPGPORT}:5432 networks: @@ -16,7 +16,7 @@ services: aliases: - db.lizmap.local redis: - image: redis:7.4 + image: redis:7-alpine container_name: "lizmap${LZMBRANCH}_test_redis" openldap: build: ./docker-conf/openldap @@ -27,7 +27,7 @@ services: SLAPD_ORGANISATION: "Lizmap" SLAPD_DOMAIN: "tests.lizmap" volumes: - - "./docker-conf/openldap/ldif:/customldif" + - { type: bind, source: ./docker-conf/openldap/ldif, target: /customldif } lizmap: build: context: ./docker-conf/phpfpm @@ -44,8 +44,8 @@ services: - LIZMAP_ADMIN_DEFAULT_PASSWORD_SOURCE - ECHO_OGC_ORIGINAL_REQUEST=on volumes: - - "../:/srv/lzm/" - - ./docker-conf/pg_service.conf:/srv/etc/pg_service.conf + - { type: bind, source: "..", target: /srv/lzm/ } + - { type: bind, source: ./docker-conf/pg_service.conf, target: /srv/etc/pg_service.conf } - ./docker-conf/phpfpm/admin.conf:/srv/etc/admin.conf depends_on: - pgsql @@ -55,8 +55,8 @@ services: image: nginx:alpine container_name: "lizmap${LZMBRANCH}_test_nginx" volumes: - - "./docker-conf/nginx-default.conf:/etc/nginx/conf.d/default.conf" - - "../:/srv/lzm/" + - { type: bind, source: ./docker-conf/nginx-default.conf, target: /etc/nginx/conf.d/default.conf } + - { type: bind, source: "..", target: /srv/lzm/ } command: /bin/sh -c "nginx -g 'daemon off;'" networks: default: @@ -67,34 +67,41 @@ services: - ${LZMWEBPORT}:80 depends_on: - lizmap + # Qgis RCP backend + map-rpc: + container_name: "lizmap${LZMBRANCH}_test_qgis_rpc" + image: 3liz/qjazz:${LZMQGSRVVERSION} + command: ["qjazz-rpc", "serve", "-C", "/srv/etc/qgis-server.toml"] + environment: + CONF_LOGGING__LEVEL: debug + CONF_WORKER__NUM_PROCESSES: 4 + CONF_DISPLAY_XVFB: ON + CONF_USER: ${LIZMAP_USER_ID}:${LIZMAP_GROUP_ID} + QGIS_PLUGINPATH: /srv/qgis-server-plugins + QGIS_SERVER_LIZMAP_REVEAL_SETTINGS: yes + PGSERVICEFILE: /srv/etc/pg_service.conf + volumes: + - { type: bind, source: ./qgis-projects, target: /srv/projects } + - { type: bind, source: ./qgis-server-plugins, target: /srv/qgis-server-plugins } + - { type: bind, source: ./docker-conf/pg_service.conf, target: /srv/etc/pg_service.conf } + - { type: bind, source: ./docker-conf/qgis-server.toml, target: /srv/etc/qgis-server.toml } + # Qgis workers frontend map: container_name: "lizmap${LZMBRANCH}_test_qgis" - image: 3liz/qgis-map-server:${LZMQGSRVVERSION} + image: 3liz/qjazz:${LZMQGSRVVERSION} + command: ["qjazz-server-http", "serve", "-C", "/srv/etc/qgis-server.toml"] environment: - PGSERVICEFILE: /srv/etc/pg_service.conf - QGIS_SERVER_LIZMAP_REVEAL_SETTINGS: yes - QGSRV_API_ENABLED_LIZMAP: yes - QGSRV_CACHE_ROOTDIR: /srv/projects - QGSRV_CACHE_SIZE: '20' - # For testing purpose, I think it's better to have a strict check of layers - QGSRV_CACHE_STRICT_CHECK: yes - QGSRV_LOGGING_LEVEL: DEBUG - QGSRV_SERVER_PLUGINPATH: /srv/qgis-server-plugins - QGSRV_SERVER_WORKERS: 4 - QGSRV_USER: ${LIZMAP_USER_ID}:${LIZMAP_GROUP_ID} - ROUTER_HOST: map + CONF_LOGGING__LEVEL: trace volumes: - - ./qgis-projects:/srv/projects - - ./qgis-server-plugins:/srv/qgis-server-plugins - - ./wps-data:/srv/data - - ./docker-conf/pg_service.conf:/srv/etc/pg_service.conf + - { type: bind, source: ./docker-conf/qgis-server.toml, target: /srv/etc/qgis-server.toml } ports: - - ${LZMQGSRVPORT}:8080 + - ${LZMQGSRVPORT}:9080 + - ${LZMQGSADMINPORT}:9876 webdav: container_name: lizmap${LZMBRANCH}_test_webdav image: ugeek/webdav:amd64 volumes: - - ./qgis-projects/webdav/test:/media + - { type: bind, source: ./qgis-projects/webdav/test, target: /media } environment: - USERNAME=webdav - PASSWORD=webdav diff --git a/tests/docker-conf/phpfpm/lizmapConfig.ini.php b/tests/docker-conf/phpfpm/lizmapConfig.ini.php index 01b7e3d602..52b418f108 100644 --- a/tests/docker-conf/phpfpm/lizmapConfig.ini.php +++ b/tests/docker-conf/phpfpm/lizmapConfig.ini.php @@ -5,11 +5,11 @@ ;list the different map services (servers, generic parameters, etc.) [services] ;Wms map server -wmsServerURL="http://map:8080/ows/" +wmsServerURL="http://map:9080/" ;WMS subdomain URLs list (optional) wmsPublicUrlList= ;URL to the API exposed by the Lizmap plugin for QGIS Server -lizmapPluginAPIURL="http://map:8080/lizmap/" +lizmapPluginAPIURL="http://map:9080/lizmap/" onlyMaps=off defaultRepository=testsrepository diff --git a/tests/docker-conf/qgis-server.toml b/tests/docker-conf/qgis-server.toml new file mode 100644 index 0000000000..62f5e84d90 --- /dev/null +++ b/tests/docker-conf/qgis-server.toml @@ -0,0 +1,39 @@ +# +# Worker backend configuration +# + +[worker] +name = "Qgis" + +[worker.qgis] +max_projects = 20 + +[worker.qgis.projects] +ignore_bad_layers = true + +[worker.qgis.projects.search_paths] +'/' = "/srv/projects" + +# Plugins allowed to install from plugin paths +[worker.qgis.plugins] +install = [ + "Lizmap server", + "atlasprint", + "wfsOutputExtension", +] +# Auto install plugins from embedded plugin manager +install_mode = "auto" + +# +# HTTP Front end configuration +# + +[backends.root] +title = "Root backend" +address= "tcp://map-rpc" +route = "/" + +[[backends.root.api]] +endpoint = "lizmap" +name = "Lizmap api" + diff --git a/tests/run-docker b/tests/run-docker index 686f7577da..5a85f3247a 100755 --- a/tests/run-docker +++ b/tests/run-docker @@ -19,8 +19,6 @@ if [ "$CMD" == "reset" ]; then elif [ "$CMD" == "build" ]; then # install or update base images, to be sure we have the latest images docker compose pull - # install or update plugins, to be sure we have the latest plugins - make build-plugins fi docker compose $CMD "$@"