eZ Platform Discussions

eZ Platform 2 install : admin, multisite

version2

#1

Hi,

I’m am trying to upgrade from eZ Platform 1.13 to EZP 2.0.0.

We are working on a multisite instance.

Our model is in a bundle “CiradEzSiteBundle” loaded from AppKernel.php (new Cirad\EzSiteBundle\CiradEzSiteBundle()).

For now, I have made the frontoffice work, but there are a few things I don’t know how to manage. My main problems are related to the admin configuration and the cache service.

The BackOffice

I have configured an admin siteaccess and its alias.

match:
    Compound\LogicalAnd:
        ezsite_admin_trav:
            matchers:
                Map\Host: { admin-ezsite-travail.cirad.fr: true }
            match: ezsite_admin

But when I try to access the admin alias, I get an error :

Unable to find template "CiradEzSiteBundle:content/folder:full.html.twig"

Is there something I should add to the config to make this siteaccess load the admin bundle ?

The cache

With stash, to differentiate caches for different sites, we just had to add a config key : “cache_pool_name: ezsite”

But now, we need to add a cache pool service… (“Cache pool service, needs to be different per repository (database) on multi repository install.”)

How is it done ? Will we need to add php code for every new site ? By default, the cache_service_name is “cache.app”. How could I create other cache pool services, “cache.app.ezsite”, “cache.app.test” ?

Many thanks for your help.
GF

For information, I include a bit of our config. Our ezplatform.yml is not exactly the same as the code below as I have split the configuration in different files. I tried to make a file which is more compact and legible but still represents our config.

ezpublish:
    http_cache:
        purge_type: '%purge_type%'

    # Repositories configuration
    repositories:
        rep_ezsite:
            storage:
              engine: legacy
              connection: bdd_ezsite
            search:
              engine: %search_engine%
              connection: solr_ezsite
        rep_test:
            storage:
              engine: legacy
              connection: bdd_test
            search:
              engine: %search_engine%
              connection: solr_test

    # Siteaccess configuration
    siteaccess:
        list:
            - ezsite_admin
            - ezsite_fr
            - ezsite_en
            - test_admin
            - test_fr
            - test_es
            - test_en
        groups:
            admin_group:
                - ezsite_admin
                - test_admin
            ezsite_group:
                - ezsite_admin
                - ezsite_fr
                - ezsite_en
                - ezsite_es
            test_group:
                - test_admin
                - test_fr
                - test_es
                - test_en

        default_siteaccess: to_be_defined

        match:
            Compound\LogicalAnd:
                # Site: EZSITE
                ezsite_admin_trav:
                    matchers:
                        Map\Host: { admin-ezsite-travail.cirad.fr: true }
                    match: ezsite_admin
                ezsite_en_trav:
                    matchers:
                        Map\Host: { ezsite-travail.cirad.fr: true }
                        Map\URI: { en: true }
                    match: ezsite_en
                ezsite_fr_trav:
                    matchers:
                        Map\Host: { ezsite-travail.cirad.fr: true }
                    match: ezsite_fr
                # Site: TEST
                test_admin_trav:
                    matchers:
                        Map\Host: { admin-test-travail.cirad.fr: true }
                    match: test_admin
                test_es_trav:
                    matchers:
                        Map\Host: { test-travail.cirad.fr: true }
                        Map\URI: { es: true }
                    match: test_es
                test_en_trav:
                    matchers:
                        Map\Host: { test-travail.cirad.fr: true }
                        Map\URI: { en: true }
                    match: test_en
                test_fr_trav:
                    matchers:
                        Map\Host: { test-travail.cirad.fr: true }
                    match: test_fr

    # System settings, grouped by siteaccess and/or siteaccess group
    system:
        # Site: EZSITE
        ezsite_group:
            cache_service_name: "cache.app"
            repository: rep_ezsite
            var_dir: var/ezsite
            translation_siteaccesses: [ezsite_fr, ezsite_en]
            content:
                tree_root:
                    location_id: 54
                    excluded_uri_prefixes: [ /media ]
            image_variations:
                large:
                    reference: reference
                    filters:
                        geometry/scaledownonly: [400, 400]
        ezsite_fr:
            languages: [ fre-FR, eng-GB ]
        ezsite_en:
            languages: [ eng-GB, fre-FR ]
        ezsite_admin:
            languages: [ fre-FR ]
            content:
                tree_root:
                    location_id: 2
                default_ttl: '%httpcache_default_ttl%'
            http_cache:
                purge_servers: ['%purge_server%']

        # Site: TEST
        test_group:
            cache_service_name: "cache.app.test"
            repository: rep_test
            var_dir: var/test
            translation_siteaccesses: [test_fr, test_es, test_en]
            content:
                tree_root:
                    location_id: 54
                    excluded_uri_prefixes: [ /media ]
        test_fr:
            languages: [ fre-FR, esl-ES, eng-GB ]
        test_es:
            languages: [ esl-ES, fre-FR, eng-GB ]
        test_en:
            languages: [ eng-GB, fre-FR, esl-ES ]
        test_admin:
            languages: [ fre-FR ]
            content:
                tree_root:
                    location_id: 2
                default_ttl: '%httpcache_default_ttl%'
            http_cache:
                purge_servers: ['%purge_server%']

#2

Hi,

As for the backoffice problem, I have found my error (I defined an override for “folder” (that we don’t use), without defining the twig file). I have corrected it.

Anyway, I still have problems with the backoffice. It seems that my overrides I have defined for the frontoffice (pagelayout, full view templates…) are used by the backoffice…I don’t know how to separate thedevelopments done for the front site to prevent them to be used also in the backoffioce…


#3

Hi @GiFo

If you use ezpublish.system.default to configure your view override, override will apply for all siteaccess.

ezpublish:
    system:
        default:
            content_view:
                full:
                    product:
                        template: "full/product.html.twig"
                        match:
                            Identifier\ContentType: "product" 

With the default intalation and only one public site access, instead of using ezpublish.system.default, ezpublish.system.site_group should be used.

If you have multiple siteaccess, you should configure a group like this:

ezpublish:
    siteaccess:
        list: [site_fr, site_es, site_en, admin]
        groups:
            site_public_group: [site_fr, site_es, site_en]

And apply the view override on the group:

ezpublish:
    system:
        site_public_group:
            content_view:
                full:
                    product:
                        template: "full/product.html.twig"
                        match:
                            Identifier\ContentType: "product"

#4

OK.
I actually placed all these configuration elements under “default”.
Thanks for your help.