From 6ee88576ab895d74076559aae24722c856a174bb Mon Sep 17 00:00:00 2001 From: Jiri Kozel Date: Mon, 4 Sep 2023 20:24:43 +0200 Subject: [PATCH] Remove LAYMAN_GS_PATH environment variable --- .env.demo | 1 - .env.dev | 1 - .env.test | 1 - CHANGELOG.md | 6 ++++-- README.md | 4 ++-- doc/env-settings.md | 3 --- src/layman_settings.py | 2 +- 7 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.env.demo b/.env.demo index 60aef9117..9d3849595 100644 --- a/.env.demo +++ b/.env.demo @@ -30,7 +30,6 @@ LAYMAN_PRIME_SCHEMA=_prime_schema GEOSERVER_ADMIN_PASSWORD=geoserver LAYMAN_GS_HOST=geoserver LAYMAN_GS_PORT=8080 -LAYMAN_GS_PATH=/geoserver/ LAYMAN_GS_USER=layman LAYMAN_GS_PASSWORD=laymanpwd LAYMAN_GS_ROLE=LAYMAN_ROLE diff --git a/.env.dev b/.env.dev index fd4b160e1..48061c48f 100644 --- a/.env.dev +++ b/.env.dev @@ -30,7 +30,6 @@ LAYMAN_PRIME_SCHEMA=_prime_schema GEOSERVER_ADMIN_PASSWORD=geoserver LAYMAN_GS_HOST=geoserver LAYMAN_GS_PORT=8080 -LAYMAN_GS_PATH=/geoserver/ LAYMAN_GS_USER=layman LAYMAN_GS_PASSWORD=laymanpwd LAYMAN_GS_ROLE=LAYMAN_ROLE diff --git a/.env.test b/.env.test index d640a9dde..2f2b738a2 100644 --- a/.env.test +++ b/.env.test @@ -30,7 +30,6 @@ LAYMAN_PRIME_SCHEMA=_prime_schema GEOSERVER_ADMIN_PASSWORD=geoserver LAYMAN_GS_HOST=geoserver LAYMAN_GS_PORT=8080 -LAYMAN_GS_PATH=/geoserver/ LAYMAN_GS_USER=layman_test LAYMAN_GS_PASSWORD=laymanpwd LAYMAN_GS_ROLE=LAYMAN_TEST_ROLE diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a94e6540..997602ff5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,9 @@ {release-date} ### Upgrade requirements - Stop using environment variable `LAYMAN_GS_PROXY_BASE_URL`, it has no effect to Layman anymore. - - GeoServer's [Proxy Base URL](https://docs.geoserver.org/2.21.x/en/user/configuration/globalsettings.html) is now automatically set by Layman on each start. Value is automatically derived from environment variables [`LAYMAN_CLIENT_PUBLIC_URL`](doc/env-settings.md#layman_client_public_url) (protocol), [`LAYMAN_PROXY_SERVER_NAME`](doc/env-settings.md#layman_proxy_server_name) (domain and port), and [`LAYMAN_GS_PATH`](doc/env-settings.md#layman_gs_path) (path). + - GeoServer's [Proxy Base URL](https://docs.geoserver.org/2.21.x/en/user/configuration/globalsettings.html) is now automatically set by Layman on each start. Value is automatically derived from environment variables [`LAYMAN_CLIENT_PUBLIC_URL`](doc/env-settings.md#layman_client_public_url) (protocol), [`LAYMAN_PROXY_SERVER_NAME`](doc/env-settings.md#layman_proxy_server_name) (domain and port), and [`LAYMAN_GS_PATH`](https://github.com/LayerManager/layman/blob/v1.21.1/doc/env-settings.md#layman_gs_path) (path). +- Stop using environment variable `LAYMAN_GS_PATH`, it has no effect to Layman anymore. + - GeoServer's URL path must be always `/geoserver/` (that is true for GeoServer shipped with Layman). ### Migrations and checks #### Schema migrations - [#868](https://github.com/LayerManager/layman/issues/868) Create new table `map_layer` in prime DB schema. @@ -737,7 +739,7 @@ There is a critical bug in this release, posting new layer breaks Layman: https: - [#74](https://github.com/LayerManager/layman/issues/74) Layman user and role at GeoServer defined by [LAYMAN_GS_USER](doc/env-settings.md#LAYMAN_GS_USER) and [LAYMAN_GS_ROLE](doc/env-settings.md#LAYMAN_GS_ROLE) are now created automatically on Layman's startup if an only if new environment variable [GEOSERVER_ADMIN_PASSWORD](doc/env-settings.md#GEOSERVER_ADMIN_PASSWORD) is provided. There is no need to set [GEOSERVER_ADMIN_PASSWORD](doc/env-settings.md#GEOSERVER_ADMIN_PASSWORD) for other reason than automatically creating Layman user and Layman role. - No change is required. If you are migrating existing instance, Layman user and role are already created, so you don't need to set [GEOSERVER_ADMIN_PASSWORD](doc/env-settings.md#GEOSERVER_ADMIN_PASSWORD). If this is your first Layman release, [GEOSERVER_ADMIN_PASSWORD](doc/env-settings.md#GEOSERVER_ADMIN_PASSWORD) is set in `.env` files starting with this version, so Layman user and role at GeoServer will be automatically created on startup. - No need to run command `make geoserver-reset-default-datadir` from now on. This command was removed from make options. -- [#62](https://github.com/LayerManager/layman/issues/62) GeoServer [Proxy Base URL](https://docs.geoserver.org/2.21.x/en/user/configuration/globalsettings.html) is now automatically set on Layman's startup according to [LAYMAN_GS_PROXY_BASE_URL](https://github.com/LayerManager/layman/blob/v1.21.1/doc/env-settings.md#LAYMAN_GS_PROXY_BASE_URL). If you do not set the variable, value is calculated as [LAYMAN_CLIENT_PUBLIC_URL](doc/env-settings.md#LAYMAN_CLIENT_PUBLIC_URL)+[LAYMAN_GS_PATH](doc/env-settings.md#LAYMAN_GS_PATH). If you set it to empty string, no change of Proxy Base URL will be done on GeoServer side. +- [#62](https://github.com/LayerManager/layman/issues/62) GeoServer [Proxy Base URL](https://docs.geoserver.org/2.21.x/en/user/configuration/globalsettings.html) is now automatically set on Layman's startup according to [LAYMAN_GS_PROXY_BASE_URL](https://github.com/LayerManager/layman/blob/v1.21.1/doc/env-settings.md#LAYMAN_GS_PROXY_BASE_URL). If you do not set the variable, value is calculated as [LAYMAN_CLIENT_PUBLIC_URL](doc/env-settings.md#LAYMAN_CLIENT_PUBLIC_URL)+[LAYMAN_GS_PATH](https://github.com/LayerManager/layman/blob/v1.21.1/doc/env-settings.md#LAYMAN_GS_PATH). If you set it to empty string, no change of Proxy Base URL will be done on GeoServer side. - [#83](https://github.com/LayerManager/layman/issues/89) All layers are created as `GEOMETRY` type, so any other type can be added (for example polygons can be added to points). - [#73](https://github.com/LayerManager/layman/issues/73) Layman users are automatically created on GeoServer (either at start up of Layman or when reserved) with separate role and workspace. Username is the same as in Layman, name of role is `"USER_"+username`, name of workspace is the same as username. Read and write permissions for workspace are set according to Layman's authorization (as of now read-everyone-write-everyone or read-everyone-write-owner). - New environment variables [LAYMAN_GS_USER_GROUP_SERVICE](doc/env-settings.md#LAYMAN_GS_USER_GROUP_SERVICE) and [LAYMAN_GS_ROLE_SERVICE](doc/env-settings.md#LAYMAN_GS_ROLE_SERVICE) enable to control which user/group and role services are used at GeoServer. Not setting these variables means to use default services. diff --git a/README.md b/README.md index da42207d1..ffe791b47 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ Also, anytime you change `.env` file, remember to rebuild docker images as some ## Dependencies -Layman has [many dependencies](doc/dependencies.md). Most of them are shipped with Layman. However there are some **external dependencies** that should be treated carefully: +Layman has [many dependencies](doc/dependencies.md). Most of them are shipped with Layman. However, there are some **external dependencies** that should be treated carefully: - PostgreSQL & PostGIS - QGIS Server - GeoServer @@ -177,7 +177,7 @@ Within PostgreSQL, you need to provide one database for Layman and one database Within QGIS Server, you do not need to provide anything special. -Within GeoServer, you need to provide either admin password [GEOSERVER_ADMIN_PASSWORD](doc/env-settings.md#GEOSERVER_ADMIN_PASSWORD), or one Layman user [LAYMAN_GS_USER](doc/env-settings.md#LAYMAN_GS_USER) and one layman role [LAYMAN_GS_ROLE](doc/env-settings.md#LAYMAN_GS_ROLE). If admin password is provided, Layman will create the Layman user and the Layman role automatically. +Within GeoServer, you need to provide either admin password [GEOSERVER_ADMIN_PASSWORD](doc/env-settings.md#GEOSERVER_ADMIN_PASSWORD), or one Layman user [LAYMAN_GS_USER](doc/env-settings.md#LAYMAN_GS_USER) and one layman role [LAYMAN_GS_ROLE](doc/env-settings.md#LAYMAN_GS_ROLE). If admin password is provided, Layman will create the Layman user and the Layman role automatically. URL path of the GeoServer must be `/geoserver/`. Within Redis, you need to provide two databases, one for Layman, second for Layman Test Client. Connection strings are defined by [LAYMAN_REDIS_URL](doc/env-settings.md#LAYMAN_REDIS_URL) and [LTC_REDIS_URL](doc/env-settings.md#LTC_REDIS_URL). diff --git a/doc/env-settings.md b/doc/env-settings.md index b8df14c6f..b47fc6f8d 100644 --- a/doc/env-settings.md +++ b/doc/env-settings.md @@ -155,9 +155,6 @@ Internal URL host of GeoServer instance. ### LAYMAN_GS_PORT Internal URL port of GeoServer instance. -### LAYMAN_GS_PATH -URL path of GeoServer instance. - ### LAYMAN_GS_USER Name of [GeoServer user](https://docs.geoserver.org/2.21.x/en/user/security/webadmin/ugr.html#add-user) that Layman uses for authentication and communication with GeoServer. The LAYMAN_GS_USER must be another user than default `admin` user. The LAYMAN_GS_USER user must have at least the [LAYMAN_GS_ROLE](#LAYMAN_GS_ROLE) and default [`ADMIN`](https://docs.geoserver.org/2.21.x/en/user/security/usergrouprole/roleservices.html#mapping-roles-to-system-roles) role (defined by `adminRoleName`). The user and his required roles will be created automatically on Layman's startup if [GEOSERVER_ADMIN_PASSWORD](#GEOSERVER_ADMIN_PASSWORD) is provided. diff --git a/src/layman_settings.py b/src/layman_settings.py index 930b29a36..ad375676d 100644 --- a/src/layman_settings.py +++ b/src/layman_settings.py @@ -114,7 +114,7 @@ class EnumWfsWmsStatus(Enum): LAYMAN_GS_HOST = os.environ['LAYMAN_GS_HOST'] LAYMAN_GS_PORT = os.environ['LAYMAN_GS_PORT'] -LAYMAN_GS_PATH = os.environ['LAYMAN_GS_PATH'] +LAYMAN_GS_PATH = '/geoserver/' LAYMAN_GS_URL = f"http://{LAYMAN_GS_HOST}:{LAYMAN_GS_PORT}{LAYMAN_GS_PATH}" geoserver.set_settings(LAYMAN_GS_URL, LAYMAN_GS_ROLE_SERVICE, LAYMAN_GS_USER_GROUP_SERVICE, DEFAULT_CONNECTION_TIMEOUT, )