Skip to content

Commit

Permalink
Upgrade to GeoMapFish 2.9rc48
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Jan 20, 2025
1 parent 459baab commit fc249a1
Show file tree
Hide file tree
Showing 15 changed files with 122 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
!geoportal/geomapfish_geoportal/static
!geoportal/geomapfish_geoportal/locale
geoportal/geomapfish_geoportal/locale/*.pot
!geoportal/geomapfish_geoportal/authentication.py
!geoportal/geomapfish_geoportal/multi_tenant.py
!geoportal/geomapfish_geoportal/dev.py

!webcomponents
!package.json
!package-lock.json
Expand Down
3 changes: 3 additions & 0 deletions CONST_create_template/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@
!geoportal/geomapfish_geoportal/static
!geoportal/geomapfish_geoportal/locale
geoportal/geomapfish_geoportal/locale/*.pot
!geoportal/geomapfish_geoportal/authentication.py
!geoportal/geomapfish_geoportal/multi_tenant.py
!geoportal/geomapfish_geoportal/dev.py
1 change: 1 addition & 0 deletions CONST_create_template/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ENV PGSCHEMA=$PGSCHEMA

RUN \
cd /tmp/config/geoportal/ \
&& [ "${SIMPLE}" == "TRUE" ] || rm -f geomapfish_geoportal/*.py \
&& c2c-template --vars ${VARS_FILE} \
--get-config geomapfish_geoportal/config.yaml \
${CONFIG_VARS} \
Expand Down
6 changes: 3 additions & 3 deletions CONST_create_template/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROJECT_PUBLIC_URL=https://example.camptocamp.com/
PROJECT_PUBLIC_URL?=https://example.camptocamp.com/
DUMP_FILE=dump.backup
PACKAGE=geomapfish
LANGUAGES=en fr de it
Expand All @@ -13,10 +13,10 @@ help: ## Display this help message

.PHONY: update-po-from-url
update-po-from-url: ## Update the po files from the URL provide by PROJECT_PUBLIC_URL
curl --fail --retry 5 --retry-delay 1 \
curl ${CURL_ARGS} --fail --retry 5 --retry-delay 1 \
$(PROJECT_PUBLIC_URL)locale.pot > geoportal/${PACKAGE}_geoportal/locale/${PACKAGE}_geoportal-client${SUFFIX}.pot
sed -i '/^"POT-Creation-Date: /d' geoportal/${PACKAGE}_geoportal/locale/${PACKAGE}_geoportal-client${SUFFIX}.pot
docker compose run --rm -T tools update-po-only `id --user` `id --group` $(LANGUAGES)
docker compose run --rm -T --env=SUFFIX=${SUFFIX} tools update-po-only `id --user` `id --group` $(LANGUAGES)

.PHONY: update-po
update-po: ## Update the po files from the running composition
Expand Down
2 changes: 2 additions & 0 deletions CONST_create_template/docker-compose-lib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ services:
- C2CWSGIUTILS_LOG_LEVEL
- LOG_TYPE
- C2CGEOPORTAL_THEME_TIMEOUT=300
# For multi tenant
- DEFAULT_PREFIX

geoportal-advance:
image: ${DOCKER_BASE}-geoportal:${DOCKER_TAG}
Expand Down
2 changes: 1 addition & 1 deletion CONST_create_template/env.default
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Default values for c2cgeoportal
GEOMAPFISH_VERSION=2.9.rc.47
GEOMAPFISH_VERSION=2.9.rc.48
GEOMAPFISH_MAIN_VERSION=2.9
GEOMAPFISH_MAIN_MINOR_VERSION=2.9.0
COMPOSE_PROJECT_NAME=geomapfish
Expand Down
3 changes: 3 additions & 0 deletions CONST_create_template/env.project
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,6 @@ C2C_AUTH_GITHUB_SCOPE=repo
#C2C_AUTH_GITHUB_SECRET=<secret>
#C2C_AUTH_GITHUB_PROXY_URL=https://geoservicies.camptocamp.com/redirect
C2C_USE_SESSION=true

# For multi-tenant
DEFAULT_PREFIX=unknown
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from pyramid.config import Configurator


def includeme(config: Configurator) -> None:
"""Initialize the multi-tenant."""

del config # Unused
44 changes: 44 additions & 0 deletions CONST_create_template/scripts/multi-tenant-update-po
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env python3

import argparse
import os
import subprocess

import yaml


def _main() -> None:
parser = argparse.ArgumentParser(
description="\n".join(
[
"Update the po files in multi tenants mode",
"",
"Using the information available in the tenants.yaml file.",
]
),
formatter_class=argparse.RawDescriptionHelpFormatter,
)
parser.parse_args()

with open("tenants.yaml") as tenants_file:
tenants = yaml.safe_load(tenants_file.read())

for name, tenant in tenants.get("tenants", {}).items():
print(f"Update localization for tenant {name}.")
subprocess.run(
[
"make",
"update-po-from-url",
],
check=True,
env={
**os.environ,
"PROJECT_PUBLIC_URL": tenant["public_url"],
"SUFFIX": tenant["suffix"],
"CURL_ARGS": tenant.get("curl_args", ""),
},
)


if __name__ == "__main__":
_main()
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ENV PGSCHEMA=$PGSCHEMA

RUN \
cd /tmp/config/geoportal/ \
&& [ "${SIMPLE}" == "TRUE" ] || rm -f geomapfish_geoportal/*.py \
&& c2c-template --vars ${VARS_FILE} \
--get-config geomapfish_geoportal/config.yaml \
${CONFIG_VARS} \
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROJECT_PUBLIC_URL=https://geomapfish-demo-2-9.camptocamp.com/
PROJECT_PUBLIC_URL?=https://geomapfish-demo-2-9.camptocamp.com/
DUMP_FILE=data/prod-2-7.dump
PACKAGE=geomapfish
LANGUAGES=en fr de it
Expand All @@ -13,10 +13,10 @@ help: ## Display this help message

.PHONY: update-po-from-url
update-po-from-url: ## Update the po files from the URL provide by PROJECT_PUBLIC_URL
curl --fail --retry 5 --retry-delay 1 \
curl ${CURL_ARGS} --fail --retry 5 --retry-delay 1 \
$(PROJECT_PUBLIC_URL)locale.pot > geoportal/${PACKAGE}_geoportal/locale/${PACKAGE}_geoportal-client${SUFFIX}.pot
sed -i '/^"POT-Creation-Date: /d' geoportal/${PACKAGE}_geoportal/locale/${PACKAGE}_geoportal-client${SUFFIX}.pot
docker compose run --rm -T tools update-po-only `id --user` `id --group` $(LANGUAGES)
docker compose run --rm -T --env=SUFFIX=${SUFFIX} tools update-po-only `id --user` `id --group` $(LANGUAGES)

.PHONY: update-po
update-po: ## Update the po files from the running composition
Expand Down
2 changes: 2 additions & 0 deletions docker-compose-lib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ services:
- C2CWSGIUTILS_LOG_LEVEL
- LOG_TYPE
- C2CGEOPORTAL_THEME_TIMEOUT=300
# For multi tenant
- DEFAULT_PREFIX

geoportal-advance:
image: ${DOCKER_BASE}-geoportal:${DOCKER_TAG}
Expand Down
2 changes: 1 addition & 1 deletion env.default
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Default values for c2cgeoportal
GEOMAPFISH_VERSION=2.9.rc.47
GEOMAPFISH_VERSION=2.9.rc.48
GEOMAPFISH_MAIN_VERSION=2.9
GEOMAPFISH_MAIN_MINOR_VERSION=2.9.0
COMPOSE_PROJECT_NAME=geomapfish
Expand Down
3 changes: 3 additions & 0 deletions env.project
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ OPENID_CONNECT_ENABLED=True
AWS_DEFAULT_REGION=ch-dk-2
AWS_S3_ENDPOINT=sos-ch-dk-2.exo.io

# For multi-tenant
DEFAULT_PREFIX=unknown

# Set a strong password here for authentication on technical interfaces behind path /c2c
C2C_SECRET=1234
# Or use connection via GitHub, see: https://camptocamp.github.io/c2cgeoportal/2.8/integrator/c2cwsgiutils.html#authentication
Expand Down
44 changes: 44 additions & 0 deletions scripts/multi-tenant-update-po
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env python3

import argparse
import os
import subprocess

import yaml


def _main() -> None:
parser = argparse.ArgumentParser(
description="\n".join(
[
"Update the po files in multi tenants mode",
"",
"Using the information available in the tenants.yaml file.",
]
),
formatter_class=argparse.RawDescriptionHelpFormatter,
)
parser.parse_args()

with open("tenants.yaml") as tenants_file:
tenants = yaml.safe_load(tenants_file.read())

for name, tenant in tenants.get("tenants", {}).items():
print(f"Update localization for tenant {name}.")
subprocess.run(
[
"make",
"update-po-from-url",
],
check=True,
env={
**os.environ,
"PROJECT_PUBLIC_URL": tenant["public_url"],
"SUFFIX": tenant["suffix"],
"CURL_ARGS": tenant.get("curl_args", ""),
},
)


if __name__ == "__main__":
_main()

0 comments on commit fc249a1

Please sign in to comment.