From 1d81e2106499a1c93a2180e74db90d73321d7d8f Mon Sep 17 00:00:00 2001 From: David Marteau Date: Wed, 25 May 2022 15:05:47 +0200 Subject: [PATCH] Install qgis-plugin-manager for server plugins --- CHANGELOG.md | 6 ++++ docker/Dockerfile | 5 ++- docker/docker-entrypoint.sh | 6 ++++ docker/install-lizmap-plugin | 61 ------------------------------------ pyqgisserver/config.py | 5 +-- 5 files changed, 17 insertions(+), 66 deletions(-) delete mode 100644 docker/install-lizmap-plugin diff --git a/CHANGELOG.md b/CHANGELOG.md index c6f7ed2..e95995d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## Unreleased +* Use qgis-plugin-manager for installing qgis server plugins + - See https://github.com/3liz/qgis-plugin-manager +* Support `QGIS_PLUGINPATH` environment variable +* Add 'getfeaturelimit' config option + - Set maximum value for WFS/GetFeature requests + ## 1.8.0 - 2022-05-16 * Bump version 1.8 diff --git a/docker/Dockerfile b/docker/Dockerfile index c132f2f..47a1a8e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -24,13 +24,12 @@ RUN mkdir -p /opt/local/ \ && /opt/local/pyqgisserver/bin/pip install --no-cache-dir $PIP_OPTIONS \ "py-qgis-server==${BUILD_VERSION}" \ py-amqp-client \ + qgis-plugin-manager \ && ln -s /opt/local/pyqgisserver/bin/qgisserver \ && ln -s /opt/local/pyqgisserver/bin/qgisserver-worker \ + && ln -s /opt/local/pyqgisserver/bin/qgis-plugin-manager \ && rm -rf /root/.cache /root/.ccache -COPY install-lizmap-plugin /usr/local/bin/ -RUN chmod 0755 /usr/local/bin/install-lizmap-plugin - COPY docker-entrypoint.sh / RUN chmod 0755 /docker-entrypoint.sh diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index 8d900f7..b5b33bb 100644 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -60,6 +60,12 @@ fi export QGIS_DISABLE_MESSAGE_HOOKS=1 export QGIS_NO_OVERRIDE_IMPORT=1 +# Make sure that QGSRV_SERVER_PLUGINPATH takes precedence over +# QGIS_PLUGINPATH +if [[ -n ${QGSRV_SERVER_PLUGINPATH} ]]; then + export QGIS_PLUGINPATH=$QGSRV_SERVER_PLUGINPATH +fi + if [[ "$1" == "qgisserver-worker" ]]; then shift echo "Running Qgis server worker" diff --git a/docker/install-lizmap-plugin b/docker/install-lizmap-plugin deleted file mode 100644 index b3de947..0000000 --- a/docker/install-lizmap-plugin +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -set -e - -function help() { - echo "Install lizmap plugin" - echo "Usage:" - echo "install-lizmap-plugin [version]" - echo "" - exit 1 -} - -[[ $# -lt 1 ]] && help - -INSTALL_DIR=$1 - -if [[ $# -gt 1 ]]; then - LIZMAP_PLUGIN_VERSION=$2 -else - LIZMAP_PLUGIN_VERSION=$(_get_latest_release) -fi - -_get_latest_release() { - wget -q https://api.github.com/repos/3liz/lizmap-plugin/releases/latest -O - |\ - jq -r '.assets[0] | browser_download_url' - -} - -_install-plugin() { - local plugindir=$INSTALL_DIR/lizmap - if [ -d $plugindir ]; then - local version=$(cat $plugindir/metadata.txt | grep "version=" | cut -d '=' -f2) - echo "Found installed version $version" - if [ ! "$LIZMAP_PLUGIN_VERSION" = "$version" ]; then - $remove_current=1 - else - echo "Installed version match required version" - return 0 - fi - fi - echo "Installing version $LIZMAP_PLUGIN_VERSION" - wget https://github.com/3liz/lizmap-plugin/releases/download/$LIZMAP_PLUGIN_VERSION/lizmap.$LIZMAP_PLUGIN_VERSION.zip \ - -O lizmap-plugin.zip - unzip -qq lizmap-plugin.zip -d lizmap-plugin-$LIZMAP_PLUGIN_VERSION - ( - cd lizmap-plugin-$LIZMAP_PLUGIN_VERSION - local files="lizmap/__init__.py lizmap/server lizmap/tooltip.py lizmap/metadata.txt" - if [ "$remove_current" = "1" ]; then - echo "Removing installed version" - rm -rf $plugindir - fi - mkdir $plugindir - cp -rLp $files $plugindir/ - ) - # Clean up stuff - rm -rf lizmap-plugin.zip lizmap-plugin-$LIZMAP_PLUGIN_VERSION -} - - -_install-plugin - diff --git a/pyqgisserver/config.py b/pyqgisserver/config.py index 95832be..771c039 100644 --- a/pyqgisserver/config.py +++ b/pyqgisserver/config.py @@ -65,7 +65,6 @@ def load_configuration(): CONFIG.set('server', 'http_proxy' , getenv('QGSRV_SERVER_HTTP_PROXY', 'no')) CONFIG.set('server', 'proxy_url' , getenv('QGSRV_SERVER_PROXY_URL', '')) CONFIG.set('server', 'restartmon' , getenv('QGSRV_SERVER_RESTARTMON', '')) - CONFIG.set('server', 'pluginpath' , getenv('QGSRV_SERVER_PLUGINPATH', '')) CONFIG.set('server', 'ssl' , getenv('QGSRV_SERVER_SSL', 'no')) CONFIG.set('server', 'ssl_cert' , getenv('QGSRV_SERVER_SSL_CERT', '')) CONFIG.set('server', 'ssl_key' , getenv('QGSRV_SERVER_SSL_KEY', '')) @@ -75,7 +74,9 @@ def load_configuration(): CONFIG.set('server', 'memory_high_water_mark', getenv('QGSRV_SERVER_MEMORY_HIGH_WATER_MARK', '0.9')) CONFIG.set('server', 'getfeaturelimit', getenv('QGSRV_SERVER_GETFEATURELIMIT', '-1')) - + CONFIG.set('server', 'pluginpath', + getenv2('QGSRV_SERVER_PLUGINPATH','QGIS_PLUGINPATH', '')) + # # Logging #