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 #1566

Merged
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 @@ -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
5 changes: 3 additions & 2 deletions CONST_create_template/geoportal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ RUN --mount=type=cache,target=/root/.cache \
python3 -m pip install --disable-pip-version-check --editable=/app/ \
&& 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
&& python3 -m compileall -q "/app/geomapfish_geoportal" -x "/app/geomapfish_geoportal/static".* \
&& pip freeze > /requirements.txt \
&& chmod go+w "/app/geomapfish_geoportal" "/app/geomapfish_geoportal/authentication.py" "/app/geomapfish_geoportal/multi_tenant.py" "/app/geomapfish_geoportal/dev.py"

ARG GIT_HASH
RUN c2cwsgiutils-genversion ${GIT_HASH}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import geomapfish_geoportal.authentication
import geomapfish_geoportal.dev
import geomapfish_geoportal.multi_organization
import geomapfish_geoportal.multi_tenant
from c2cgeoportal_geoportal import add_interface_config, locale_negotiator
from c2cgeoportal_geoportal.lib.i18n import LOCALE_PATH
from geomapfish_geoportal.resources import Root
Expand All @@ -29,6 +30,7 @@ def main(global_config, **settings):
config.include("c2cgeoportal_geoportal")

config.include(geomapfish_geoportal.multi_organization.includeme)
config.include(geomapfish_geoportal.multi_tenant.includeme)

# Scan view decorator for adding routes
config.scan()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@


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

del config # Unused
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
2 changes: 1 addition & 1 deletion CONST_create_template/geoportal/webpack.apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ for (const filename of ls(
chunks: [name],
vars: {
entry_point: '${VISIBLE_ENTRY_POINT}',
version: '2.9.rc.47',
version: '2.9.rc.48',
cache_version: '${CACHE_VERSION}',
},
})
Expand Down
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
4 changes: 3 additions & 1 deletion geoportal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ RUN --mount=type=cache,target=/root/.cache \
python3 -m pip install --disable-pip-version-check --editable=/app/ \
&& 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.*
&& python3 -m compileall -q "/app/geomapfish_geoportal" -x "/app/geomapfish_geoportal/static".* \
&& pip freeze > /requirements.txt \
&& chmod go+w "/app/geomapfish_geoportal" "/app/geomapfish_geoportal/authentication.py" "/app/geomapfish_geoportal/multi_tenant.py" "/app/geomapfish_geoportal/dev.py"

ARG GIT_HASH
RUN c2cwsgiutils-genversion ${GIT_HASH}
Expand Down
2 changes: 2 additions & 0 deletions geoportal/geomapfish_geoportal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import geomapfish_geoportal.authentication
import geomapfish_geoportal.dev
import geomapfish_geoportal.multi_organization
import geomapfish_geoportal.multi_tenant
from c2cgeoportal_geoportal import add_interface_config, locale_negotiator
from c2cgeoportal_geoportal.lib.i18n import LOCALE_PATH
from geomapfish_geoportal.resources import Root
Expand All @@ -29,6 +30,7 @@ def main(global_config, **settings):
config.include("c2cgeoportal_geoportal")

config.include(geomapfish_geoportal.multi_organization.includeme)
config.include(geomapfish_geoportal.multi_tenant.includeme)

# Scan view decorator for adding routes
config.scan()
Expand Down
2 changes: 1 addition & 1 deletion geoportal/geomapfish_geoportal/multi_organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@


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

del config # Unused
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
2 changes: 1 addition & 1 deletion geoportal/webpack.apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ for (const filename of ls(
chunks: [name],
vars: {
entry_point: '${VISIBLE_ENTRY_POINT}',
version: '2.9.rc.47',
version: '2.9.rc.48',
cache_version: '${CACHE_VERSION}',
},
})
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()
Loading