Skip to content

Commit

Permalink
Use Py-qgis-server 2 in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarteau committed Dec 6, 2024
1 parent 76506e3 commit 32d60f5
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 4 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#
# expected variables in the CI environment
# - FACTORY_SCRIPTS = path to scripts of the factory
# - REGISTRY_URL = url of the docker registry

STAGE=build
Expand Down Expand Up @@ -184,11 +183,6 @@ ifndef REGISTRY_URL
$(error REGISTRY_URL is undefined)
endif

check-factory:
ifndef FACTORY_SCRIPTS
$(error FACTORY_SCRIPTS is undefined)
endif

stage: $(DIST)

ci_package: $(ZIP_PACKAGE) $(GENERIC_PACKAGE_PATH) $(ZIP_DEMO_PACKAGE)
Expand Down Expand Up @@ -246,12 +240,12 @@ docker-clean:
docker-clean-all:
docker rmi -f $(shell docker images $(DOCKER_BUILDIMAGE) -q) || true

docker-release: check-factory
cd docker && $(FACTORY_SCRIPTS)/release-image.sh $(DOCKER_RELEASE_PACKAGE_NAME)
cd docker && $(FACTORY_SCRIPTS)/push-to-docker-hub.sh --clean
docker-release:
cd docker && release-image $(DOCKER_RELEASE_PACKAGE_NAME)
cd docker && push-to-docker-hub.sh --clean

docker-hub:
cd docker && $(FACTORY_SCRIPTS)/push-to-docker-hub.sh --clean
cd docker && push-to-docker-hub --clean

php-cs-fixer-test:
php-cs-fixer fix --config=.php-cs-fixer.dist.php --allow-risky=yes --dry-run --diff
Expand Down
24 changes: 9 additions & 15 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?= [email protected]
Expand All @@ -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)
Expand All @@ -44,32 +46,24 @@ 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 qgis-server-rpc \
3liz/qgis-services:${LZMQGSRVVERSION} \
version
docker run \
-u $(LIZMAP_USER_ID):$(LIZMAP_GROUP_ID) \
--rm -i \
-e QGSRV_SERVER_PLUGINPATH=/srv/plugins \
-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/qgis-services:${LZMQGSRVVERSION} \
list

upgrade-projects:
Expand Down
59 changes: 33 additions & 26 deletions tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ services:
POSTGRES_USER: lizmap
volumes:
- pg_data:/var/lib/postgresql/data
- "../:/srv/lzm/"
- { type: bind, source: "..", target: /srv/lzm/ }
ports:
- ${LZMPGPORT}:5432
networks:
default:
aliases:
- db.lizmap.local
redis:
image: redis:7.4
image: redis:7-alpine
container_name: "lizmap${LZMBRANCH}_test_redis"
openldap:
build: ./docker-conf/openldap
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -67,34 +67,41 @@ services:
- ${LZMWEBPORT}:80
depends_on:
- lizmap
# Qgis RCP backend
map-rpc:
container_name: "lizmap${LZMBRANCH}_test_qgis_rpc"
image: 3liz/qgis-services:${LZMQGSRVVERSION}
command: ["qgis-server-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/qgis-services:${LZMQGSRVVERSION}
command: ["qgis-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
Expand Down
4 changes: 2 additions & 2 deletions tests/docker-conf/phpfpm/lizmapConfig.ini.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 38 additions & 0 deletions tests/docker-conf/qgis-server.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#
# Worker backend configuration
#

[worker]
name = "Qgis"
max_projects = 20

[worker.projects]
ignore_bad_layers = true

[worker.projects.search_paths]
'/' = "/srv/projects"


# Plugins allowed to install from plugin paths
[worker.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"

2 changes: 0 additions & 2 deletions tests/run-docker
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"

0 comments on commit 32d60f5

Please sign in to comment.