Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade failed #1563

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -332,6 +332,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.8.1.180
GEOMAPFISH_VERSION=2.8.1.181
GEOMAPFISH_MAIN_VERSION=2.8
GEOMAPFISH_MAIN_MINOR_VERSION=2.8.1
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
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", "r") 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-8.camptocamp.com/
PROJECT_PUBLIC_URL?=https://geomapfish-demo-2-8.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 @@ -332,6 +332,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.8.1.180
GEOMAPFISH_VERSION=2.8.1.181
GEOMAPFISH_MAIN_VERSION=2.8
GEOMAPFISH_MAIN_MINOR_VERSION=2.8.1
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 @@ -83,6 +83,9 @@ BASICAUTH=True
# SENTRY_URL=https://8dfa6c72fcad48c487c6a89b22ce581b@o330647.ingest.sentry.io/1851011
# SENTRY_CLIENT_ENVIRONMENT=dev

# For multi-tenant
DEFAULT_PREFIX=unknown

# Custom Swisscom heatmap plugin
SWISSCOM_CLIENT_ID=setme
SWISSCOM_CLIENT_SECRET=setme
7 changes: 7 additions & 0 deletions geoportal/geomapfish_geoportal/multi_tenant.py
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 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", "r") 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()
Loading