diff --git a/bin/eval-templates b/bin/eval-templates index af67d111ee..c22344c236 100755 --- a/bin/eval-templates +++ b/bin/eval-templates @@ -52,4 +52,13 @@ find /etc/static-ngeo/ \( -name '*.js' -or -name '*.css' -or -name '*.html' \) - sed --in-place --expression="s#\.__ENTRY_POINT__#${VISIBLE_ENTRY_POINT}#g" "${file}" done +if [ -d /app/geomapfishapp_geoportal/ ]; then + for name in authentication multi_tenant dev; do + if [ -f "/etc/geomapfish/${name}.py" ]; then + echo "Get: ${name}.py" + cp "/etc/geomapfish/${name}.py" /app/geomapfishapp_geoportal/ + fi + done +fi + exec "$@" diff --git a/doc/integrator/create_application.rst b/doc/integrator/create_application.rst index ed510c0223..e8b6ac3242 100644 --- a/doc/integrator/create_application.rst +++ b/doc/integrator/create_application.rst @@ -222,7 +222,7 @@ We recommend instead that you use dynamic variables as described below. However, in some use cases extending ``vars.yaml`` may be needed: * Configuring highly specific environments -* Configuration of a multi-organization project +* Configuration of a multi-tenant project Use of dynamic variables ........................ @@ -272,7 +272,7 @@ Do not forget to add your changes to git: .. note:: - If you are using a multi-organization project, you should add all new children to + If you are using a multi-tenant project, you should add all new children to the parent site check_collector configuration. After creation and minimal setup the application is ready to be installed. diff --git a/doc/integrator/features.rst b/doc/integrator/features.rst index 4262914c8f..cc9b27448e 100644 --- a/doc/integrator/features.rst +++ b/doc/integrator/features.rst @@ -18,6 +18,6 @@ Features that require additional steps (most of the time): urllogin pdfreport routing - multi_organization + multi_tenant vector_tiles extend_application diff --git a/doc/integrator/multi_organization.rst b/doc/integrator/multi_tenant.rst similarity index 97% rename from doc/integrator/multi_organization.rst rename to doc/integrator/multi_tenant.rst index 01d794161c..b5d6f4bd9a 100644 --- a/doc/integrator/multi_organization.rst +++ b/doc/integrator/multi_tenant.rst @@ -1,7 +1,7 @@ -.. _integrator_multi_organization: +.. _integrator_multi_tenant: -Multi organization -================== +Multi-tenant +============ The geoportal can host multiple organizations, with configuration differences for each organization. In a multi-organization geoportal, each organization will have the same program code @@ -11,7 +11,7 @@ In this example we will have the came CSS but we can do some variations by using see ``cssVars`` in ``gmfOptions`` in the ngeo GMF constants definitions :ngeo_doc:`gmf constants `. -The following lines will provide a basic implementation for multi-organization. +The following lines will provide a basic implementation for multi-tenant. The code should be adapted, currently it handles the hostnames 'org1.camptocamp.com' and 'org2.camptocamp.com', and you probably want to put the hardcoded values in the config. @@ -19,7 +19,7 @@ The code should be adapted, currently it handles the hostnames 'org1.camptocamp. ``__init__.py`` --------------- -In the file ``geoportal/_geoportal/__init__.py`` add the following lines: +In the file ``geoportal/_geoportal/multi_tenant.py`` add the following lines: .. code:: python diff --git a/doc/integrator/ngeo.rst b/doc/integrator/ngeo.rst index ef35cf8926..d0636f9a76 100644 --- a/doc/integrator/ngeo.rst +++ b/doc/integrator/ngeo.rst @@ -121,7 +121,7 @@ The sub section is the interface name, and after that we have: ``Request.route_url`` `documentation `_. -* ``lang_urls_suffix`` suffix used in l10n URL, see: :ref:`integrator_multi_organization`. +* ``lang_urls_suffix`` suffix used in l10n URL, see: :ref:`integrator_multi_tenant`. The dynamic values names are: diff --git a/geoportal/c2cgeoportal_geoportal/scaffolds/advance_create/{{cookiecutter.project}}/geoportal/{{cookiecutter.package}}_geoportal/__init__.py b/geoportal/c2cgeoportal_geoportal/scaffolds/advance_create/{{cookiecutter.project}}/geoportal/{{cookiecutter.package}}_geoportal/__init__.py index 44eac8c037..d14b0ec07d 100644 --- a/geoportal/c2cgeoportal_geoportal/scaffolds/advance_create/{{cookiecutter.project}}/geoportal/{{cookiecutter.package}}_geoportal/__init__.py +++ b/geoportal/c2cgeoportal_geoportal/scaffolds/advance_create/{{cookiecutter.project}}/geoportal/{{cookiecutter.package}}_geoportal/__init__.py @@ -29,6 +29,7 @@ def main(global_config, **settings): config.include("c2cgeoportal_geoportal") config.include({{cookiecutter.package}}_geoportal.multi_organization.includeme) + config.include({{cookiecutter.package}}_geoportal.multi_tenant.includeme) # Scan view decorator for adding routes config.scan() diff --git a/geoportal/c2cgeoportal_geoportal/scaffolds/advance_create/{{cookiecutter.project}}/geoportal/{{cookiecutter.package}}_geoportal/multi_organization.py b/geoportal/c2cgeoportal_geoportal/scaffolds/advance_create/{{cookiecutter.project}}/geoportal/{{cookiecutter.package}}_geoportal/multi_organization.py index 25d9664418..8144d5d350 100644 --- a/geoportal/c2cgeoportal_geoportal/scaffolds/advance_create/{{cookiecutter.project}}/geoportal/{{cookiecutter.package}}_geoportal/multi_organization.py +++ b/geoportal/c2cgeoportal_geoportal/scaffolds/advance_create/{{cookiecutter.project}}/geoportal/{{cookiecutter.package}}_geoportal/multi_organization.py @@ -2,6 +2,6 @@ def includeme(config: Configurator) -> None: - """Initialize the multi organization.""" + """Initialize the multi-tenant.""" del config # Unused diff --git a/geoportal/c2cgeoportal_geoportal/scaffolds/advance_create/{{cookiecutter.project}}/geoportal/{{cookiecutter.package}}_geoportal/multi_tenant.py b/geoportal/c2cgeoportal_geoportal/scaffolds/advance_create/{{cookiecutter.project}}/geoportal/{{cookiecutter.package}}_geoportal/multi_tenant.py new file mode 100644 index 0000000000..8144d5d350 --- /dev/null +++ b/geoportal/c2cgeoportal_geoportal/scaffolds/advance_create/{{cookiecutter.project}}/geoportal/{{cookiecutter.package}}_geoportal/multi_tenant.py @@ -0,0 +1,7 @@ +from pyramid.config import Configurator + + +def includeme(config: Configurator) -> None: + """Initialize the multi-tenant.""" + + del config # Unused diff --git a/geoportal/c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/.dockerignore b/geoportal/c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/.dockerignore index 42ee2380ee..7333d2724b 100644 --- a/geoportal/c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/.dockerignore +++ b/geoportal/c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/.dockerignore @@ -12,3 +12,6 @@ !geoportal/{{cookiecutter.package}}_geoportal/static !geoportal/{{cookiecutter.package}}_geoportal/locale geoportal/{{cookiecutter.package}}_geoportal/locale/*.pot +!geoportal/{{cookiecutter.package}}_geoportal/authentication.py +!geoportal/{{cookiecutter.package}}_geoportal/multi_tenant.py +!geoportal/{{cookiecutter.package}}_geoportal/dev.py diff --git a/geoportal/c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/Dockerfile b/geoportal/c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/Dockerfile index e0ae4eb2e6..d756a5be79 100644 --- a/geoportal/c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/Dockerfile +++ b/geoportal/c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/Dockerfile @@ -28,6 +28,9 @@ ENV PGSCHEMA=$PGSCHEMA RUN \ cd /tmp/config/geoportal/ \ + && if [ "${SIMPLE}" != "TRUE" ]; then \ + rm -f {{cookiecutter.package}}_geoportal/*.py; \ + fi \ && c2c-template --vars ${VARS_FILE} \ --get-config {{cookiecutter.package}}_geoportal/config.yaml \ ${CONFIG_VARS} \