From 34f9d7c43a4c1752c42c3a6bea2820c30c4bd146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Thu, 31 Oct 2024 15:32:36 +0100 Subject: [PATCH 1/2] Upgrade to GeoMapFish 2.9 --- CONST_CHANGELOG.txt | 16 +++++++++++ CONST_create_template/Dockerfile | 2 +- .../docker-compose.override.sample.yaml | 2 +- CONST_create_template/geoportal/Dockerfile | 2 +- .../static-ngeo/js/apps/desktop.html.ejs | 2 +- .../static-ngeo/js/apps/iframe_api.html.ejs | 2 +- .../static-ngeo/js/apps/mobile.html.ejs | 2 +- .../static-ngeo/js/apps/mobile_alt.html.ejs | 2 +- .../static-ngeo/js/apps/oeedit.html.ejs | 2 +- .../geoportal/webpack.commons.js | 1 + CONST_create_template/tests/test_app.py | 9 +++++- ci/cleanup | 5 ++++ geoportal/CONST_config-schema.yaml | 28 +++++++++++++++++-- geoportal/CONST_vars.yaml | 5 ++++ geoportal/Dockerfile | 2 +- .../static-ngeo/js/apps/desktop.html.ejs | 2 +- .../static-ngeo/js/apps/iframe_api.html.ejs | 2 +- .../static-ngeo/js/apps/mobile.html.ejs | 2 +- .../static-ngeo/js/apps/mobile_alt.html.ejs | 2 +- .../static-ngeo/js/apps/oeedit.html.ejs | 2 +- tests/test_app.py | 6 ++++ 21 files changed, 81 insertions(+), 17 deletions(-) diff --git a/CONST_CHANGELOG.txt b/CONST_CHANGELOG.txt index 73738dc99..357ffc928 100644 --- a/CONST_CHANGELOG.txt +++ b/CONST_CHANGELOG.txt @@ -9,6 +9,22 @@ Information to know before starting the upgrade 1. The build command will use Docker Compose version 2 (with the `docker compose` command). +2. RFC 001 - simplification of Ngeo buildtools and custom frontends for GeoMapfish + https://github.com/camptocamp/GeoMapFish/blob/6f8bffaa1e472cdd8ed3de52c8250b5da62d69de/rfcs/rfc_001.md + + Important points: + - The `@ngInject` annotation is no more used, you should pass an array in the function or use the `$inject` property, + see related pull request: https://github.com/camptocamp/ngeo/pull/9453 + - The build will not anymore inline the svg, If you use that you should do it manually, + see related commit: https://github.com/camptocamp/ngeo/pull/9454/commits/fb3ccfb0bdc8273975cdebfd7dbda401416674c3. + - Remove the custom SASS plugin to load the SCSS files. + You should have one SCSS file per interface, the component will not anymore integrate the related style. + See the related pull request: https://github.com/camptocamp/ngeo/pull/9455. + - Update Webpack to version 5 and remove Babel transpilation to ES05, + See the related pull request: https://github.com/camptocamp/ngeo/pull/9463. + - Update FontAwesome to version 6, + See the related pull request: https://github.com/camptocamp/ngeo/pull/9470 + Information =========== diff --git a/CONST_create_template/Dockerfile b/CONST_create_template/Dockerfile index 53ec97d06..e2538a0e7 100644 --- a/CONST_create_template/Dockerfile +++ b/CONST_create_template/Dockerfile @@ -14,7 +14,7 @@ ENV CONFIG_VARS sqlalchemy.url sqlalchemy.pool_recycle sqlalchemy.pool_size sqla dbsessions urllogin host_forward_host headers_whitelist headers_blacklist \ smtp c2c.base_path welcome_email \ lingva_extractor interfaces_config interfaces devserver_url api authentication intranet metrics pdfreport \ - vector_tiles i18next main_ogc_server + vector_tiles i18next main_ogc_server static_files COPY . /tmp/config/ diff --git a/CONST_create_template/docker-compose.override.sample.yaml b/CONST_create_template/docker-compose.override.sample.yaml index c70e4d5ed..52ac887ac 100644 --- a/CONST_create_template/docker-compose.override.sample.yaml +++ b/CONST_create_template/docker-compose.override.sample.yaml @@ -12,7 +12,7 @@ services: # - ./../c2cgeoportal/geoportal/c2cgeoportal_geoportal:/opt/c2cgeoportal/geoportal/c2cgeoportal_geoportal # - ./../c2cgeoportal/admin/c2cgeoportal_admin:/opt/c2cgeoportal/admin/c2cgeoportal_admin command: - - /usr/local/bin/pserve + - /venv/bin/pserve - --reload - c2c:///app/development.ini environment: diff --git a/CONST_create_template/geoportal/Dockerfile b/CONST_create_template/geoportal/Dockerfile index 756233f8c..2706c3b20 100644 --- a/CONST_create_template/geoportal/Dockerfile +++ b/CONST_create_template/geoportal/Dockerfile @@ -41,7 +41,7 @@ RUN chmod go+w /etc/static-ngeo/ RUN --mount=type=cache,target=/root/.cache \ python3 -m pip install --disable-pip-version-check --editable=/app/ \ - && python3 -m compileall -q /usr/local/lib/python3.* \ + && python3 -m compileall -q /venv/lib/python3.* \ -x '/(ptvsd|.*pydev.*|networkx|scaffolds|yaml_include)/' \ && python3 -m compileall -q /app/geomapfish_geoportal -x /app/geomapfish_geoportal/static.* \ && pip freeze > /requirements.txt diff --git a/CONST_create_template/geoportal/geomapfish_geoportal/static-ngeo/js/apps/desktop.html.ejs b/CONST_create_template/geoportal/geomapfish_geoportal/static-ngeo/js/apps/desktop.html.ejs index 1f5be1a1f..5ebc10a58 100644 --- a/CONST_create_template/geoportal/geomapfish_geoportal/static-ngeo/js/apps/desktop.html.ejs +++ b/CONST_create_template/geoportal/geomapfish_geoportal/static-ngeo/js/apps/desktop.html.ejs @@ -349,7 +349,7 @@ 'Ihr Browser wird nicht unterstützt, bitte verwenden Sie eine aktuelle Version von Firefox, Chrome oder Edge.' ); - + <% for (var js in htmlWebpackPlugin.files.js) { %> <% } %> diff --git a/CONST_create_template/geoportal/geomapfish_geoportal/static-ngeo/js/apps/iframe_api.html.ejs b/CONST_create_template/geoportal/geomapfish_geoportal/static-ngeo/js/apps/iframe_api.html.ejs index 024a8cfd2..277fb0981 100644 --- a/CONST_create_template/geoportal/geomapfish_geoportal/static-ngeo/js/apps/iframe_api.html.ejs +++ b/CONST_create_template/geoportal/geomapfish_geoportal/static-ngeo/js/apps/iframe_api.html.ejs @@ -76,7 +76,7 @@ 'Ihr Browser wird nicht unterstützt, bitte verwenden Sie eine aktuelle Version von Firefox, Chrome oder Edge.' ); - + <% for (var js in htmlWebpackPlugin.files.js) { %> <% } %> diff --git a/CONST_create_template/geoportal/geomapfish_geoportal/static-ngeo/js/apps/mobile.html.ejs b/CONST_create_template/geoportal/geomapfish_geoportal/static-ngeo/js/apps/mobile.html.ejs index fcbb955df..21a7ed186 100644 --- a/CONST_create_template/geoportal/geomapfish_geoportal/static-ngeo/js/apps/mobile.html.ejs +++ b/CONST_create_template/geoportal/geomapfish_geoportal/static-ngeo/js/apps/mobile.html.ejs @@ -207,7 +207,7 @@ 'Ihr Browser wird nicht unterstützt, bitte verwenden Sie eine aktuelle Version von Firefox, Chrome oder Edge.' ); - + <% for (var js in htmlWebpackPlugin.files.js) { %> <% } %> diff --git a/CONST_create_template/geoportal/geomapfish_geoportal/static-ngeo/js/apps/mobile_alt.html.ejs b/CONST_create_template/geoportal/geomapfish_geoportal/static-ngeo/js/apps/mobile_alt.html.ejs index 80108b61b..3b0d08ecf 100644 --- a/CONST_create_template/geoportal/geomapfish_geoportal/static-ngeo/js/apps/mobile_alt.html.ejs +++ b/CONST_create_template/geoportal/geomapfish_geoportal/static-ngeo/js/apps/mobile_alt.html.ejs @@ -192,7 +192,7 @@ 'Ihr Browser wird nicht unterstützt, bitte verwenden Sie eine aktuelle Version von Firefox, Chrome oder Edge.' ); - + <% for (var js in htmlWebpackPlugin.files.js) { %> <% } %> diff --git a/CONST_create_template/geoportal/geomapfish_geoportal/static-ngeo/js/apps/oeedit.html.ejs b/CONST_create_template/geoportal/geomapfish_geoportal/static-ngeo/js/apps/oeedit.html.ejs index 410cfcf86..1ab2bf2d2 100644 --- a/CONST_create_template/geoportal/geomapfish_geoportal/static-ngeo/js/apps/oeedit.html.ejs +++ b/CONST_create_template/geoportal/geomapfish_geoportal/static-ngeo/js/apps/oeedit.html.ejs @@ -160,7 +160,7 @@ 'Ihr Browser wird nicht unterstützt, bitte verwenden Sie eine aktuelle Version von Firefox, Chrome oder Edge.' ); - + <% for (var js in htmlWebpackPlugin.files.js) { %> <% } %> diff --git a/CONST_create_template/geoportal/webpack.commons.js b/CONST_create_template/geoportal/webpack.commons.js index 8b0c42c6d..686c84e42 100644 --- a/CONST_create_template/geoportal/webpack.commons.js +++ b/CONST_create_template/geoportal/webpack.commons.js @@ -5,6 +5,7 @@ const config = commons({ context: '/usr/lib/', }, noTs: true, + nodll: true, }); module.exports = () => config; diff --git a/CONST_create_template/tests/test_app.py b/CONST_create_template/tests/test_app.py index f4f246ba6..c60a3ed45 100644 --- a/CONST_create_template/tests/test_app.py +++ b/CONST_create_template/tests/test_app.py @@ -1,3 +1,5 @@ +import time + import pytest import requests @@ -25,7 +27,12 @@ ) def test_url(url: str, params: dict[str, str], timeout: int) -> None: """Tests that some URL didn't return an error.""" - response = requests.get(url, params=params, verify=False, timeout=timeout) # nosec + for _ in range(6): + response = requests.get(url, params=params, verify=False, timeout=timeout) # nosec + if response.status_code == 503: + time.sleep(1) + continue + break assert response.status_code == 200, response.text diff --git a/ci/cleanup b/ci/cleanup index 5248b3108..371527a03 100755 --- a/ci/cleanup +++ b/ci/cleanup @@ -42,3 +42,8 @@ rm "$1/package-lock.json" rm "$1/custom/requirements.txt" rm "$1/custom/pyproject.toml" rm "$1/custom/poetry.lock" +# Upgrade files +rm "$1/.UPGRADE_INSTRUCTIONS" || true +rm "$1/.upgrade.yaml" || true +rm "$1/*.diff" || true +rm "$1/upgrade" || true diff --git a/geoportal/CONST_config-schema.yaml b/geoportal/CONST_config-schema.yaml index 8763f55a1..df925e8ff 100644 --- a/geoportal/CONST_config-schema.yaml +++ b/geoportal/CONST_config-schema.yaml @@ -121,6 +121,8 @@ mapping: layout: type: str default: ngeo + html_filename: + type: str interfaces_config: required: True type: map @@ -205,6 +207,12 @@ mapping: oauth2_token_expire_minutes: type: scalar required: false + oauth2: + type: map + required: false + mapping: + enabled: + type: bool allowed_hosts: type: seq sequence: @@ -214,8 +222,8 @@ mapping: required: false mapping: enabled: - type: bool - default: false + type: scalar + # default: false url: type: str required: false @@ -239,6 +247,22 @@ mapping: query_user_info: type: bool default: false + create_user: + type: bool + default: false + match_field: + type: str + enum: + - username + - email + update_fields: + type: seq + sequence: + - type: str + enum: + - username + - display_name + - email user_info_fields: type: map mapping: diff --git a/geoportal/CONST_vars.yaml b/geoportal/CONST_vars.yaml index e9145897b..67a9d6bf1 100644 --- a/geoportal/CONST_vars.yaml +++ b/geoportal/CONST_vars.yaml @@ -43,6 +43,8 @@ vars: oauth2_token_expire_minutes: 60 oauth2_authorization_expire_minutes: 10 max_consecutive_failures: 10 + openid_connect: + enabled: '{OPENID_CONNECT_ENABLED}' intranet: networks: [] @@ -1389,6 +1391,8 @@ runtime_environment: default: '' - name: SENTRY_CLIENT_ENVIRONMENT default: '' + - name: OPENID_CONNECT_ENABLED + default: 'false' runtime_postprocess: - expression: int({}) @@ -1469,6 +1473,7 @@ runtime_postprocess: - expression: str({}).lower() in ("true", "yes", "1") vars: - authentication.two_factor + - authentication.openid_connect.enabled - getitfixed.enabled - layers.geometry_validation - smtp.ssl diff --git a/geoportal/Dockerfile b/geoportal/Dockerfile index bb2766072..0ad2ba361 100644 --- a/geoportal/Dockerfile +++ b/geoportal/Dockerfile @@ -44,7 +44,7 @@ RUN chmod go+w /etc/static-ngeo/ RUN --mount=type=cache,target=/root/.cache \ python3 -m pip install --disable-pip-version-check --editable=/app/ \ - && python3 -m compileall -q /usr/local/lib/python3.* \ + && python3 -m compileall -q /venv/lib/python3.* \ -x '/(ptvsd|.*pydev.*|networkx|scaffolds|yaml_include)/' \ && python3 -m compileall -q /app/geomapfish_geoportal -x /app/geomapfish_geoportal/static.* diff --git a/geoportal/geomapfish_geoportal/static-ngeo/js/apps/desktop.html.ejs b/geoportal/geomapfish_geoportal/static-ngeo/js/apps/desktop.html.ejs index 1f5be1a1f..5ebc10a58 100644 --- a/geoportal/geomapfish_geoportal/static-ngeo/js/apps/desktop.html.ejs +++ b/geoportal/geomapfish_geoportal/static-ngeo/js/apps/desktop.html.ejs @@ -349,7 +349,7 @@ 'Ihr Browser wird nicht unterstützt, bitte verwenden Sie eine aktuelle Version von Firefox, Chrome oder Edge.' ); - + <% for (var js in htmlWebpackPlugin.files.js) { %> <% } %> diff --git a/geoportal/geomapfish_geoportal/static-ngeo/js/apps/iframe_api.html.ejs b/geoportal/geomapfish_geoportal/static-ngeo/js/apps/iframe_api.html.ejs index 024a8cfd2..277fb0981 100644 --- a/geoportal/geomapfish_geoportal/static-ngeo/js/apps/iframe_api.html.ejs +++ b/geoportal/geomapfish_geoportal/static-ngeo/js/apps/iframe_api.html.ejs @@ -76,7 +76,7 @@ 'Ihr Browser wird nicht unterstützt, bitte verwenden Sie eine aktuelle Version von Firefox, Chrome oder Edge.' ); - + <% for (var js in htmlWebpackPlugin.files.js) { %> <% } %> diff --git a/geoportal/geomapfish_geoportal/static-ngeo/js/apps/mobile.html.ejs b/geoportal/geomapfish_geoportal/static-ngeo/js/apps/mobile.html.ejs index fcbb955df..21a7ed186 100644 --- a/geoportal/geomapfish_geoportal/static-ngeo/js/apps/mobile.html.ejs +++ b/geoportal/geomapfish_geoportal/static-ngeo/js/apps/mobile.html.ejs @@ -207,7 +207,7 @@ 'Ihr Browser wird nicht unterstützt, bitte verwenden Sie eine aktuelle Version von Firefox, Chrome oder Edge.' ); - + <% for (var js in htmlWebpackPlugin.files.js) { %> <% } %> diff --git a/geoportal/geomapfish_geoportal/static-ngeo/js/apps/mobile_alt.html.ejs b/geoportal/geomapfish_geoportal/static-ngeo/js/apps/mobile_alt.html.ejs index 80108b61b..3b0d08ecf 100644 --- a/geoportal/geomapfish_geoportal/static-ngeo/js/apps/mobile_alt.html.ejs +++ b/geoportal/geomapfish_geoportal/static-ngeo/js/apps/mobile_alt.html.ejs @@ -192,7 +192,7 @@ 'Ihr Browser wird nicht unterstützt, bitte verwenden Sie eine aktuelle Version von Firefox, Chrome oder Edge.' ); - + <% for (var js in htmlWebpackPlugin.files.js) { %> <% } %> diff --git a/geoportal/geomapfish_geoportal/static-ngeo/js/apps/oeedit.html.ejs b/geoportal/geomapfish_geoportal/static-ngeo/js/apps/oeedit.html.ejs index 410cfcf86..1ab2bf2d2 100644 --- a/geoportal/geomapfish_geoportal/static-ngeo/js/apps/oeedit.html.ejs +++ b/geoportal/geomapfish_geoportal/static-ngeo/js/apps/oeedit.html.ejs @@ -160,7 +160,7 @@ 'Ihr Browser wird nicht unterstützt, bitte verwenden Sie eine aktuelle Version von Firefox, Chrome oder Edge.' ); - + <% for (var js in htmlWebpackPlugin.files.js) { %> <% } %> diff --git a/tests/test_app.py b/tests/test_app.py index fa124e97f..ff40e44b6 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -38,3 +38,9 @@ def test_url(url: str, params: dict[str, str], timeout: int) -> None: continue break assert response.status_code == 200, response.text + + +def test_admin() -> None: + """Tests that the admin page will provide the login page.""" + response = requests.get("https://front/admin/", verify=False, timeout=30) # nosec + assert response.status_code == 200, response.text From ec4fef3f012a600cf51416f9d748eb7659ff2662 Mon Sep 17 00:00:00 2001 From: "geo-ghci-int[bot]" <146321879+geo-ghci-int[bot]@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:38:44 +0000 Subject: [PATCH 2/2] Update from base branch From the artifact of the previous workflow run --- tests/test_app.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/test_app.py b/tests/test_app.py index ff40e44b6..fa124e97f 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -38,9 +38,3 @@ def test_url(url: str, params: dict[str, str], timeout: int) -> None: continue break assert response.status_code == 200, response.text - - -def test_admin() -> None: - """Tests that the admin page will provide the login page.""" - response = requests.get("https://front/admin/", verify=False, timeout=30) # nosec - assert response.status_code == 200, response.text